From 237c7e2b9f5a13d6a14afa0c81f35033e51397f1 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Tue, 21 Oct 2025 08:53:09 +0000 Subject: [PATCH 01/34] Configurations: 'specification/keyvault/KeyVault.Management/tspconfig.yaml', API Version: 2025-05-01, SDK Release Type: stable, and CommitSHA: '0476e10d463909ce48ba4a8365d971586ede7f98' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5479988 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md | 58 + .../azure-mgmt-keyvault/_metadata.json | 12 +- .../apiview-properties.json | 437 +- .../azure/mgmt/keyvault/__init__.py | 4 +- ..._vault_management_client.py => _client.py} | 75 +- .../azure/mgmt/keyvault/_configuration.py | 15 +- .../azure/mgmt/keyvault/_patch.py | 4 +- .../azure/mgmt/keyvault/_utils/__init__.py | 2 +- .../azure/mgmt/keyvault/_utils/model_base.py | 1237 +++ .../mgmt/keyvault/_utils/serialization.py | 4 +- .../azure/mgmt/keyvault/_version.py | 7 +- .../azure/mgmt/keyvault/aio/__init__.py | 4 +- ..._vault_management_client.py => _client.py} | 75 +- .../azure/mgmt/keyvault/aio/_configuration.py | 15 +- .../azure/mgmt/keyvault/aio/_patch.py | 13 +- .../mgmt/keyvault/aio/operations/__init__.py | 34 +- .../aio/operations/_keys_operations.py | 505 -- .../_managed_hsm_keys_operations.py | 509 -- .../operations/_managed_hsms_operations.py | 1115 --- ...private_endpoint_connections_operations.py | 484 -- ..._mhsm_private_link_resources_operations.py | 110 - .../operations/_mhsm_regions_operations.py | 141 - .../keyvault/aio/operations/_operations.py | 5646 +++++++++++++- .../mgmt/keyvault/aio/operations/_patch.py | 118 +- ...private_endpoint_connections_operations.py | 479 -- .../_private_link_resources_operations.py | 109 - .../aio/operations/_secrets_operations.py | 507 -- .../aio/operations/_vaults_operations.py | 1214 --- .../azure/mgmt/keyvault/models/__init__.py | 56 +- ...t_management_client_enums.py => _enums.py} | 41 +- .../azure/mgmt/keyvault/models/_models.py | 4291 ++++++++++ .../azure/mgmt/keyvault/models/_models_py3.py | 4581 ----------- .../azure/mgmt/keyvault/models/_patch.py | 4 +- .../mgmt/keyvault/operations/__init__.py | 34 +- .../keyvault/operations/_keys_operations.py | 662 -- .../_managed_hsm_keys_operations.py | 686 -- .../operations/_managed_hsms_operations.py | 1396 ---- ...private_endpoint_connections_operations.py | 616 -- ..._mhsm_private_link_resources_operations.py | 144 - .../operations/_mhsm_regions_operations.py | 174 - .../mgmt/keyvault/operations/_operations.py | 6937 ++++++++++++++++- .../azure/mgmt/keyvault/operations/_patch.py | 115 +- ...private_endpoint_connections_operations.py | 622 -- .../_private_link_resources_operations.py | 143 - .../operations/_secrets_operations.py | 639 -- .../keyvault/operations/_vaults_operations.py | 1568 ---- .../check_vault_name_availability.py | 7 +- .../generated_samples/create_key.py | 7 +- .../generated_samples/create_secret.py | 7 +- .../generated_samples/create_vault.py | 7 +- .../create_vault_with_network_acls.py | 6 +- .../delete_private_endpoint_connection.py | 7 +- .../generated_samples/delete_vault.py | 7 +- .../deleted_managed_hsm_get.py | 7 +- .../deleted_managed_hsm_list.py | 7 +- .../deleted_managed_hsm_purge.py | 7 +- .../generated_samples/get_deleted_vault.py | 7 +- .../generated_samples/get_key.py | 6 +- .../generated_samples/get_key_version.py | 7 +- .../get_private_endpoint_connection.py | 7 +- .../generated_samples/get_secret.py | 7 +- .../generated_samples/get_vault.py | 7 +- .../generated_samples/list_deleted_vaults.py | 7 +- .../generated_samples/list_key_versions.py | 7 +- .../generated_samples/list_keys.py | 7 +- .../generated_samples/list_operations.py | 5 +- .../list_private_endpoint_connection.py | 7 +- .../list_private_link_resources.py | 7 +- .../generated_samples/list_secrets.py | 7 +- .../generated_samples/list_vault.py | 7 +- .../list_vault_by_resource_group.py | 7 +- .../list_vault_by_subscription.py | 7 +- ...anaged_hsm_check_mhsm_name_availability.py | 7 +- .../managed_hsm_create_key.py | 7 +- .../managed_hsm_create_or_update.py | 7 +- .../generated_samples/managed_hsm_delete.py | 7 +- ..._hsm_delete_private_endpoint_connection.py | 7 +- .../generated_samples/managed_hsm_get.py | 7 +- .../generated_samples/managed_hsm_get_key.py | 7 +- .../managed_hsm_get_key_version.py | 7 +- ...ged_hsm_get_private_endpoint_connection.py | 7 +- .../managed_hsm_list_by_resource_group.py | 7 +- .../managed_hsm_list_by_subscription.py | 7 +- .../managed_hsm_list_key_versions.py | 7 +- .../managed_hsm_list_keys.py | 7 +- ...rivate_endpoint_connections_by_resource.py | 7 +- ...managed_hsm_list_private_link_resources.py | 7 +- .../managed_hsm_list_regions_by_resource.py | 7 +- ...ged_hsm_put_private_endpoint_connection.py | 7 +- .../generated_samples/managed_hsm_update.py | 7 +- .../generated_samples/purge_deleted_vault.py | 7 +- .../put_private_endpoint_connection.py | 7 +- .../update_access_policies_add.py | 7 +- .../generated_samples/update_secret.py | 7 +- .../generated_samples/update_vault.py | 7 +- .../generated_tests/conftest.py | 2 +- ...st_key_vault_management_keys_operations.py | 38 +- ..._vault_management_keys_operations_async.py | 38 +- ..._management_managed_hsm_keys_operations.py | 36 +- ...ement_managed_hsm_keys_operations_async.py | 36 +- ...ault_management_managed_hsms_operations.py | 102 +- ...anagement_managed_hsms_operations_async.py | 102 +- ...private_endpoint_connections_operations.py | 42 +- ...e_endpoint_connections_operations_async.py | 42 +- ..._mhsm_private_link_resources_operations.py | 3 +- ...private_link_resources_operations_async.py | 3 +- ...ault_management_mhsm_regions_operations.py | 3 +- ...anagement_mhsm_regions_operations_async.py | 3 +- .../test_key_vault_management_operations.py | 6 +- ...t_key_vault_management_operations_async.py | 6 +- ...private_endpoint_connections_operations.py | 26 +- ...e_endpoint_connections_operations_async.py | 26 +- ...ement_private_link_resources_operations.py | 3 +- ...private_link_resources_operations_async.py | 3 +- ...key_vault_management_secrets_operations.py | 30 +- ...ult_management_secrets_operations_async.py | 30 +- ..._key_vault_management_vaults_operations.py | 105 +- ...ault_management_vaults_operations_async.py | 105 +- .../azure-mgmt-keyvault/pyproject.toml | 4 +- .../disable_test_cli_mgmt_keyvault_async.py | 1 + .../azure-mgmt-keyvault/tsp-location.yaml | 4 + 121 files changed, 19074 insertions(+), 17706 deletions(-) rename sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/{_key_vault_management_client.py => _client.py} (88%) create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_utils/model_base.py rename sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/{_key_vault_management_client.py => _client.py} (89%) delete mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_keys_operations.py delete mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_managed_hsm_keys_operations.py delete mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_managed_hsms_operations.py delete mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_mhsm_private_endpoint_connections_operations.py delete mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_mhsm_private_link_resources_operations.py delete mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_mhsm_regions_operations.py delete mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_private_endpoint_connections_operations.py delete mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_private_link_resources_operations.py delete mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_secrets_operations.py delete mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_vaults_operations.py rename sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/{_key_vault_management_client_enums.py => _enums.py} (92%) create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_models.py delete mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_models_py3.py delete mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_keys_operations.py delete mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_managed_hsm_keys_operations.py delete mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_managed_hsms_operations.py delete mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_mhsm_private_endpoint_connections_operations.py delete mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_mhsm_private_link_resources_operations.py delete mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_mhsm_regions_operations.py delete mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_private_endpoint_connections_operations.py delete mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_private_link_resources_operations.py delete mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_secrets_operations.py delete mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_vaults_operations.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/tsp-location.yaml diff --git a/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md b/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md index 4a419dd0e25a..c2a2c0818ff6 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md +++ b/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md @@ -1,5 +1,63 @@ # Release History +## 13.0.0 (2025-10-21) + +### Features Added + + - Client `KeyVaultManagementClient` added method `send_request` + - Model `DeletedManagedHsm` added property `system_data` + - Model `DeletedVault` added property `system_data` + - Model `Key` added property `properties` + - Model `Key` added property `system_data` + - Model `MHSMPrivateEndpointConnectionItem` added property `properties` + - Model `ManagedHsmKey` added property `properties` + - Model `ManagedHsmKey` added property `system_data` + - Model `Operation` added property `operation_properties` + - Model `Permissions` added property `keys_property` + - Model `PrivateEndpointConnection` added property `system_data` + - Model `PrivateEndpointConnectionItem` added property `properties` + - Model `PrivateLinkResource` added property `system_data` + - Model `Secret` added property `system_data` + - Model `VaultCheckNameAvailabilityParameters` added property `type` + - Added model `ArmResource` + - Added model `CloudError` + - Added enum `CreatedByType` + - Added model `OperationProperties` + - Added model `ProxyResource` + - Added model `TrackedResource` + +### Breaking Changes + + - Model `Key` deleted or renamed its instance variable `attributes` + - Model `Key` deleted or renamed its instance variable `kty` + - Model `Key` deleted or renamed its instance variable `key_ops` + - Model `Key` deleted or renamed its instance variable `key_size` + - Model `Key` deleted or renamed its instance variable `curve_name` + - Model `Key` deleted or renamed its instance variable `key_uri` + - Model `Key` deleted or renamed its instance variable `key_uri_with_version` + - Model `Key` deleted or renamed its instance variable `rotation_policy` + - Model `Key` deleted or renamed its instance variable `release_policy` + - Model `MHSMPrivateEndpointConnectionItem` deleted or renamed its instance variable `private_endpoint` + - Model `MHSMPrivateEndpointConnectionItem` deleted or renamed its instance variable `private_link_service_connection_state` + - Model `MHSMPrivateEndpointConnectionItem` deleted or renamed its instance variable `provisioning_state` + - Model `ManagedHsmKey` deleted or renamed its instance variable `attributes` + - Model `ManagedHsmKey` deleted or renamed its instance variable `kty` + - Model `ManagedHsmKey` deleted or renamed its instance variable `key_ops` + - Model `ManagedHsmKey` deleted or renamed its instance variable `key_size` + - Model `ManagedHsmKey` deleted or renamed its instance variable `curve_name` + - Model `ManagedHsmKey` deleted or renamed its instance variable `key_uri` + - Model `ManagedHsmKey` deleted or renamed its instance variable `key_uri_with_version` + - Model `ManagedHsmKey` deleted or renamed its instance variable `rotation_policy` + - Model `ManagedHsmKey` deleted or renamed its instance variable `release_policy` + - Model `Operation` deleted or renamed its instance variable `service_specification` + - Model `Permissions` deleted or renamed its instance variable `keys` + - Model `PrivateEndpointConnectionItem` deleted or renamed its instance variable `private_endpoint` + - Model `PrivateEndpointConnectionItem` deleted or renamed its instance variable `private_link_service_connection_state` + - Model `PrivateEndpointConnectionItem` deleted or renamed its instance variable `provisioning_state` + - Deleted or renamed model `IdentityType` + - Deleted or renamed model `ProxyResourceWithoutSystemData` + - Deleted or renamed model `Resource` + ## 12.1.1 (2025-10-09) ### Bugs Fixed diff --git a/sdk/keyvault/azure-mgmt-keyvault/_metadata.json b/sdk/keyvault/azure-mgmt-keyvault/_metadata.json index 7fcaeb14700b..e9576815df8c 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/_metadata.json +++ b/sdk/keyvault/azure-mgmt-keyvault/_metadata.json @@ -1,11 +1,7 @@ { - "commit": "520e1f6bc250b4ce51a22eaa7583cc0b24564b71", + "apiVersion": "2025-05-01", + "commit": "0476e10d463909ce48ba4a8365d971586ede7f98", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.10.2", - "use": [ - "@autorest/python@6.40.0", - "@autorest/modelerfour@4.27.0" - ], - "autorest_command": "autorest specification/keyvault/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --package-mode=azure-mgmt --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.40.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", - "readme": "specification/keyvault/resource-manager/readme.md" + "typespec_src": "specification/keyvault/KeyVault.Management", + "emitterVersion": "0.52.1" } \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/apiview-properties.json b/sdk/keyvault/azure-mgmt-keyvault/apiview-properties.json index 41f90483cb89..ef9dcd5aa615 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/apiview-properties.json +++ b/sdk/keyvault/azure-mgmt-keyvault/apiview-properties.json @@ -1,225 +1,220 @@ { - "CrossLanguagePackageId": null, + "CrossLanguagePackageId": "Microsoft.KeyVault", "CrossLanguageDefinitionId": { - "azure.mgmt.keyvault.models.AccessPolicyEntry": null, - "azure.mgmt.keyvault.models.Action": null, - "azure.mgmt.keyvault.models.Attributes": null, - "azure.mgmt.keyvault.models.CheckMhsmNameAvailabilityParameters": null, - "azure.mgmt.keyvault.models.CheckMhsmNameAvailabilityResult": null, - "azure.mgmt.keyvault.models.CheckNameAvailabilityResult": null, - "azure.mgmt.keyvault.models.CloudErrorBody": null, - "azure.mgmt.keyvault.models.DeletedManagedHsm": null, - "azure.mgmt.keyvault.models.DeletedManagedHsmListResult": null, - "azure.mgmt.keyvault.models.DeletedManagedHsmProperties": null, - "azure.mgmt.keyvault.models.DeletedVault": null, - "azure.mgmt.keyvault.models.DeletedVaultListResult": null, - "azure.mgmt.keyvault.models.DeletedVaultProperties": null, - "azure.mgmt.keyvault.models.DimensionProperties": null, - "azure.mgmt.keyvault.models.Error": null, - "azure.mgmt.keyvault.models.IPRule": null, - "azure.mgmt.keyvault.models.Resource": null, - "azure.mgmt.keyvault.models.Key": null, - "azure.mgmt.keyvault.models.KeyAttributes": null, - "azure.mgmt.keyvault.models.KeyCreateParameters": null, - "azure.mgmt.keyvault.models.KeyListResult": null, - "azure.mgmt.keyvault.models.KeyProperties": null, - "azure.mgmt.keyvault.models.KeyReleasePolicy": null, - "azure.mgmt.keyvault.models.KeyRotationPolicyAttributes": null, - "azure.mgmt.keyvault.models.LifetimeAction": null, - "azure.mgmt.keyvault.models.LogSpecification": null, - "azure.mgmt.keyvault.models.ManagedHsmResource": null, - "azure.mgmt.keyvault.models.ManagedHsm": null, - "azure.mgmt.keyvault.models.ManagedHsmAction": null, - "azure.mgmt.keyvault.models.ManagedHsmError": null, - "azure.mgmt.keyvault.models.ProxyResourceWithoutSystemData": null, - "azure.mgmt.keyvault.models.ManagedHsmKey": null, - "azure.mgmt.keyvault.models.ManagedHsmKeyAttributes": null, - "azure.mgmt.keyvault.models.ManagedHsmKeyCreateParameters": null, - "azure.mgmt.keyvault.models.ManagedHsmKeyListResult": null, - "azure.mgmt.keyvault.models.ManagedHsmKeyProperties": null, - "azure.mgmt.keyvault.models.ManagedHsmKeyReleasePolicy": null, - "azure.mgmt.keyvault.models.ManagedHsmKeyRotationPolicyAttributes": null, - "azure.mgmt.keyvault.models.ManagedHsmLifetimeAction": null, - "azure.mgmt.keyvault.models.ManagedHsmListResult": null, - "azure.mgmt.keyvault.models.ManagedHsmProperties": null, - "azure.mgmt.keyvault.models.ManagedHsmRotationPolicy": null, - "azure.mgmt.keyvault.models.ManagedHSMSecurityDomainProperties": null, - "azure.mgmt.keyvault.models.ManagedHsmSku": null, - "azure.mgmt.keyvault.models.ManagedHsmTrigger": null, - "azure.mgmt.keyvault.models.ManagedServiceIdentity": null, - "azure.mgmt.keyvault.models.MetricSpecification": null, - "azure.mgmt.keyvault.models.MHSMGeoReplicatedRegion": null, - "azure.mgmt.keyvault.models.MHSMIPRule": null, - "azure.mgmt.keyvault.models.MHSMNetworkRuleSet": null, - "azure.mgmt.keyvault.models.MHSMPrivateEndpoint": null, - "azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection": null, - "azure.mgmt.keyvault.models.MHSMPrivateEndpointConnectionItem": null, - "azure.mgmt.keyvault.models.MHSMPrivateEndpointConnectionsListResult": null, - "azure.mgmt.keyvault.models.MHSMPrivateLinkResource": null, - "azure.mgmt.keyvault.models.MHSMPrivateLinkResourceListResult": null, - "azure.mgmt.keyvault.models.MHSMPrivateLinkServiceConnectionState": null, - "azure.mgmt.keyvault.models.MHSMRegionsListResult": null, - "azure.mgmt.keyvault.models.MHSMServiceTagRule": null, - "azure.mgmt.keyvault.models.MHSMVirtualNetworkRule": null, - "azure.mgmt.keyvault.models.NetworkRuleSet": null, - "azure.mgmt.keyvault.models.Operation": null, - "azure.mgmt.keyvault.models.OperationDisplay": null, - "azure.mgmt.keyvault.models.OperationListResult": null, - "azure.mgmt.keyvault.models.Permissions": null, - "azure.mgmt.keyvault.models.PrivateEndpoint": null, - "azure.mgmt.keyvault.models.PrivateEndpointConnection": null, - "azure.mgmt.keyvault.models.PrivateEndpointConnectionItem": null, - "azure.mgmt.keyvault.models.PrivateEndpointConnectionListResult": null, - "azure.mgmt.keyvault.models.PrivateLinkResource": null, - "azure.mgmt.keyvault.models.PrivateLinkResourceListResult": null, - "azure.mgmt.keyvault.models.PrivateLinkServiceConnectionState": null, - "azure.mgmt.keyvault.models.ResourceListResult": null, - "azure.mgmt.keyvault.models.RotationPolicy": null, - "azure.mgmt.keyvault.models.Secret": null, - "azure.mgmt.keyvault.models.SecretAttributes": null, - "azure.mgmt.keyvault.models.SecretCreateOrUpdateParameters": null, - "azure.mgmt.keyvault.models.SecretListResult": null, - "azure.mgmt.keyvault.models.SecretPatchParameters": null, - "azure.mgmt.keyvault.models.SecretPatchProperties": null, - "azure.mgmt.keyvault.models.SecretProperties": null, - "azure.mgmt.keyvault.models.ServiceSpecification": null, - "azure.mgmt.keyvault.models.Sku": null, - "azure.mgmt.keyvault.models.SystemData": null, - "azure.mgmt.keyvault.models.Trigger": null, - "azure.mgmt.keyvault.models.UserAssignedIdentity": null, - "azure.mgmt.keyvault.models.Vault": null, - "azure.mgmt.keyvault.models.VaultAccessPolicyParameters": null, - "azure.mgmt.keyvault.models.VaultAccessPolicyProperties": null, - "azure.mgmt.keyvault.models.VaultCheckNameAvailabilityParameters": null, - "azure.mgmt.keyvault.models.VaultCreateOrUpdateParameters": null, - "azure.mgmt.keyvault.models.VaultListResult": null, - "azure.mgmt.keyvault.models.VaultPatchParameters": null, - "azure.mgmt.keyvault.models.VaultPatchProperties": null, - "azure.mgmt.keyvault.models.VaultProperties": null, - "azure.mgmt.keyvault.models.VirtualNetworkRule": null, - "azure.mgmt.keyvault.models.JsonWebKeyOperation": null, - "azure.mgmt.keyvault.models.KeyRotationPolicyActionType": null, - "azure.mgmt.keyvault.models.DeletionRecoveryLevel": null, - "azure.mgmt.keyvault.models.JsonWebKeyType": null, - "azure.mgmt.keyvault.models.JsonWebKeyCurveName": null, - "azure.mgmt.keyvault.models.KeyPermissions": null, - "azure.mgmt.keyvault.models.SecretPermissions": null, - "azure.mgmt.keyvault.models.CertificatePermissions": null, - "azure.mgmt.keyvault.models.StoragePermissions": null, - "azure.mgmt.keyvault.models.PrivateEndpointServiceConnectionStatus": null, - "azure.mgmt.keyvault.models.ActionsRequired": null, - "azure.mgmt.keyvault.models.PrivateEndpointConnectionProvisioningState": null, - "azure.mgmt.keyvault.models.IdentityType": null, - "azure.mgmt.keyvault.models.SkuFamily": null, - "azure.mgmt.keyvault.models.SkuName": null, - "azure.mgmt.keyvault.models.CreateMode": null, - "azure.mgmt.keyvault.models.NetworkRuleBypassOptions": null, - "azure.mgmt.keyvault.models.NetworkRuleAction": null, - "azure.mgmt.keyvault.models.VaultProvisioningState": null, - "azure.mgmt.keyvault.models.GeoReplicationRegionProvisioningState": null, - "azure.mgmt.keyvault.models.ManagedHsmSkuFamily": null, - "azure.mgmt.keyvault.models.ManagedHsmSkuName": null, - "azure.mgmt.keyvault.models.ManagedServiceIdentityType": null, - "azure.mgmt.keyvault.models.ProvisioningState": null, - "azure.mgmt.keyvault.models.PublicNetworkAccess": null, - "azure.mgmt.keyvault.models.ActivationStatus": null, - "azure.mgmt.keyvault.models.Reason": null, - "azure.mgmt.keyvault.models.AccessPolicyUpdateKind": null, - "azure.mgmt.keyvault.operations.KeysOperations.create_if_not_exist": null, - "azure.mgmt.keyvault.aio.operations.KeysOperations.create_if_not_exist": null, - "azure.mgmt.keyvault.operations.KeysOperations.get": null, - "azure.mgmt.keyvault.aio.operations.KeysOperations.get": null, - "azure.mgmt.keyvault.operations.KeysOperations.list": null, - "azure.mgmt.keyvault.aio.operations.KeysOperations.list": null, - "azure.mgmt.keyvault.operations.KeysOperations.get_version": null, - "azure.mgmt.keyvault.aio.operations.KeysOperations.get_version": null, - "azure.mgmt.keyvault.operations.KeysOperations.list_versions": null, - "azure.mgmt.keyvault.aio.operations.KeysOperations.list_versions": null, - "azure.mgmt.keyvault.operations.ManagedHsmKeysOperations.create_if_not_exist": null, - "azure.mgmt.keyvault.aio.operations.ManagedHsmKeysOperations.create_if_not_exist": null, - "azure.mgmt.keyvault.operations.ManagedHsmKeysOperations.get": null, - "azure.mgmt.keyvault.aio.operations.ManagedHsmKeysOperations.get": null, - "azure.mgmt.keyvault.operations.ManagedHsmKeysOperations.list": null, - "azure.mgmt.keyvault.aio.operations.ManagedHsmKeysOperations.list": null, - "azure.mgmt.keyvault.operations.ManagedHsmKeysOperations.get_version": null, - "azure.mgmt.keyvault.aio.operations.ManagedHsmKeysOperations.get_version": null, - "azure.mgmt.keyvault.operations.ManagedHsmKeysOperations.list_versions": null, - "azure.mgmt.keyvault.aio.operations.ManagedHsmKeysOperations.list_versions": null, - "azure.mgmt.keyvault.operations.VaultsOperations.begin_create_or_update": null, - "azure.mgmt.keyvault.aio.operations.VaultsOperations.begin_create_or_update": null, - "azure.mgmt.keyvault.operations.VaultsOperations.update": null, - "azure.mgmt.keyvault.aio.operations.VaultsOperations.update": null, - "azure.mgmt.keyvault.operations.VaultsOperations.delete": null, - "azure.mgmt.keyvault.aio.operations.VaultsOperations.delete": null, - "azure.mgmt.keyvault.operations.VaultsOperations.get": null, - "azure.mgmt.keyvault.aio.operations.VaultsOperations.get": null, - "azure.mgmt.keyvault.operations.VaultsOperations.update_access_policy": null, - "azure.mgmt.keyvault.aio.operations.VaultsOperations.update_access_policy": null, - "azure.mgmt.keyvault.operations.VaultsOperations.list_by_resource_group": null, - "azure.mgmt.keyvault.aio.operations.VaultsOperations.list_by_resource_group": null, - "azure.mgmt.keyvault.operations.VaultsOperations.list_by_subscription": null, - "azure.mgmt.keyvault.aio.operations.VaultsOperations.list_by_subscription": null, - "azure.mgmt.keyvault.operations.VaultsOperations.list_deleted": null, - "azure.mgmt.keyvault.aio.operations.VaultsOperations.list_deleted": null, - "azure.mgmt.keyvault.operations.VaultsOperations.get_deleted": null, - "azure.mgmt.keyvault.aio.operations.VaultsOperations.get_deleted": null, - "azure.mgmt.keyvault.operations.VaultsOperations.begin_purge_deleted": null, - "azure.mgmt.keyvault.aio.operations.VaultsOperations.begin_purge_deleted": null, - "azure.mgmt.keyvault.operations.VaultsOperations.list": null, - "azure.mgmt.keyvault.aio.operations.VaultsOperations.list": null, - "azure.mgmt.keyvault.operations.VaultsOperations.check_name_availability": null, - "azure.mgmt.keyvault.aio.operations.VaultsOperations.check_name_availability": null, - "azure.mgmt.keyvault.operations.PrivateEndpointConnectionsOperations.get": null, - "azure.mgmt.keyvault.aio.operations.PrivateEndpointConnectionsOperations.get": null, - "azure.mgmt.keyvault.operations.PrivateEndpointConnectionsOperations.put": null, - "azure.mgmt.keyvault.aio.operations.PrivateEndpointConnectionsOperations.put": null, - "azure.mgmt.keyvault.operations.PrivateEndpointConnectionsOperations.begin_delete": null, - "azure.mgmt.keyvault.aio.operations.PrivateEndpointConnectionsOperations.begin_delete": null, - "azure.mgmt.keyvault.operations.PrivateEndpointConnectionsOperations.list_by_resource": null, - "azure.mgmt.keyvault.aio.operations.PrivateEndpointConnectionsOperations.list_by_resource": null, - "azure.mgmt.keyvault.operations.PrivateLinkResourcesOperations.list_by_vault": null, - "azure.mgmt.keyvault.aio.operations.PrivateLinkResourcesOperations.list_by_vault": null, - "azure.mgmt.keyvault.operations.ManagedHsmsOperations.begin_create_or_update": null, - "azure.mgmt.keyvault.aio.operations.ManagedHsmsOperations.begin_create_or_update": null, - "azure.mgmt.keyvault.operations.ManagedHsmsOperations.begin_update": null, - "azure.mgmt.keyvault.aio.operations.ManagedHsmsOperations.begin_update": null, - "azure.mgmt.keyvault.operations.ManagedHsmsOperations.begin_delete": null, - "azure.mgmt.keyvault.aio.operations.ManagedHsmsOperations.begin_delete": null, - "azure.mgmt.keyvault.operations.ManagedHsmsOperations.get": null, - "azure.mgmt.keyvault.aio.operations.ManagedHsmsOperations.get": null, - "azure.mgmt.keyvault.operations.ManagedHsmsOperations.list_by_resource_group": null, - "azure.mgmt.keyvault.aio.operations.ManagedHsmsOperations.list_by_resource_group": null, - "azure.mgmt.keyvault.operations.ManagedHsmsOperations.list_by_subscription": null, - "azure.mgmt.keyvault.aio.operations.ManagedHsmsOperations.list_by_subscription": null, - "azure.mgmt.keyvault.operations.ManagedHsmsOperations.list_deleted": null, - "azure.mgmt.keyvault.aio.operations.ManagedHsmsOperations.list_deleted": null, - "azure.mgmt.keyvault.operations.ManagedHsmsOperations.get_deleted": null, - "azure.mgmt.keyvault.aio.operations.ManagedHsmsOperations.get_deleted": null, - "azure.mgmt.keyvault.operations.ManagedHsmsOperations.begin_purge_deleted": null, - "azure.mgmt.keyvault.aio.operations.ManagedHsmsOperations.begin_purge_deleted": null, - "azure.mgmt.keyvault.operations.ManagedHsmsOperations.check_mhsm_name_availability": null, - "azure.mgmt.keyvault.aio.operations.ManagedHsmsOperations.check_mhsm_name_availability": null, - "azure.mgmt.keyvault.operations.MHSMPrivateEndpointConnectionsOperations.list_by_resource": null, - "azure.mgmt.keyvault.aio.operations.MHSMPrivateEndpointConnectionsOperations.list_by_resource": null, - "azure.mgmt.keyvault.operations.MHSMPrivateEndpointConnectionsOperations.get": null, - "azure.mgmt.keyvault.aio.operations.MHSMPrivateEndpointConnectionsOperations.get": null, - "azure.mgmt.keyvault.operations.MHSMPrivateEndpointConnectionsOperations.put": null, - "azure.mgmt.keyvault.aio.operations.MHSMPrivateEndpointConnectionsOperations.put": null, - "azure.mgmt.keyvault.operations.MHSMPrivateEndpointConnectionsOperations.begin_delete": null, - "azure.mgmt.keyvault.aio.operations.MHSMPrivateEndpointConnectionsOperations.begin_delete": null, - "azure.mgmt.keyvault.operations.MHSMPrivateLinkResourcesOperations.list_by_mhsm_resource": null, - "azure.mgmt.keyvault.aio.operations.MHSMPrivateLinkResourcesOperations.list_by_mhsm_resource": null, - "azure.mgmt.keyvault.operations.MHSMRegionsOperations.list_by_resource": null, - "azure.mgmt.keyvault.aio.operations.MHSMRegionsOperations.list_by_resource": null, - "azure.mgmt.keyvault.operations.Operations.list": null, - "azure.mgmt.keyvault.aio.operations.Operations.list": null, - "azure.mgmt.keyvault.operations.SecretsOperations.create_or_update": null, - "azure.mgmt.keyvault.aio.operations.SecretsOperations.create_or_update": null, - "azure.mgmt.keyvault.operations.SecretsOperations.update": null, - "azure.mgmt.keyvault.aio.operations.SecretsOperations.update": null, - "azure.mgmt.keyvault.operations.SecretsOperations.get": null, - "azure.mgmt.keyvault.aio.operations.SecretsOperations.get": null, - "azure.mgmt.keyvault.operations.SecretsOperations.list": null, - "azure.mgmt.keyvault.aio.operations.SecretsOperations.list": null + "azure.mgmt.keyvault.models.AccessPolicyEntry": "Microsoft.KeyVault.AccessPolicyEntry", + "azure.mgmt.keyvault.models.Action": "Microsoft.KeyVault.Action", + "azure.mgmt.keyvault.models.ArmResource": "Azure.ResourceManager.CommonTypes.Resource", + "azure.mgmt.keyvault.models.Attributes": "Microsoft.KeyVault.Attributes", + "azure.mgmt.keyvault.models.CheckMhsmNameAvailabilityParameters": "Microsoft.KeyVault.CheckMhsmNameAvailabilityParameters", + "azure.mgmt.keyvault.models.CheckMhsmNameAvailabilityResult": "Microsoft.KeyVault.CheckMhsmNameAvailabilityResult", + "azure.mgmt.keyvault.models.CheckNameAvailabilityResult": "Microsoft.KeyVault.CheckNameAvailabilityResult", + "azure.mgmt.keyvault.models.CloudError": "Microsoft.KeyVault.CloudError", + "azure.mgmt.keyvault.models.CloudErrorBody": "Microsoft.KeyVault.CloudErrorBody", + "azure.mgmt.keyvault.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource", + "azure.mgmt.keyvault.models.DeletedManagedHsm": "Microsoft.KeyVault.DeletedManagedHsm", + "azure.mgmt.keyvault.models.DeletedManagedHsmProperties": "Microsoft.KeyVault.DeletedManagedHsmProperties", + "azure.mgmt.keyvault.models.DeletedVault": "Microsoft.KeyVault.DeletedVault", + "azure.mgmt.keyvault.models.DeletedVaultProperties": "Microsoft.KeyVault.DeletedVaultProperties", + "azure.mgmt.keyvault.models.DimensionProperties": "Microsoft.KeyVault.DimensionProperties", + "azure.mgmt.keyvault.models.Error": "Microsoft.KeyVault.Error", + "azure.mgmt.keyvault.models.IPRule": "Microsoft.KeyVault.IPRule", + "azure.mgmt.keyvault.models.Key": "Microsoft.KeyVault.Key", + "azure.mgmt.keyvault.models.KeyAttributes": "Microsoft.KeyVault.KeyAttributes", + "azure.mgmt.keyvault.models.KeyCreateParameters": "Microsoft.KeyVault.KeyCreateParameters", + "azure.mgmt.keyvault.models.KeyProperties": "Microsoft.KeyVault.KeyProperties", + "azure.mgmt.keyvault.models.KeyReleasePolicy": "Microsoft.KeyVault.KeyReleasePolicy", + "azure.mgmt.keyvault.models.KeyRotationPolicyAttributes": "Microsoft.KeyVault.KeyRotationPolicyAttributes", + "azure.mgmt.keyvault.models.LifetimeAction": "Microsoft.KeyVault.LifetimeAction", + "azure.mgmt.keyvault.models.LogSpecification": "Microsoft.KeyVault.LogSpecification", + "azure.mgmt.keyvault.models.ManagedHsm": "Microsoft.KeyVault.ManagedHsm", + "azure.mgmt.keyvault.models.ManagedHsmAction": "Microsoft.KeyVault.ManagedHsmAction", + "azure.mgmt.keyvault.models.ManagedHsmError": "Microsoft.KeyVault.ManagedHsmError", + "azure.mgmt.keyvault.models.ManagedHsmKey": "Microsoft.KeyVault.ManagedHsmKey", + "azure.mgmt.keyvault.models.ManagedHsmKeyAttributes": "Microsoft.KeyVault.ManagedHsmKeyAttributes", + "azure.mgmt.keyvault.models.ManagedHsmKeyCreateParameters": "Microsoft.KeyVault.ManagedHsmKeyCreateParameters", + "azure.mgmt.keyvault.models.ManagedHsmKeyProperties": "Microsoft.KeyVault.ManagedHsmKeyProperties", + "azure.mgmt.keyvault.models.ManagedHsmKeyReleasePolicy": "Microsoft.KeyVault.ManagedHsmKeyReleasePolicy", + "azure.mgmt.keyvault.models.ManagedHsmKeyRotationPolicyAttributes": "Microsoft.KeyVault.ManagedHsmKeyRotationPolicyAttributes", + "azure.mgmt.keyvault.models.ManagedHsmLifetimeAction": "Microsoft.KeyVault.ManagedHsmLifetimeAction", + "azure.mgmt.keyvault.models.ManagedHsmProperties": "Microsoft.KeyVault.ManagedHsmProperties", + "azure.mgmt.keyvault.models.ManagedHsmResource": "Microsoft.KeyVault.ManagedHsmResource", + "azure.mgmt.keyvault.models.ManagedHsmRotationPolicy": "Microsoft.KeyVault.ManagedHsmRotationPolicy", + "azure.mgmt.keyvault.models.ManagedHSMSecurityDomainProperties": "Microsoft.KeyVault.ManagedHSMSecurityDomainProperties", + "azure.mgmt.keyvault.models.ManagedHsmSku": "Microsoft.KeyVault.ManagedHsmSku", + "azure.mgmt.keyvault.models.ManagedHsmTrigger": "Microsoft.KeyVault.ManagedHsmTrigger", + "azure.mgmt.keyvault.models.ManagedServiceIdentity": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentity", + "azure.mgmt.keyvault.models.MetricSpecification": "Microsoft.KeyVault.MetricSpecification", + "azure.mgmt.keyvault.models.MHSMGeoReplicatedRegion": "Microsoft.KeyVault.MhsmGeoReplicatedRegion", + "azure.mgmt.keyvault.models.MHSMIPRule": "Microsoft.KeyVault.MhsmipRule", + "azure.mgmt.keyvault.models.MHSMNetworkRuleSet": "Microsoft.KeyVault.MhsmNetworkRuleSet", + "azure.mgmt.keyvault.models.MHSMPrivateEndpoint": "Microsoft.KeyVault.MhsmPrivateEndpoint", + "azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection": "Microsoft.KeyVault.MhsmPrivateEndpointConnection", + "azure.mgmt.keyvault.models.MHSMPrivateEndpointConnectionItem": "Microsoft.KeyVault.MhsmPrivateEndpointConnectionItem", + "azure.mgmt.keyvault.models.MHSMPrivateEndpointConnectionProperties": "Microsoft.KeyVault.MhsmPrivateEndpointConnectionProperties", + "azure.mgmt.keyvault.models.MHSMPrivateLinkResource": "Microsoft.KeyVault.MhsmPrivateLinkResource", + "azure.mgmt.keyvault.models.MHSMPrivateLinkResourceListResult": "Microsoft.KeyVault.MhsmPrivateLinkResourceListResult", + "azure.mgmt.keyvault.models.MHSMPrivateLinkResourceProperties": "Microsoft.KeyVault.MhsmPrivateLinkResourceProperties", + "azure.mgmt.keyvault.models.MHSMPrivateLinkServiceConnectionState": "Microsoft.KeyVault.MhsmPrivateLinkServiceConnectionState", + "azure.mgmt.keyvault.models.MHSMServiceTagRule": "Microsoft.KeyVault.MhsmServiceTagRule", + "azure.mgmt.keyvault.models.MHSMVirtualNetworkRule": "Microsoft.KeyVault.MhsmVirtualNetworkRule", + "azure.mgmt.keyvault.models.NetworkRuleSet": "Microsoft.KeyVault.NetworkRuleSet", + "azure.mgmt.keyvault.models.Operation": "Microsoft.KeyVault.Operation", + "azure.mgmt.keyvault.models.OperationDisplay": "Microsoft.KeyVault.OperationDisplay", + "azure.mgmt.keyvault.models.OperationProperties": "Microsoft.KeyVault.OperationProperties", + "azure.mgmt.keyvault.models.Permissions": "Microsoft.KeyVault.Permissions", + "azure.mgmt.keyvault.models.PrivateEndpoint": "Microsoft.KeyVault.PrivateEndpoint", + "azure.mgmt.keyvault.models.PrivateEndpointConnection": "Microsoft.KeyVault.PrivateEndpointConnection", + "azure.mgmt.keyvault.models.PrivateEndpointConnectionItem": "Microsoft.KeyVault.PrivateEndpointConnectionItem", + "azure.mgmt.keyvault.models.PrivateEndpointConnectionProperties": "Microsoft.KeyVault.PrivateEndpointConnectionProperties", + "azure.mgmt.keyvault.models.PrivateLinkResource": "Microsoft.KeyVault.PrivateLinkResource", + "azure.mgmt.keyvault.models.PrivateLinkResourceListResult": "Microsoft.KeyVault.PrivateLinkResourceListResult", + "azure.mgmt.keyvault.models.PrivateLinkResourceProperties": "Microsoft.KeyVault.PrivateLinkResourceProperties", + "azure.mgmt.keyvault.models.PrivateLinkServiceConnectionState": "Microsoft.KeyVault.PrivateLinkServiceConnectionState", + "azure.mgmt.keyvault.models.RotationPolicy": "Microsoft.KeyVault.RotationPolicy", + "azure.mgmt.keyvault.models.Secret": "Microsoft.KeyVault.Secret", + "azure.mgmt.keyvault.models.SecretAttributes": "Microsoft.KeyVault.SecretAttributes", + "azure.mgmt.keyvault.models.SecretCreateOrUpdateParameters": "Microsoft.KeyVault.SecretCreateOrUpdateParameters", + "azure.mgmt.keyvault.models.SecretPatchParameters": "Microsoft.KeyVault.SecretPatchParameters", + "azure.mgmt.keyvault.models.SecretPatchProperties": "Microsoft.KeyVault.SecretPatchProperties", + "azure.mgmt.keyvault.models.SecretProperties": "Microsoft.KeyVault.SecretProperties", + "azure.mgmt.keyvault.models.ServiceSpecification": "Microsoft.KeyVault.ServiceSpecification", + "azure.mgmt.keyvault.models.Sku": "Microsoft.KeyVault.Sku", + "azure.mgmt.keyvault.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData", + "azure.mgmt.keyvault.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource", + "azure.mgmt.keyvault.models.Trigger": "Microsoft.KeyVault.Trigger", + "azure.mgmt.keyvault.models.UserAssignedIdentity": "Azure.ResourceManager.CommonTypes.UserAssignedIdentity", + "azure.mgmt.keyvault.models.Vault": "Microsoft.KeyVault.Vault", + "azure.mgmt.keyvault.models.VaultAccessPolicyParameters": "Microsoft.KeyVault.VaultAccessPolicyParameters", + "azure.mgmt.keyvault.models.VaultAccessPolicyProperties": "Microsoft.KeyVault.VaultAccessPolicyProperties", + "azure.mgmt.keyvault.models.VaultCheckNameAvailabilityParameters": "Microsoft.KeyVault.VaultCheckNameAvailabilityParameters", + "azure.mgmt.keyvault.models.VaultCreateOrUpdateParameters": "Microsoft.KeyVault.VaultCreateOrUpdateParameters", + "azure.mgmt.keyvault.models.VaultPatchParameters": "Microsoft.KeyVault.VaultPatchParameters", + "azure.mgmt.keyvault.models.VaultPatchProperties": "Microsoft.KeyVault.VaultPatchProperties", + "azure.mgmt.keyvault.models.VaultProperties": "Microsoft.KeyVault.VaultProperties", + "azure.mgmt.keyvault.models.VirtualNetworkRule": "Microsoft.KeyVault.VirtualNetworkRule", + "azure.mgmt.keyvault.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", + "azure.mgmt.keyvault.models.SkuFamily": "Microsoft.KeyVault.SkuFamily", + "azure.mgmt.keyvault.models.SkuName": "Microsoft.KeyVault.SkuName", + "azure.mgmt.keyvault.models.KeyPermissions": "Microsoft.KeyVault.KeyPermissions", + "azure.mgmt.keyvault.models.SecretPermissions": "Microsoft.KeyVault.SecretPermissions", + "azure.mgmt.keyvault.models.CertificatePermissions": "Microsoft.KeyVault.CertificatePermissions", + "azure.mgmt.keyvault.models.StoragePermissions": "Microsoft.KeyVault.StoragePermissions", + "azure.mgmt.keyvault.models.CreateMode": "Microsoft.KeyVault.CreateMode", + "azure.mgmt.keyvault.models.NetworkRuleBypassOptions": "Microsoft.KeyVault.NetworkRuleBypassOptions", + "azure.mgmt.keyvault.models.NetworkRuleAction": "Microsoft.KeyVault.NetworkRuleAction", + "azure.mgmt.keyvault.models.VaultProvisioningState": "Microsoft.KeyVault.VaultProvisioningState", + "azure.mgmt.keyvault.models.PrivateEndpointServiceConnectionStatus": "Microsoft.KeyVault.PrivateEndpointServiceConnectionStatus", + "azure.mgmt.keyvault.models.ActionsRequired": "Microsoft.KeyVault.ActionsRequired", + "azure.mgmt.keyvault.models.PrivateEndpointConnectionProvisioningState": "Microsoft.KeyVault.PrivateEndpointConnectionProvisioningState", + "azure.mgmt.keyvault.models.AccessPolicyUpdateKind": "Microsoft.KeyVault.AccessPolicyUpdateKind", + "azure.mgmt.keyvault.models.Reason": "Microsoft.KeyVault.Reason", + "azure.mgmt.keyvault.models.ProvisioningState": "Microsoft.KeyVault.ProvisioningState", + "azure.mgmt.keyvault.models.GeoReplicationRegionProvisioningState": "Microsoft.KeyVault.GeoReplicationRegionProvisioningState", + "azure.mgmt.keyvault.models.PublicNetworkAccess": "Microsoft.KeyVault.PublicNetworkAccess", + "azure.mgmt.keyvault.models.ActivationStatus": "Microsoft.KeyVault.ActivationStatus", + "azure.mgmt.keyvault.models.ManagedHsmSkuFamily": "Microsoft.KeyVault.ManagedHsmSkuFamily", + "azure.mgmt.keyvault.models.ManagedHsmSkuName": "Microsoft.KeyVault.ManagedHsmSkuName", + "azure.mgmt.keyvault.models.ManagedServiceIdentityType": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType", + "azure.mgmt.keyvault.models.DeletionRecoveryLevel": "Microsoft.KeyVault.DeletionRecoveryLevel", + "azure.mgmt.keyvault.models.JsonWebKeyType": "Microsoft.KeyVault.JsonWebKeyType", + "azure.mgmt.keyvault.models.JsonWebKeyOperation": "Microsoft.KeyVault.JsonWebKeyOperation", + "azure.mgmt.keyvault.models.JsonWebKeyCurveName": "Microsoft.KeyVault.JsonWebKeyCurveName", + "azure.mgmt.keyvault.models.KeyRotationPolicyActionType": "Microsoft.KeyVault.KeyRotationPolicyActionType", + "azure.mgmt.keyvault.operations.Operations.list": "Azure.ResourceManager.Legacy.Operations.list", + "azure.mgmt.keyvault.aio.operations.Operations.list": "Azure.ResourceManager.Legacy.Operations.list", + "azure.mgmt.keyvault.operations.VaultsOperations.get": "Microsoft.KeyVault.Vaults.get", + "azure.mgmt.keyvault.aio.operations.VaultsOperations.get": "Microsoft.KeyVault.Vaults.get", + "azure.mgmt.keyvault.operations.VaultsOperations.begin_create_or_update": "Microsoft.KeyVault.Vaults.createOrUpdate", + "azure.mgmt.keyvault.aio.operations.VaultsOperations.begin_create_or_update": "Microsoft.KeyVault.Vaults.createOrUpdate", + "azure.mgmt.keyvault.operations.VaultsOperations.update": "Microsoft.KeyVault.Vaults.update", + "azure.mgmt.keyvault.aio.operations.VaultsOperations.update": "Microsoft.KeyVault.Vaults.update", + "azure.mgmt.keyvault.operations.VaultsOperations.delete": "Microsoft.KeyVault.Vaults.delete", + "azure.mgmt.keyvault.aio.operations.VaultsOperations.delete": "Microsoft.KeyVault.Vaults.delete", + "azure.mgmt.keyvault.operations.VaultsOperations.list_by_resource_group": "Microsoft.KeyVault.Vaults.listByResourceGroup", + "azure.mgmt.keyvault.aio.operations.VaultsOperations.list_by_resource_group": "Microsoft.KeyVault.Vaults.listByResourceGroup", + "azure.mgmt.keyvault.operations.VaultsOperations.list_by_subscription": "Microsoft.KeyVault.Vaults.listBySubscription", + "azure.mgmt.keyvault.aio.operations.VaultsOperations.list_by_subscription": "Microsoft.KeyVault.Vaults.listBySubscription", + "azure.mgmt.keyvault.operations.VaultsOperations.update_access_policy": "Microsoft.KeyVault.Vaults.updateAccessPolicy", + "azure.mgmt.keyvault.aio.operations.VaultsOperations.update_access_policy": "Microsoft.KeyVault.Vaults.updateAccessPolicy", + "azure.mgmt.keyvault.operations.VaultsOperations.get_deleted": "Microsoft.KeyVault.DeletedVaults.getDeleted", + "azure.mgmt.keyvault.aio.operations.VaultsOperations.get_deleted": "Microsoft.KeyVault.DeletedVaults.getDeleted", + "azure.mgmt.keyvault.operations.VaultsOperations.begin_purge_deleted": "Microsoft.KeyVault.DeletedVaults.purgeDeleted", + "azure.mgmt.keyvault.aio.operations.VaultsOperations.begin_purge_deleted": "Microsoft.KeyVault.DeletedVaults.purgeDeleted", + "azure.mgmt.keyvault.operations.VaultsOperations.list_deleted": "Microsoft.KeyVault.VaultsOperationGroup.listDeleted", + "azure.mgmt.keyvault.aio.operations.VaultsOperations.list_deleted": "Microsoft.KeyVault.VaultsOperationGroup.listDeleted", + "azure.mgmt.keyvault.operations.VaultsOperations.list": "Microsoft.KeyVault.VaultsOperationGroup.list", + "azure.mgmt.keyvault.aio.operations.VaultsOperations.list": "Microsoft.KeyVault.VaultsOperationGroup.list", + "azure.mgmt.keyvault.operations.VaultsOperations.check_name_availability": "Microsoft.KeyVault.VaultsOperationGroup.checkNameAvailability", + "azure.mgmt.keyvault.aio.operations.VaultsOperations.check_name_availability": "Microsoft.KeyVault.VaultsOperationGroup.checkNameAvailability", + "azure.mgmt.keyvault.operations.PrivateEndpointConnectionsOperations.get": "Microsoft.KeyVault.PrivateEndpointConnections.get", + "azure.mgmt.keyvault.aio.operations.PrivateEndpointConnectionsOperations.get": "Microsoft.KeyVault.PrivateEndpointConnections.get", + "azure.mgmt.keyvault.operations.PrivateEndpointConnectionsOperations.put": "Microsoft.KeyVault.PrivateEndpointConnections.put", + "azure.mgmt.keyvault.aio.operations.PrivateEndpointConnectionsOperations.put": "Microsoft.KeyVault.PrivateEndpointConnections.put", + "azure.mgmt.keyvault.operations.PrivateEndpointConnectionsOperations.begin_delete": "Microsoft.KeyVault.PrivateEndpointConnections.delete", + "azure.mgmt.keyvault.aio.operations.PrivateEndpointConnectionsOperations.begin_delete": "Microsoft.KeyVault.PrivateEndpointConnections.delete", + "azure.mgmt.keyvault.operations.PrivateEndpointConnectionsOperations.list_by_resource": "Microsoft.KeyVault.PrivateEndpointConnections.listByResource", + "azure.mgmt.keyvault.aio.operations.PrivateEndpointConnectionsOperations.list_by_resource": "Microsoft.KeyVault.PrivateEndpointConnections.listByResource", + "azure.mgmt.keyvault.operations.ManagedHsmsOperations.get": "Microsoft.KeyVault.ManagedHsms.get", + "azure.mgmt.keyvault.aio.operations.ManagedHsmsOperations.get": "Microsoft.KeyVault.ManagedHsms.get", + "azure.mgmt.keyvault.operations.ManagedHsmsOperations.begin_create_or_update": "Microsoft.KeyVault.ManagedHsms.createOrUpdate", + "azure.mgmt.keyvault.aio.operations.ManagedHsmsOperations.begin_create_or_update": "Microsoft.KeyVault.ManagedHsms.createOrUpdate", + "azure.mgmt.keyvault.operations.ManagedHsmsOperations.begin_update": "Microsoft.KeyVault.ManagedHsms.update", + "azure.mgmt.keyvault.aio.operations.ManagedHsmsOperations.begin_update": "Microsoft.KeyVault.ManagedHsms.update", + "azure.mgmt.keyvault.operations.ManagedHsmsOperations.begin_delete": "Microsoft.KeyVault.ManagedHsms.delete", + "azure.mgmt.keyvault.aio.operations.ManagedHsmsOperations.begin_delete": "Microsoft.KeyVault.ManagedHsms.delete", + "azure.mgmt.keyvault.operations.ManagedHsmsOperations.list_by_resource_group": "Microsoft.KeyVault.ManagedHsms.listByResourceGroup", + "azure.mgmt.keyvault.aio.operations.ManagedHsmsOperations.list_by_resource_group": "Microsoft.KeyVault.ManagedHsms.listByResourceGroup", + "azure.mgmt.keyvault.operations.ManagedHsmsOperations.list_by_subscription": "Microsoft.KeyVault.ManagedHsms.listBySubscription", + "azure.mgmt.keyvault.aio.operations.ManagedHsmsOperations.list_by_subscription": "Microsoft.KeyVault.ManagedHsms.listBySubscription", + "azure.mgmt.keyvault.operations.ManagedHsmsOperations.get_deleted": "Microsoft.KeyVault.DeletedManagedHsms.getDeleted", + "azure.mgmt.keyvault.aio.operations.ManagedHsmsOperations.get_deleted": "Microsoft.KeyVault.DeletedManagedHsms.getDeleted", + "azure.mgmt.keyvault.operations.ManagedHsmsOperations.begin_purge_deleted": "Microsoft.KeyVault.DeletedManagedHsms.purgeDeleted", + "azure.mgmt.keyvault.aio.operations.ManagedHsmsOperations.begin_purge_deleted": "Microsoft.KeyVault.DeletedManagedHsms.purgeDeleted", + "azure.mgmt.keyvault.operations.ManagedHsmsOperations.list_deleted": "Microsoft.KeyVault.ManagedHsmsOperationGroup.listDeleted", + "azure.mgmt.keyvault.aio.operations.ManagedHsmsOperations.list_deleted": "Microsoft.KeyVault.ManagedHsmsOperationGroup.listDeleted", + "azure.mgmt.keyvault.operations.ManagedHsmsOperations.check_mhsm_name_availability": "Microsoft.KeyVault.ManagedHsmsOperationGroup.checkMhsmNameAvailability", + "azure.mgmt.keyvault.aio.operations.ManagedHsmsOperations.check_mhsm_name_availability": "Microsoft.KeyVault.ManagedHsmsOperationGroup.checkMhsmNameAvailability", + "azure.mgmt.keyvault.operations.SecretsOperations.get": "Microsoft.KeyVault.Secrets.get", + "azure.mgmt.keyvault.aio.operations.SecretsOperations.get": "Microsoft.KeyVault.Secrets.get", + "azure.mgmt.keyvault.operations.SecretsOperations.create_or_update": "Microsoft.KeyVault.Secrets.createOrUpdate", + "azure.mgmt.keyvault.aio.operations.SecretsOperations.create_or_update": "Microsoft.KeyVault.Secrets.createOrUpdate", + "azure.mgmt.keyvault.operations.SecretsOperations.update": "Microsoft.KeyVault.Secrets.update", + "azure.mgmt.keyvault.aio.operations.SecretsOperations.update": "Microsoft.KeyVault.Secrets.update", + "azure.mgmt.keyvault.operations.SecretsOperations.list": "Microsoft.KeyVault.Secrets.list", + "azure.mgmt.keyvault.aio.operations.SecretsOperations.list": "Microsoft.KeyVault.Secrets.list", + "azure.mgmt.keyvault.operations.KeysOperations.get": "Microsoft.KeyVault.Keys.get", + "azure.mgmt.keyvault.aio.operations.KeysOperations.get": "Microsoft.KeyVault.Keys.get", + "azure.mgmt.keyvault.operations.KeysOperations.create_if_not_exist": "Microsoft.KeyVault.Keys.createIfNotExist", + "azure.mgmt.keyvault.aio.operations.KeysOperations.create_if_not_exist": "Microsoft.KeyVault.Keys.createIfNotExist", + "azure.mgmt.keyvault.operations.KeysOperations.list": "Microsoft.KeyVault.Keys.list", + "azure.mgmt.keyvault.aio.operations.KeysOperations.list": "Microsoft.KeyVault.Keys.list", + "azure.mgmt.keyvault.operations.KeysOperations.get_version": "Microsoft.KeyVault.KeyOperationGroup.getVersion", + "azure.mgmt.keyvault.aio.operations.KeysOperations.get_version": "Microsoft.KeyVault.KeyOperationGroup.getVersion", + "azure.mgmt.keyvault.operations.KeysOperations.list_versions": "Microsoft.KeyVault.KeyOperationGroup.listVersions", + "azure.mgmt.keyvault.aio.operations.KeysOperations.list_versions": "Microsoft.KeyVault.KeyOperationGroup.listVersions", + "azure.mgmt.keyvault.operations.ManagedHsmKeysOperations.get": "Microsoft.KeyVault.ManagedHsmKeys.get", + "azure.mgmt.keyvault.aio.operations.ManagedHsmKeysOperations.get": "Microsoft.KeyVault.ManagedHsmKeys.get", + "azure.mgmt.keyvault.operations.ManagedHsmKeysOperations.create_if_not_exist": "Microsoft.KeyVault.ManagedHsmKeys.createIfNotExist", + "azure.mgmt.keyvault.aio.operations.ManagedHsmKeysOperations.create_if_not_exist": "Microsoft.KeyVault.ManagedHsmKeys.createIfNotExist", + "azure.mgmt.keyvault.operations.ManagedHsmKeysOperations.list": "Microsoft.KeyVault.ManagedHsmKeys.list", + "azure.mgmt.keyvault.aio.operations.ManagedHsmKeysOperations.list": "Microsoft.KeyVault.ManagedHsmKeys.list", + "azure.mgmt.keyvault.operations.ManagedHsmKeysOperations.get_version": "Microsoft.KeyVault.ManagedHsmKeyOperationGroup.getVersion", + "azure.mgmt.keyvault.aio.operations.ManagedHsmKeysOperations.get_version": "Microsoft.KeyVault.ManagedHsmKeyOperationGroup.getVersion", + "azure.mgmt.keyvault.operations.ManagedHsmKeysOperations.list_versions": "Microsoft.KeyVault.ManagedHsmKeyOperationGroup.listVersions", + "azure.mgmt.keyvault.aio.operations.ManagedHsmKeysOperations.list_versions": "Microsoft.KeyVault.ManagedHsmKeyOperationGroup.listVersions", + "azure.mgmt.keyvault.operations.PrivateLinkResourcesOperations.list_by_vault": "Microsoft.KeyVault.Vaults.listByVault", + "azure.mgmt.keyvault.aio.operations.PrivateLinkResourcesOperations.list_by_vault": "Microsoft.KeyVault.Vaults.listByVault", + "azure.mgmt.keyvault.operations.MHSMPrivateLinkResourcesOperations.list_by_mhsm_resource": "Microsoft.KeyVault.ManagedHsms.listByMHSMResource", + "azure.mgmt.keyvault.aio.operations.MHSMPrivateLinkResourcesOperations.list_by_mhsm_resource": "Microsoft.KeyVault.ManagedHsms.listByMHSMResource", + "azure.mgmt.keyvault.operations.MHSMRegionsOperations.list_by_resource": "Microsoft.KeyVault.ManagedHsms.listByResource", + "azure.mgmt.keyvault.aio.operations.MHSMRegionsOperations.list_by_resource": "Microsoft.KeyVault.ManagedHsms.listByResource", + "azure.mgmt.keyvault.operations.MHSMPrivateEndpointConnectionsOperations.get": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.get", + "azure.mgmt.keyvault.aio.operations.MHSMPrivateEndpointConnectionsOperations.get": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.get", + "azure.mgmt.keyvault.operations.MHSMPrivateEndpointConnectionsOperations.put": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.put", + "azure.mgmt.keyvault.aio.operations.MHSMPrivateEndpointConnectionsOperations.put": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.put", + "azure.mgmt.keyvault.operations.MHSMPrivateEndpointConnectionsOperations.begin_delete": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.delete", + "azure.mgmt.keyvault.aio.operations.MHSMPrivateEndpointConnectionsOperations.begin_delete": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.delete", + "azure.mgmt.keyvault.operations.MHSMPrivateEndpointConnectionsOperations.list_by_resource": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.listByResource", + "azure.mgmt.keyvault.aio.operations.MHSMPrivateEndpointConnectionsOperations.list_by_resource": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.listByResource" } } \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/__init__.py index a60631755701..3d8686069838 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -12,7 +12,7 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._key_vault_management_client import KeyVaultManagementClient # type: ignore +from ._client import KeyVaultManagementClient # type: ignore from ._version import VERSION __version__ = VERSION 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/_client.py similarity index 88% rename from sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_key_vault_management_client.py rename to sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_client.py index c6376e0ab687..19af2be1d118 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_client.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -17,7 +17,6 @@ from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy from azure.mgmt.core.tools import get_arm_endpoints -from . import models as _models from ._configuration import KeyVaultManagementClientConfiguration from ._utils.serialization import Deserializer, Serializer from .operations import ( @@ -43,43 +42,42 @@ 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.operations.KeysOperations - :ivar managed_hsm_keys: ManagedHsmKeysOperations operations - :vartype managed_hsm_keys: azure.mgmt.keyvault.operations.ManagedHsmKeysOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.keyvault.operations.Operations :ivar vaults: VaultsOperations operations :vartype vaults: azure.mgmt.keyvault.operations.VaultsOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.keyvault.operations.PrivateEndpointConnectionsOperations - :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.keyvault.operations.PrivateLinkResourcesOperations :ivar managed_hsms: ManagedHsmsOperations operations :vartype managed_hsms: azure.mgmt.keyvault.operations.ManagedHsmsOperations - :ivar mhsm_private_endpoint_connections: MHSMPrivateEndpointConnectionsOperations operations - :vartype mhsm_private_endpoint_connections: - azure.mgmt.keyvault.operations.MHSMPrivateEndpointConnectionsOperations + :ivar secrets: SecretsOperations operations + :vartype secrets: azure.mgmt.keyvault.operations.SecretsOperations + :ivar keys: KeysOperations operations + :vartype keys: azure.mgmt.keyvault.operations.KeysOperations + :ivar managed_hsm_keys: ManagedHsmKeysOperations operations + :vartype managed_hsm_keys: azure.mgmt.keyvault.operations.ManagedHsmKeysOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: azure.mgmt.keyvault.operations.PrivateLinkResourcesOperations :ivar mhsm_private_link_resources: MHSMPrivateLinkResourcesOperations operations :vartype mhsm_private_link_resources: azure.mgmt.keyvault.operations.MHSMPrivateLinkResourcesOperations :ivar mhsm_regions: MHSMRegionsOperations operations :vartype mhsm_regions: azure.mgmt.keyvault.operations.MHSMRegionsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.keyvault.operations.Operations - :ivar secrets: SecretsOperations operations - :vartype secrets: azure.mgmt.keyvault.operations.SecretsOperations - :param credential: Credential needed for the client to connect to Azure. Required. + :ivar mhsm_private_endpoint_connections: MHSMPrivateEndpointConnectionsOperations operations + :vartype mhsm_private_endpoint_connections: + azure.mgmt.keyvault.operations.MHSMPrivateEndpointConnectionsOperations + :param credential: Credential used to authenticate requests to the service. Required. :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. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is None. + :param base_url: Service host. Default value is None. :type base_url: str :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2025-05-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Default value is "2025-05-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. @@ -94,6 +92,7 @@ def __init__( cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: + _endpoint = "{endpoint}" _cloud = cloud_setting or settings.current.azure_cloud # type: ignore _endpoints = get_arm_endpoints(_cloud) if not base_url: @@ -102,6 +101,7 @@ def __init__( self._config = KeyVaultManagementClientConfiguration( credential=credential, subscription_id=subscription_id, + base_url=cast(str, base_url), cloud_setting=cloud_setting, credential_scopes=credential_scopes, **kwargs @@ -125,39 +125,38 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, _endpoint), policies=_policies, **kwargs) - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) + self._serialize = Serializer() + self._deserialize = Deserializer() self._serialize.client_side_validation = False - self.keys = KeysOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_hsm_keys = ManagedHsmKeysOperations(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.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize) + self.keys = KeysOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_hsm_keys = ManagedHsmKeysOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) self.mhsm_private_link_resources = MHSMPrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) self.mhsm_regions = MHSMRegionsOperations(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.mhsm_private_endpoint_connections = MHSMPrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest >>> request = HttpRequest("GET", "https://www.example.org/") - >>> response = client._send_request(request) + >>> response = client.send_request(request) For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request @@ -170,7 +169,11 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: """ request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_configuration.py index bb00ffc118ec..535b5aea1471 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_configuration.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_configuration.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -24,16 +24,17 @@ class KeyVaultManagementClientConfiguration: # pylint: disable=too-many-instanc Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :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. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2025-05-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Default value is "2025-05-01". + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -41,6 +42,7 @@ def __init__( self, credential: "TokenCredential", subscription_id: str, + base_url: str = "https://management.azure.com", cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: @@ -53,6 +55,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url self.cloud_setting = cloud_setting self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_patch.py index 8bcb627aa475..87676c65a8f0 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_patch.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_patch.py @@ -7,9 +7,9 @@ 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 + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_utils/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_utils/__init__.py index 0af9b28f6607..8026245c2abc 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_utils/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_utils/__init__.py @@ -1,6 +1,6 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_utils/model_base.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_utils/model_base.py new file mode 100644 index 000000000000..12926fa98dcf --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_utils/model_base.py @@ -0,0 +1,1237 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access, broad-except + +import copy +import calendar +import decimal +import functools +import sys +import logging +import base64 +import re +import typing +import enum +import email.utils +from datetime import datetime, date, time, timedelta, timezone +from json import JSONEncoder +import xml.etree.ElementTree as ET +from collections.abc import MutableMapping +from typing_extensions import Self +import isodate +from azure.core.exceptions import DeserializationError +from azure.core import CaseInsensitiveEnumMeta +from azure.core.pipeline import PipelineResponse +from azure.core.serialization import _Null +from azure.core.rest import HttpResponse + +_LOGGER = logging.getLogger(__name__) + +__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] + +TZ_UTC = timezone.utc +_T = typing.TypeVar("_T") + + +def _timedelta_as_isostr(td: timedelta) -> str: + """Converts a datetime.timedelta object into an ISO 8601 formatted string, e.g. 'P4DT12H30M05S' + + Function adapted from the Tin Can Python project: https://github.com/RusticiSoftware/TinCanPython + + :param timedelta td: The timedelta to convert + :rtype: str + :return: ISO8601 version of this timedelta + """ + + # Split seconds to larger units + seconds = td.total_seconds() + minutes, seconds = divmod(seconds, 60) + hours, minutes = divmod(minutes, 60) + days, hours = divmod(hours, 24) + + days, hours, minutes = list(map(int, (days, hours, minutes))) + seconds = round(seconds, 6) + + # Build date + date_str = "" + if days: + date_str = "%sD" % days + + if hours or minutes or seconds: + # Build time + time_str = "T" + + # Hours + bigger_exists = date_str or hours + if bigger_exists: + time_str += "{:02}H".format(hours) + + # Minutes + bigger_exists = bigger_exists or minutes + if bigger_exists: + time_str += "{:02}M".format(minutes) + + # Seconds + try: + if seconds.is_integer(): + seconds_string = "{:02}".format(int(seconds)) + else: + # 9 chars long w/ leading 0, 6 digits after decimal + seconds_string = "%09.6f" % seconds + # Remove trailing zeros + seconds_string = seconds_string.rstrip("0") + except AttributeError: # int.is_integer() raises + seconds_string = "{:02}".format(seconds) + + time_str += "{}S".format(seconds_string) + else: + time_str = "" + + return "P" + date_str + time_str + + +def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: + encoded = base64.b64encode(o).decode() + if format == "base64url": + return encoded.strip("=").replace("+", "-").replace("/", "_") + return encoded + + +def _serialize_datetime(o, format: typing.Optional[str] = None): + if hasattr(o, "year") and hasattr(o, "hour"): + if format == "rfc7231": + return email.utils.format_datetime(o, usegmt=True) + if format == "unix-timestamp": + return int(calendar.timegm(o.utctimetuple())) + + # astimezone() fails for naive times in Python 2.7, so make make sure o is aware (tzinfo is set) + if not o.tzinfo: + iso_formatted = o.replace(tzinfo=TZ_UTC).isoformat() + else: + iso_formatted = o.astimezone(TZ_UTC).isoformat() + # Replace the trailing "+00:00" UTC offset with "Z" (RFC 3339: https://www.ietf.org/rfc/rfc3339.txt) + return iso_formatted.replace("+00:00", "Z") + # Next try datetime.date or datetime.time + return o.isoformat() + + +def _is_readonly(p): + try: + return p._visibility == ["read"] + except AttributeError: + return False + + +class SdkJSONEncoder(JSONEncoder): + """A JSON encoder that's capable of serializing datetime objects and bytes.""" + + def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): + super().__init__(*args, **kwargs) + self.exclude_readonly = exclude_readonly + self.format = format + + def default(self, o): # pylint: disable=too-many-return-statements + if _is_model(o): + if self.exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + return {k: v for k, v in o.items() if k not in readonly_props} + return dict(o.items()) + try: + return super(SdkJSONEncoder, self).default(o) + except TypeError: + if isinstance(o, _Null): + return None + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, self.format) + try: + # First try datetime.datetime + return _serialize_datetime(o, self.format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return super(SdkJSONEncoder, self).default(o) + + +_VALID_DATE = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" + r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") +_VALID_RFC7231 = re.compile( + r"(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s\d{2}\s" + r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT" +) + + +def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + attr = attr.upper() + match = _VALID_DATE.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + return date_obj + + +def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize RFC7231 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + match = _VALID_RFC7231.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + return email.utils.parsedate_to_datetime(attr) + + +def _deserialize_datetime_unix_timestamp(attr: typing.Union[float, datetime]) -> datetime: + """Deserialize unix timestamp into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + return datetime.fromtimestamp(attr, TZ_UTC) + + +def _deserialize_date(attr: typing.Union[str, date]) -> date: + """Deserialize ISO-8601 formatted string into Date object. + :param str attr: response string to be deserialized. + :rtype: date + :returns: The date object from that input + """ + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + if isinstance(attr, date): + return attr + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) # type: ignore + + +def _deserialize_time(attr: typing.Union[str, time]) -> time: + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :returns: The time object from that input + """ + if isinstance(attr, time): + return attr + return isodate.parse_time(attr) + + +def _deserialize_bytes(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + return bytes(base64.b64decode(attr)) + + +def _deserialize_bytes_base64(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return bytes(base64.b64decode(encoded)) + + +def _deserialize_duration(attr): + if isinstance(attr, timedelta): + return attr + return isodate.parse_duration(attr) + + +def _deserialize_decimal(attr): + if isinstance(attr, decimal.Decimal): + return attr + return decimal.Decimal(str(attr)) + + +def _deserialize_int_as_str(attr): + if isinstance(attr, int): + return attr + return int(attr) + + +_DESERIALIZE_MAPPING = { + datetime: _deserialize_datetime, + date: _deserialize_date, + time: _deserialize_time, + bytes: _deserialize_bytes, + bytearray: _deserialize_bytes, + timedelta: _deserialize_duration, + typing.Any: lambda x: x, + decimal.Decimal: _deserialize_decimal, +} + +_DESERIALIZE_MAPPING_WITHFORMAT = { + "rfc3339": _deserialize_datetime, + "rfc7231": _deserialize_datetime_rfc7231, + "unix-timestamp": _deserialize_datetime_unix_timestamp, + "base64": _deserialize_bytes, + "base64url": _deserialize_bytes_base64, +} + + +def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): + if annotation is int and rf and rf._format == "str": + return _deserialize_int_as_str + if rf and rf._format: + return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) + return _DESERIALIZE_MAPPING.get(annotation) # pyright: ignore + + +def _get_type_alias_type(module_name: str, alias_name: str): + types = { + k: v + for k, v in sys.modules[module_name].__dict__.items() + if isinstance(v, typing._GenericAlias) # type: ignore + } + if alias_name not in types: + return alias_name + return types[alias_name] + + +def _get_model(module_name: str, model_name: str): + models = {k: v for k, v in sys.modules[module_name].__dict__.items() if isinstance(v, type)} + module_end = module_name.rsplit(".", 1)[0] + models.update({k: v for k, v in sys.modules[module_end].__dict__.items() if isinstance(v, type)}) + if isinstance(model_name, str): + model_name = model_name.split(".")[-1] + if model_name not in models: + return model_name + return models[model_name] + + +_UNSET = object() + + +class _MyMutableMapping(MutableMapping[str, typing.Any]): + def __init__(self, data: dict[str, typing.Any]) -> None: + self._data = data + + def __contains__(self, key: typing.Any) -> bool: + return key in self._data + + def __getitem__(self, key: str) -> typing.Any: + return self._data.__getitem__(key) + + def __setitem__(self, key: str, value: typing.Any) -> None: + self._data.__setitem__(key, value) + + def __delitem__(self, key: str) -> None: + self._data.__delitem__(key) + + def __iter__(self) -> typing.Iterator[typing.Any]: + return self._data.__iter__() + + def __len__(self) -> int: + return self._data.__len__() + + def __ne__(self, other: typing.Any) -> bool: + return not self.__eq__(other) + + def keys(self) -> typing.KeysView[str]: + """ + :returns: a set-like object providing a view on D's keys + :rtype: ~typing.KeysView + """ + return self._data.keys() + + def values(self) -> typing.ValuesView[typing.Any]: + """ + :returns: an object providing a view on D's values + :rtype: ~typing.ValuesView + """ + return self._data.values() + + def items(self) -> typing.ItemsView[str, typing.Any]: + """ + :returns: set-like object providing a view on D's items + :rtype: ~typing.ItemsView + """ + return self._data.items() + + def get(self, key: str, default: typing.Any = None) -> typing.Any: + """ + Get the value for key if key is in the dictionary, else default. + :param str key: The key to look up. + :param any default: The value to return if key is not in the dictionary. Defaults to None + :returns: D[k] if k in D, else d. + :rtype: any + """ + try: + return self[key] + except KeyError: + return default + + @typing.overload + def pop(self, key: str) -> typing.Any: ... # pylint: disable=arguments-differ + + @typing.overload + def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs + + @typing.overload + def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Removes specified key and return the corresponding value. + :param str key: The key to pop. + :param any default: The value to return if key is not in the dictionary + :returns: The value corresponding to the key. + :rtype: any + :raises KeyError: If key is not found and default is not given. + """ + if default is _UNSET: + return self._data.pop(key) + return self._data.pop(key, default) + + def popitem(self) -> tuple[str, typing.Any]: + """ + Removes and returns some (key, value) pair + :returns: The (key, value) pair. + :rtype: tuple + :raises KeyError: if D is empty. + """ + return self._data.popitem() + + def clear(self) -> None: + """ + Remove all items from D. + """ + self._data.clear() + + def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ + """ + Updates D from mapping/iterable E and F. + :param any args: Either a mapping object or an iterable of key-value pairs. + """ + self._data.update(*args, **kwargs) + + @typing.overload + def setdefault(self, key: str, default: None = None) -> None: ... + + @typing.overload + def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Same as calling D.get(k, d), and setting D[k]=d if k not found + :param str key: The key to look up. + :param any default: The value to set if key is not in the dictionary + :returns: D[k] if k in D, else d. + :rtype: any + """ + if default is _UNSET: + return self._data.setdefault(key) + return self._data.setdefault(key, default) + + def __eq__(self, other: typing.Any) -> bool: + try: + other_model = self.__class__(other) + except Exception: + return False + return self._data == other_model._data + + def __repr__(self) -> str: + return str(self._data) + + +def _is_model(obj: typing.Any) -> bool: + return getattr(obj, "_is_model", False) + + +def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements + if isinstance(o, list): + return [_serialize(x, format) for x in o] + if isinstance(o, dict): + return {k: _serialize(v, format) for k, v in o.items()} + if isinstance(o, set): + return {_serialize(x, format) for x in o} + if isinstance(o, tuple): + return tuple(_serialize(x, format) for x in o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, format) + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, enum.Enum): + return o.value + if isinstance(o, int): + if format == "str": + return str(o) + return o + try: + # First try datetime.datetime + return _serialize_datetime(o, format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return o + + +def _get_rest_field(attr_to_rest_field: dict[str, "_RestField"], rest_name: str) -> typing.Optional["_RestField"]: + try: + return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) + except StopIteration: + return None + + +def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typing.Any: + if not rf: + return _serialize(value, None) + if rf._is_multipart_file_input: + return value + if rf._is_model: + return _deserialize(rf._type, value) + if isinstance(value, ET.Element): + value = _deserialize(rf._type, value) + return _serialize(value, rf._format) + + +class Model(_MyMutableMapping): + _is_model = True + # label whether current class's _attr_to_rest_field has been calculated + # could not see _attr_to_rest_field directly because subclass inherits it from parent class + _calculated: set[str] = set() + + def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: + class_name = self.__class__.__name__ + if len(args) > 1: + raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") + dict_to_pass = { + rest_field._rest_name: rest_field._default + for rest_field in self._attr_to_rest_field.values() + if rest_field._default is not _UNSET + } + if args: # pylint: disable=too-many-nested-blocks + if isinstance(args[0], ET.Element): + existed_attr_keys = [] + model_meta = getattr(self, "_xml", {}) + + for rf in self._attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + # attribute + if prop_meta.get("attribute", False) and args[0].get(xml_name) is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].get(xml_name)) + continue + + # unwrapped element is array + if prop_meta.get("unwrapped", False): + # unwrapped array could either use prop items meta/prop meta + if prop_meta.get("itemsName"): + xml_name = prop_meta.get("itemsName") + xml_ns = prop_meta.get("itemNs") + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + items = args[0].findall(xml_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, items) + continue + + # text element is primitive type + if prop_meta.get("text", False): + if args[0].text is not None: + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].text) + continue + + # wrapped element could be normal property or array, it should only have one element + item = args[0].find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, item) + + # rest thing is additional properties + for e in args[0]: + if e.tag not in existed_attr_keys: + dict_to_pass[e.tag] = _convert_element(e) + else: + dict_to_pass.update( + {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} + ) + else: + non_attr_kwargs = [k for k in kwargs if k not in self._attr_to_rest_field] + if non_attr_kwargs: + # actual type errors only throw the first wrong keyword arg they see, so following that. + raise TypeError(f"{class_name}.__init__() got an unexpected keyword argument '{non_attr_kwargs[0]}'") + dict_to_pass.update( + { + self._attr_to_rest_field[k]._rest_name: _create_value(self._attr_to_rest_field[k], v) + for k, v in kwargs.items() + if v is not None + } + ) + super().__init__(dict_to_pass) + + def copy(self) -> "Model": + return Model(self.__dict__) + + def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: + if f"{cls.__module__}.{cls.__qualname__}" not in cls._calculated: + # we know the last nine classes in mro are going to be 'Model', '_MyMutableMapping', 'MutableMapping', + # 'Mapping', 'Collection', 'Sized', 'Iterable', 'Container' and 'object' + mros = cls.__mro__[:-9][::-1] # ignore parents, and reverse the mro order + attr_to_rest_field: dict[str, _RestField] = { # map attribute name to rest_field property + k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") + } + annotations = { + k: v + for mro_class in mros + if hasattr(mro_class, "__annotations__") + for k, v in mro_class.__annotations__.items() + } + for attr, rf in attr_to_rest_field.items(): + rf._module = cls.__module__ + if not rf._type: + rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) + if not rf._rest_name_input: + rf._rest_name_input = attr + cls._attr_to_rest_field: dict[str, _RestField] = dict(attr_to_rest_field.items()) + cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") + + return super().__new__(cls) + + def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: + for base in cls.__bases__: + if hasattr(base, "__mapping__"): + base.__mapping__[discriminator or cls.__name__] = cls # type: ignore + + @classmethod + def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: + for v in cls.__dict__.values(): + if isinstance(v, _RestField) and v._is_discriminator and v._rest_name not in exist_discriminators: + return v + return None + + @classmethod + def _deserialize(cls, data, exist_discriminators): + if not hasattr(cls, "__mapping__"): + return cls(data) + discriminator = cls._get_discriminator(exist_discriminators) + if discriminator is None: + return cls(data) + exist_discriminators.append(discriminator._rest_name) + if isinstance(data, ET.Element): + model_meta = getattr(cls, "_xml", {}) + prop_meta = getattr(discriminator, "_xml", {}) + xml_name = prop_meta.get("name", discriminator._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + if data.get(xml_name) is not None: + discriminator_value = data.get(xml_name) + else: + discriminator_value = data.find(xml_name).text # pyright: ignore + else: + discriminator_value = data.get(discriminator._rest_name) + mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member + return mapped_cls._deserialize(data, exist_discriminators) + + def as_dict(self, *, exclude_readonly: bool = False) -> dict[str, typing.Any]: + """Return a dict that can be turned into json using json.dump. + + :keyword bool exclude_readonly: Whether to remove the readonly properties. + :returns: A dict JSON compatible object + :rtype: dict + """ + + result = {} + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)] + for k, v in self.items(): + if exclude_readonly and k in readonly_props: # pyright: ignore + continue + is_multipart_file_input = False + try: + is_multipart_file_input = next( + rf for rf in self._attr_to_rest_field.values() if rf._rest_name == k + )._is_multipart_file_input + except StopIteration: + pass + result[k] = v if is_multipart_file_input else Model._as_dict_value(v, exclude_readonly=exclude_readonly) + return result + + @staticmethod + def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any: + if v is None or isinstance(v, _Null): + return None + if isinstance(v, (list, tuple, set)): + return type(v)(Model._as_dict_value(x, exclude_readonly=exclude_readonly) for x in v) + if isinstance(v, dict): + return {dk: Model._as_dict_value(dv, exclude_readonly=exclude_readonly) for dk, dv in v.items()} + return v.as_dict(exclude_readonly=exclude_readonly) if hasattr(v, "as_dict") else v + + +def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): + if _is_model(obj): + return obj + return _deserialize(model_deserializer, obj) + + +def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): + if obj is None: + return obj + return _deserialize_with_callable(if_obj_deserializer, obj) + + +def _deserialize_with_union(deserializers, obj): + for deserializer in deserializers: + try: + return _deserialize(deserializer, obj) + except DeserializationError: + pass + raise DeserializationError() + + +def _deserialize_dict( + value_deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj: dict[typing.Any, typing.Any], +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = {child.tag: child for child in obj} + return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} + + +def _deserialize_multiple_sequence( + entry_deserializers: list[typing.Optional[typing.Callable]], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) + + +def _deserialize_sequence( + deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = list(obj) + return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) + + +def _sorted_annotations(types: list[typing.Any]) -> list[typing.Any]: + return sorted( + types, + key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"), + ) + + +def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-statements, too-many-branches + annotation: typing.Any, + module: typing.Optional[str], + rf: typing.Optional["_RestField"] = None, +) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + if not annotation: + return None + + # is it a type alias? + if isinstance(annotation, str): + if module is not None: + annotation = _get_type_alias_type(module, annotation) + + # is it a forward ref / in quotes? + if isinstance(annotation, (str, typing.ForwardRef)): + try: + model_name = annotation.__forward_arg__ # type: ignore + except AttributeError: + model_name = annotation + if module is not None: + annotation = _get_model(module, model_name) # type: ignore + + try: + if module and _is_model(annotation): + if rf: + rf._is_model = True + + return functools.partial(_deserialize_model, annotation) # pyright: ignore + except Exception: + pass + + # is it a literal? + try: + if annotation.__origin__ is typing.Literal: # pyright: ignore + return None + except AttributeError: + pass + + # is it optional? + try: + if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore + if len(annotation.__args__) <= 2: # pyright: ignore + if_obj_deserializer = _get_deserialize_callable_from_annotation( + next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_with_optional, if_obj_deserializer) + # the type is Optional[Union[...]], we need to remove the None type from the Union + annotation_copy = copy.copy(annotation) + annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a != type(None)] # pyright: ignore + return _get_deserialize_callable_from_annotation(annotation_copy, module, rf) + except AttributeError: + pass + + # is it union? + if getattr(annotation, "__origin__", None) is typing.Union: + # initial ordering is we make `string` the last deserialization option, because it is often them most generic + deserializers = [ + _get_deserialize_callable_from_annotation(arg, module, rf) + for arg in _sorted_annotations(annotation.__args__) # pyright: ignore + ] + + return functools.partial(_deserialize_with_union, deserializers) + + try: + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() == "dict": + value_deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[1], module, rf # pyright: ignore + ) + + return functools.partial( + _deserialize_dict, + value_deserializer, + module, + ) + except (AttributeError, IndexError): + pass + try: + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() in ["list", "set", "tuple", "sequence"]: + if len(annotation.__args__) > 1: # pyright: ignore + entry_deserializers = [ + _get_deserialize_callable_from_annotation(dt, module, rf) + for dt in annotation.__args__ # pyright: ignore + ] + return functools.partial(_deserialize_multiple_sequence, entry_deserializers, module) + deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[0], module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_sequence, deserializer, module) + except (TypeError, IndexError, AttributeError, SyntaxError): + pass + + def _deserialize_default( + deserializer, + obj, + ): + if obj is None: + return obj + try: + return _deserialize_with_callable(deserializer, obj) + except Exception: + pass + return obj + + if get_deserializer(annotation, rf): + return functools.partial(_deserialize_default, get_deserializer(annotation, rf)) + + return functools.partial(_deserialize_default, annotation) + + +def _deserialize_with_callable( + deserializer: typing.Optional[typing.Callable[[typing.Any], typing.Any]], + value: typing.Any, +): # pylint: disable=too-many-return-statements + try: + if value is None or isinstance(value, _Null): + return None + if isinstance(value, ET.Element): + if deserializer is str: + return value.text or "" + if deserializer is int: + return int(value.text) if value.text else None + if deserializer is float: + return float(value.text) if value.text else None + if deserializer is bool: + return value.text == "true" if value.text else None + if deserializer is None: + return value + if deserializer in [int, float, bool]: + return deserializer(value) + if isinstance(deserializer, CaseInsensitiveEnumMeta): + try: + return deserializer(value) + except ValueError: + # for unknown value, return raw value + return value + if isinstance(deserializer, type) and issubclass(deserializer, Model): + return deserializer._deserialize(value, []) + return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) + except Exception as e: + raise DeserializationError() from e + + +def _deserialize( + deserializer: typing.Any, + value: typing.Any, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + if isinstance(value, PipelineResponse): + value = value.http_response.json() + if rf is None and format: + rf = _RestField(format=format) + if not isinstance(deserializer, functools.partial): + deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf) + return _deserialize_with_callable(deserializer, value) + + +def _failsafe_deserialize( + deserializer: typing.Any, + response: HttpResponse, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + try: + return _deserialize(deserializer, response.json(), module, rf, format) + except DeserializationError: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +def _failsafe_deserialize_xml( + deserializer: typing.Any, + response: HttpResponse, +) -> typing.Any: + try: + return _deserialize_xml(deserializer, response.text()) + except DeserializationError: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +class _RestField: + def __init__( + self, + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + is_discriminator: bool = False, + visibility: typing.Optional[list[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[dict[str, typing.Any]] = None, + ): + self._type = type + self._rest_name_input = name + self._module: typing.Optional[str] = None + self._is_discriminator = is_discriminator + self._visibility = visibility + self._is_model = False + self._default = default + self._format = format + self._is_multipart_file_input = is_multipart_file_input + self._xml = xml if xml is not None else {} + + @property + def _class_type(self) -> typing.Any: + return getattr(self._type, "args", [None])[0] + + @property + def _rest_name(self) -> str: + if self._rest_name_input is None: + raise ValueError("Rest name was never set") + return self._rest_name_input + + def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin + # by this point, type and rest_name will have a value bc we default + # them in __new__ of the Model class + item = obj.get(self._rest_name) + if item is None: + return item + if self._is_model: + return item + return _deserialize(self._type, _serialize(item, self._format), rf=self) + + def __set__(self, obj: Model, value) -> None: + if value is None: + # we want to wipe out entries if users set attr to None + try: + obj.__delitem__(self._rest_name) + except KeyError: + pass + return + if self._is_model: + if not _is_model(value): + value = _deserialize(self._type, value) + obj.__setitem__(self._rest_name, value) + return + obj.__setitem__(self._rest_name, _serialize(value, self._format)) + + def _get_deserialize_callable_from_annotation( + self, annotation: typing.Any + ) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + return _get_deserialize_callable_from_annotation(annotation, self._module, self) + + +def rest_field( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[list[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField( + name=name, + type=type, + visibility=visibility, + default=default, + format=format, + is_multipart_file_input=is_multipart_file_input, + xml=xml, + ) + + +def rest_discriminator( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[list[str]] = None, + xml: typing.Optional[dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility, xml=xml) + + +def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: + """Serialize a model to XML. + + :param Model model: The model to serialize. + :param bool exclude_readonly: Whether to exclude readonly properties. + :returns: The XML representation of the model. + :rtype: str + """ + return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore + + +def _get_element( + o: typing.Any, + exclude_readonly: bool = False, + parent_meta: typing.Optional[dict[str, typing.Any]] = None, + wrapped_element: typing.Optional[ET.Element] = None, +) -> typing.Union[ET.Element, list[ET.Element]]: + if _is_model(o): + model_meta = getattr(o, "_xml", {}) + + # if prop is a model, then use the prop element directly, else generate a wrapper of model + if wrapped_element is None: + wrapped_element = _create_xml_element( + model_meta.get("name", o.__class__.__name__), + model_meta.get("prefix"), + model_meta.get("ns"), + ) + + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + + for k, v in o.items(): + # do not serialize readonly properties + if exclude_readonly and k in readonly_props: + continue + + prop_rest_field = _get_rest_field(o._attr_to_rest_field, k) + if prop_rest_field: + prop_meta = getattr(prop_rest_field, "_xml").copy() + # use the wire name as xml name if no specific name is set + if prop_meta.get("name") is None: + prop_meta["name"] = k + else: + # additional properties will not have rest field, use the wire name as xml name + prop_meta = {"name": k} + + # if no ns for prop, use model's + if prop_meta.get("ns") is None and model_meta.get("ns"): + prop_meta["ns"] = model_meta.get("ns") + prop_meta["prefix"] = model_meta.get("prefix") + + if prop_meta.get("unwrapped", False): + # unwrapped could only set on array + wrapped_element.extend(_get_element(v, exclude_readonly, prop_meta)) + elif prop_meta.get("text", False): + # text could only set on primitive type + wrapped_element.text = _get_primitive_type_value(v) + elif prop_meta.get("attribute", False): + xml_name = prop_meta.get("name", k) + if prop_meta.get("ns"): + ET.register_namespace(prop_meta.get("prefix"), prop_meta.get("ns")) # pyright: ignore + xml_name = "{" + prop_meta.get("ns") + "}" + xml_name # pyright: ignore + # attribute should be primitive type + wrapped_element.set(xml_name, _get_primitive_type_value(v)) + else: + # other wrapped prop element + wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) + return wrapped_element + if isinstance(o, list): + return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore + if isinstance(o, dict): + result = [] + for k, v in o.items(): + result.append( + _get_wrapped_element( + v, + exclude_readonly, + { + "name": k, + "ns": parent_meta.get("ns") if parent_meta else None, + "prefix": parent_meta.get("prefix") if parent_meta else None, + }, + ) + ) + return result + + # primitive case need to create element based on parent_meta + if parent_meta: + return _get_wrapped_element( + o, + exclude_readonly, + { + "name": parent_meta.get("itemsName", parent_meta.get("name")), + "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), + "ns": parent_meta.get("itemsNs", parent_meta.get("ns")), + }, + ) + + raise ValueError("Could not serialize value into xml: " + o) + + +def _get_wrapped_element( + v: typing.Any, + exclude_readonly: bool, + meta: typing.Optional[dict[str, typing.Any]], +) -> ET.Element: + wrapped_element = _create_xml_element( + meta.get("name") if meta else None, meta.get("prefix") if meta else None, meta.get("ns") if meta else None + ) + if isinstance(v, (dict, list)): + wrapped_element.extend(_get_element(v, exclude_readonly, meta)) + elif _is_model(v): + _get_element(v, exclude_readonly, meta, wrapped_element) + else: + wrapped_element.text = _get_primitive_type_value(v) + return wrapped_element + + +def _get_primitive_type_value(v) -> str: + if v is True: + return "true" + if v is False: + return "false" + if isinstance(v, _Null): + return "" + return str(v) + + +def _create_xml_element(tag, prefix=None, ns=None): + if prefix and ns: + ET.register_namespace(prefix, ns) + if ns: + return ET.Element("{" + ns + "}" + tag) + return ET.Element(tag) + + +def _deserialize_xml( + deserializer: typing.Any, + value: str, +) -> typing.Any: + element = ET.fromstring(value) # nosec + return _deserialize(deserializer, element) + + +def _convert_element(e: ET.Element): + # dict case + if len(e.attrib) > 0 or len({child.tag for child in e}) > 1: + dict_result: dict[str, typing.Any] = {} + for child in e: + if dict_result.get(child.tag) is not None: + if isinstance(dict_result[child.tag], list): + dict_result[child.tag].append(_convert_element(child)) + else: + dict_result[child.tag] = [dict_result[child.tag], _convert_element(child)] + else: + dict_result[child.tag] = _convert_element(child) + dict_result.update(e.attrib) + return dict_result + # array case + if len(e) > 0: + array_result: list[typing.Any] = [] + for child in e: + array_result.append(_convert_element(child)) + return array_result + # primitive case + return e.text diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_utils/serialization.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_utils/serialization.py index 5f250836cf4b..45a3e44e45cb 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_utils/serialization.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_utils/serialization.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -787,7 +787,7 @@ def serialize_data(self, data, data_type, **kwargs): # If dependencies is empty, try with current data class # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, data.__class__) + enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) if issubclass(enum_type, Enum): return Serializer.serialize_enum(data, enum_obj=enum_type) 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 5ae4c1319488..7373638328f9 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_version.py @@ -1,8 +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. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "12.1.1" +VERSION = "13.0.0" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/__init__.py index 30acffb8c4a7..31921ab4837a 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -12,7 +12,7 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._key_vault_management_client import KeyVaultManagementClient # type: ignore +from ._client import KeyVaultManagementClient # type: ignore try: from ._patch import __all__ as _patch_all 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/_client.py similarity index 89% rename from sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_key_vault_management_client.py rename to sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_client.py index 999d6174d010..79ab98e6736c 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/_client.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -17,7 +17,6 @@ from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy from azure.mgmt.core.tools import get_arm_endpoints -from .. import models as _models from .._utils.serialization import Deserializer, Serializer from ._configuration import KeyVaultManagementClientConfiguration from .operations import ( @@ -43,44 +42,43 @@ 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.aio.operations.KeysOperations - :ivar managed_hsm_keys: ManagedHsmKeysOperations operations - :vartype managed_hsm_keys: azure.mgmt.keyvault.aio.operations.ManagedHsmKeysOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.keyvault.aio.operations.Operations :ivar vaults: VaultsOperations operations :vartype vaults: azure.mgmt.keyvault.aio.operations.VaultsOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.keyvault.aio.operations.PrivateEndpointConnectionsOperations + :ivar managed_hsms: ManagedHsmsOperations operations + :vartype managed_hsms: azure.mgmt.keyvault.aio.operations.ManagedHsmsOperations + :ivar secrets: SecretsOperations operations + :vartype secrets: azure.mgmt.keyvault.aio.operations.SecretsOperations + :ivar keys: KeysOperations operations + :vartype keys: azure.mgmt.keyvault.aio.operations.KeysOperations + :ivar managed_hsm_keys: ManagedHsmKeysOperations operations + :vartype managed_hsm_keys: azure.mgmt.keyvault.aio.operations.ManagedHsmKeysOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations :vartype private_link_resources: azure.mgmt.keyvault.aio.operations.PrivateLinkResourcesOperations - :ivar managed_hsms: ManagedHsmsOperations operations - :vartype managed_hsms: azure.mgmt.keyvault.aio.operations.ManagedHsmsOperations - :ivar mhsm_private_endpoint_connections: MHSMPrivateEndpointConnectionsOperations operations - :vartype mhsm_private_endpoint_connections: - azure.mgmt.keyvault.aio.operations.MHSMPrivateEndpointConnectionsOperations :ivar mhsm_private_link_resources: MHSMPrivateLinkResourcesOperations operations :vartype mhsm_private_link_resources: azure.mgmt.keyvault.aio.operations.MHSMPrivateLinkResourcesOperations :ivar mhsm_regions: MHSMRegionsOperations operations :vartype mhsm_regions: azure.mgmt.keyvault.aio.operations.MHSMRegionsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.keyvault.aio.operations.Operations - :ivar secrets: SecretsOperations operations - :vartype secrets: azure.mgmt.keyvault.aio.operations.SecretsOperations - :param credential: Credential needed for the client to connect to Azure. Required. + :ivar mhsm_private_endpoint_connections: MHSMPrivateEndpointConnectionsOperations operations + :vartype mhsm_private_endpoint_connections: + azure.mgmt.keyvault.aio.operations.MHSMPrivateEndpointConnectionsOperations + :param credential: Credential used to authenticate requests to the service. Required. :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. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is None. + :param base_url: Service host. Default value is None. :type base_url: str :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2025-05-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Default value is "2025-05-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. @@ -95,6 +93,7 @@ def __init__( cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: + _endpoint = "{endpoint}" _cloud = cloud_setting or settings.current.azure_cloud # type: ignore _endpoints = get_arm_endpoints(_cloud) if not base_url: @@ -103,6 +102,7 @@ def __init__( self._config = KeyVaultManagementClientConfiguration( credential=credential, subscription_id=subscription_id, + base_url=cast(str, base_url), cloud_setting=cloud_setting, credential_scopes=credential_scopes, **kwargs @@ -127,34 +127,33 @@ def __init__( self._config.http_logging_policy, ] self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( - base_url=cast(str, base_url), policies=_policies, **kwargs + base_url=cast(str, _endpoint), policies=_policies, **kwargs ) - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) + self._serialize = Serializer() + self._deserialize = Deserializer() self._serialize.client_side_validation = False - self.keys = KeysOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_hsm_keys = ManagedHsmKeysOperations(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.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize) + self.keys = KeysOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_hsm_keys = ManagedHsmKeysOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) self.mhsm_private_link_resources = MHSMPrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) self.mhsm_regions = MHSMRegionsOperations(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.mhsm_private_endpoint_connections = MHSMPrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) - def _send_request( + def send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. @@ -162,7 +161,7 @@ def _send_request( >>> from azure.core.rest import HttpRequest >>> request = HttpRequest("GET", "https://www.example.org/") - >>> response = await client._send_request(request) + >>> response = await client.send_request(request) For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request @@ -175,7 +174,11 @@ def _send_request( """ request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_configuration.py index 2b6c8faac0f3..a333b16a00e7 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_configuration.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_configuration.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -24,16 +24,17 @@ class KeyVaultManagementClientConfiguration: # pylint: disable=too-many-instanc Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :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. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2025-05-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Default value is "2025-05-01". + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -41,6 +42,7 @@ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, + base_url: str = "https://management.azure.com", cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: @@ -53,6 +55,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url self.cloud_setting = cloud_setting self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_patch.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/__init__.py index 2c20c64a2fa5..599afc490f41 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -12,34 +12,34 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._keys_operations import KeysOperations # type: ignore -from ._managed_hsm_keys_operations import ManagedHsmKeysOperations # type: ignore -from ._vaults_operations import VaultsOperations # type: ignore -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore -from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore -from ._managed_hsms_operations import ManagedHsmsOperations # type: ignore -from ._mhsm_private_endpoint_connections_operations import MHSMPrivateEndpointConnectionsOperations # type: ignore -from ._mhsm_private_link_resources_operations import MHSMPrivateLinkResourcesOperations # type: ignore -from ._mhsm_regions_operations import MHSMRegionsOperations # type: ignore from ._operations import Operations # type: ignore -from ._secrets_operations import SecretsOperations # type: ignore +from ._operations import VaultsOperations # type: ignore +from ._operations import PrivateEndpointConnectionsOperations # type: ignore +from ._operations import ManagedHsmsOperations # type: ignore +from ._operations import SecretsOperations # type: ignore +from ._operations import KeysOperations # type: ignore +from ._operations import ManagedHsmKeysOperations # type: ignore +from ._operations import PrivateLinkResourcesOperations # type: ignore +from ._operations import MHSMPrivateLinkResourcesOperations # type: ignore +from ._operations import MHSMRegionsOperations # type: ignore +from ._operations import MHSMPrivateEndpointConnectionsOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ - "KeysOperations", - "ManagedHsmKeysOperations", + "Operations", "VaultsOperations", "PrivateEndpointConnectionsOperations", - "PrivateLinkResourcesOperations", "ManagedHsmsOperations", - "MHSMPrivateEndpointConnectionsOperations", + "SecretsOperations", + "KeysOperations", + "ManagedHsmKeysOperations", + "PrivateLinkResourcesOperations", "MHSMPrivateLinkResourcesOperations", "MHSMRegionsOperations", - "Operations", - "SecretsOperations", + "MHSMPrivateEndpointConnectionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_keys_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_keys_operations.py deleted file mode 100644 index 8dafdb114f8a..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_keys_operations.py +++ /dev/null @@ -1,505 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -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, -) -from .._configuration import KeyVaultManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class KeysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.keyvault.aio.KeyVaultManagementClient`'s - :attr:`keys` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - async def create_if_not_exist( - self, - resource_group_name: str, - vault_name: str, - key_name: str, - parameters: _models.KeyCreateParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param vault_name: The name of the key vault which contains the key to be created. Required. - :type vault_name: str - :param key_name: The name of the key to be created. The value you provide may be copied - globally for the purpose of running the service. The value provided should not include - personally identifiable or sensitive information. Required. - :type key_name: str - :param parameters: The parameters used to create the specified key. Required. - :type parameters: ~azure.mgmt.keyvault.models.KeyCreateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Key or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.Key - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_if_not_exist( - self, - resource_group_name: str, - vault_name: str, - key_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param vault_name: The name of the key vault which contains the key to be created. Required. - :type vault_name: str - :param key_name: The name of the key to be created. The value you provide may be copied - globally for the purpose of running the service. The value provided should not include - personally identifiable or sensitive information. Required. - :type key_name: str - :param parameters: The parameters used to create the specified key. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Key or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.Key - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_if_not_exist( - self, - resource_group_name: str, - vault_name: str, - key_name: str, - parameters: Union[_models.KeyCreateParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param vault_name: The name of the key vault which contains the key to be created. Required. - :type vault_name: str - :param key_name: The name of the key to be created. The value you provide may be copied - globally for the purpose of running the service. The value provided should not include - personally identifiable or sensitive information. Required. - :type key_name: str - :param parameters: The parameters used to create the specified key. Is either a - KeyCreateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.keyvault.models.KeyCreateParameters or IO[bytes] - :return: Key or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.Key - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Key] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "KeyCreateParameters") - - _request = build_create_if_not_exist_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - key_name=key_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Key", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param vault_name: The name of the vault which contains the key to be retrieved. Required. - :type vault_name: str - :param key_name: The name of the key to be retrieved. Required. - :type key_name: str - :return: Key or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.Key - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.Key] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - key_name=key_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Key", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Key"]: - """Lists the keys in the specified key vault. - - :param resource_group_name: The name of the resource group which contains the specified key - vault. Required. - :type resource_group_name: str - :param vault_name: The name of the vault which contains the keys to be retrieved. Required. - :type vault_name: str - :return: An iterator like instance of either Key or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.models.Key] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.KeyListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("KeyListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get_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. Required. - :type resource_group_name: str - :param vault_name: The name of the vault which contains the key version to be retrieved. - Required. - :type vault_name: str - :param key_name: The name of the key version to be retrieved. Required. - :type key_name: str - :param key_version: The version of the key to be retrieved. Required. - :type key_version: str - :return: Key or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.Key - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.Key] = kwargs.pop("cls", None) - - _request = build_get_version_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - key_name=key_name, - key_version=key_version, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Key", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_versions( - self, resource_group_name: str, vault_name: str, key_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.Key"]: - """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. Required. - :type resource_group_name: str - :param vault_name: The name of the vault which contains the key versions to be retrieved. - Required. - :type vault_name: str - :param key_name: The name of the key versions to be retrieved. Required. - :type key_name: str - :return: An iterator like instance of either Key or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.models.Key] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.KeyListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_versions_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - key_name=key_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("KeyListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_managed_hsm_keys_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_managed_hsm_keys_operations.py deleted file mode 100644 index 41e255346a79..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_managed_hsm_keys_operations.py +++ /dev/null @@ -1,509 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._managed_hsm_keys_operations import ( - build_create_if_not_exist_request, - build_get_request, - build_get_version_request, - build_list_request, - build_list_versions_request, -) -from .._configuration import KeyVaultManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ManagedHsmKeysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.keyvault.aio.KeyVaultManagementClient`'s - :attr:`managed_hsm_keys` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - async def create_if_not_exist( - self, - resource_group_name: str, - name: str, - key_name: str, - parameters: _models.ManagedHsmKeyCreateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ManagedHsmKey: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the Managed HSM Pool within the specified resource group. Required. - :type name: str - :param key_name: The name of the key to be created. The value you provide may be copied - globally for the purpose of running the service. The value provided should not include - personally identifiable or sensitive information. Required. - :type key_name: str - :param parameters: The parameters used to create the specified key. Required. - :type parameters: ~azure.mgmt.keyvault.models.ManagedHsmKeyCreateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ManagedHsmKey or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.ManagedHsmKey - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_if_not_exist( - self, - resource_group_name: str, - name: str, - key_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ManagedHsmKey: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the Managed HSM Pool within the specified resource group. Required. - :type name: str - :param key_name: The name of the key to be created. The value you provide may be copied - globally for the purpose of running the service. The value provided should not include - personally identifiable or sensitive information. Required. - :type key_name: str - :param parameters: The parameters used to create the specified key. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ManagedHsmKey or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.ManagedHsmKey - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_if_not_exist( - self, - resource_group_name: str, - name: str, - key_name: str, - parameters: Union[_models.ManagedHsmKeyCreateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.ManagedHsmKey: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the Managed HSM Pool within the specified resource group. Required. - :type name: str - :param key_name: The name of the key to be created. The value you provide may be copied - globally for the purpose of running the service. The value provided should not include - personally identifiable or sensitive information. Required. - :type key_name: str - :param parameters: The parameters used to create the specified key. Is either a - ManagedHsmKeyCreateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.keyvault.models.ManagedHsmKeyCreateParameters or IO[bytes] - :return: ManagedHsmKey or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.ManagedHsmKey - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ManagedHsmKey] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ManagedHsmKeyCreateParameters") - - _request = build_create_if_not_exist_request( - resource_group_name=resource_group_name, - name=name, - key_name=key_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ManagedHsmKey", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get(self, resource_group_name: str, name: str, key_name: str, **kwargs: Any) -> _models.ManagedHsmKey: - """Gets the current version of the specified key from the specified managed HSM. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the Managed HSM Pool within the specified resource group. Required. - :type name: str - :param key_name: The name of the key to be created. The value you provide may be copied - globally for the purpose of running the service. The value provided should not include - personally identifiable or sensitive information. Required. - :type key_name: str - :return: ManagedHsmKey or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.ManagedHsmKey - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ManagedHsmKey] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - name=name, - key_name=key_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ManagedHsmKey", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncItemPaged["_models.ManagedHsmKey"]: - """Lists the keys in the specified managed HSM. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the Managed HSM Pool within the specified resource group. Required. - :type name: str - :return: An iterator like instance of either ManagedHsmKey or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.models.ManagedHsmKey] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ManagedHsmKeyListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ManagedHsmKeyListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get_version( - self, resource_group_name: str, name: str, key_name: str, key_version: str, **kwargs: Any - ) -> _models.ManagedHsmKey: - """Gets the specified version of the specified key in the specified managed HSM. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the Managed HSM Pool within the specified resource group. Required. - :type name: str - :param key_name: The name of the key to be created. The value you provide may be copied - globally for the purpose of running the service. The value provided should not include - personally identifiable or sensitive information. Required. - :type key_name: str - :param key_version: The version of the key to be retrieved. Required. - :type key_version: str - :return: ManagedHsmKey or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.ManagedHsmKey - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ManagedHsmKey] = kwargs.pop("cls", None) - - _request = build_get_version_request( - resource_group_name=resource_group_name, - name=name, - key_name=key_name, - key_version=key_version, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ManagedHsmKey", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_versions( - self, resource_group_name: str, name: str, key_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.ManagedHsmKey"]: - """Lists the versions of the specified key in the specified managed HSM. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the Managed HSM Pool within the specified resource group. Required. - :type name: str - :param key_name: The name of the key to be created. The value you provide may be copied - globally for the purpose of running the service. The value provided should not include - personally identifiable or sensitive information. Required. - :type key_name: str - :return: An iterator like instance of either ManagedHsmKey or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.models.ManagedHsmKey] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ManagedHsmKeyListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_versions_request( - resource_group_name=resource_group_name, - name=name, - key_name=key_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ManagedHsmKeyListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_managed_hsms_operations.py deleted file mode 100644 index 4e695971d37c..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_managed_hsms_operations.py +++ /dev/null @@ -1,1115 +0,0 @@ -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._managed_hsms_operations import ( - build_check_mhsm_name_availability_request, - build_create_or_update_request, - 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_purge_deleted_request, - build_update_request, -) -from .._configuration import KeyVaultManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ManagedHsmsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.keyvault.aio.KeyVaultManagementClient`'s - :attr:`managed_hsms` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = 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: Union[_models.ManagedHsm, IO[bytes]], **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ManagedHsm") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - name: str, - parameters: _models.ManagedHsm, - *, - content_type: str = "application/json", - **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. - Required. - :type resource_group_name: str - :param name: Name of the managed HSM Pool. Required. - :type name: str - :param parameters: Parameters to create or update the managed HSM Pool. Required. - :type parameters: ~azure.mgmt.keyvault.models.ManagedHsm - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ManagedHsm or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.models.ManagedHsm] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. - Required. - :type resource_group_name: str - :param name: Name of the managed HSM Pool. Required. - :type name: str - :param parameters: Parameters to create or update the managed HSM Pool. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ManagedHsm or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.models.ManagedHsm] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, resource_group_name: str, name: str, parameters: Union[_models.ManagedHsm, IO[bytes]], **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. - Required. - :type resource_group_name: str - :param name: Name of the managed HSM Pool. Required. - :type name: str - :param parameters: Parameters to create or update the managed HSM Pool. Is either a ManagedHsm - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.keyvault.models.ManagedHsm or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ManagedHsm or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ManagedHsm] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - name=name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ManagedHsm", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ManagedHsm].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ManagedHsm]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, resource_group_name: str, name: str, parameters: Union[_models.ManagedHsm, IO[bytes]], **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ManagedHsm") - - _request = build_update_request( - resource_group_name=resource_group_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - name: str, - parameters: _models.ManagedHsm, - *, - content_type: str = "application/json", - **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. - Required. - :type resource_group_name: str - :param name: Name of the managed HSM Pool. Required. - :type name: str - :param parameters: Parameters to patch the managed HSM Pool. Required. - :type parameters: ~azure.mgmt.keyvault.models.ManagedHsm - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ManagedHsm or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.models.ManagedHsm] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. - Required. - :type resource_group_name: str - :param name: Name of the managed HSM Pool. Required. - :type name: str - :param parameters: Parameters to patch the managed HSM Pool. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ManagedHsm or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.models.ManagedHsm] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, resource_group_name: str, name: str, parameters: Union[_models.ManagedHsm, IO[bytes]], **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. - Required. - :type resource_group_name: str - :param name: Name of the managed HSM Pool. Required. - :type name: str - :param parameters: Parameters to patch the managed HSM Pool. Is either a ManagedHsm type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.keyvault.models.ManagedHsm or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ManagedHsm or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ManagedHsm] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - name=name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ManagedHsm", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ManagedHsm].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ManagedHsm]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete(self, resource_group_name: str, 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. - Required. - :type resource_group_name: str - :param name: The name of the managed HSM Pool to delete. Required. - :type name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - name=name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def 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. - Required. - :type resource_group_name: str - :param name: The name of the managed HSM Pool. Required. - :type name: str - :return: ManagedHsm or None or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.ManagedHsm or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.ManagedHsm]] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.ManagedHsm"]: - """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. - Required. - :type resource_group_name: str - :param top: Maximum number of results to return. Default value is None. - :type top: int - :return: An iterator like instance of either ManagedHsm or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.models.ManagedHsm] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ManagedHsmListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - top=top, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ManagedHsmListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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) - - @distributed_trace - def list_by_subscription(self, top: Optional[int] = None, **kwargs: Any) -> AsyncItemPaged["_models.ManagedHsm"]: - """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 - :return: An iterator like instance of either ManagedHsm or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.models.ManagedHsm] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ManagedHsmListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - top=top, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ManagedHsmListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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) - - @distributed_trace - def list_deleted(self, **kwargs: Any) -> AsyncItemPaged["_models.DeletedManagedHsm"]: - """The List operation gets information about the deleted managed HSMs associated with the - subscription. - - :return: An iterator like instance of either DeletedManagedHsm or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.models.DeletedManagedHsm] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DeletedManagedHsmListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_deleted_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DeletedManagedHsmListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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) - - @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. Required. - :type name: str - :param location: The location of the deleted managed HSM. Required. - :type location: str - :return: DeletedManagedHsm or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.DeletedManagedHsm - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DeletedManagedHsm] = kwargs.pop("cls", None) - - _request = build_get_deleted_request( - name=name, - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DeletedManagedHsm", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_purge_deleted_request( - name=name, - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_purge_deleted(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. Required. - :type name: str - :param location: The location of the soft-deleted managed HSM. Required. - :type location: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._purge_deleted_initial( - name=name, - location=location, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - async def check_mhsm_name_availability( - self, - mhsm_name: _models.CheckMhsmNameAvailabilityParameters, - *, - content_type: str = "application/json", - **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. Required. - :type mhsm_name: ~azure.mgmt.keyvault.models.CheckMhsmNameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CheckMhsmNameAvailabilityResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.CheckMhsmNameAvailabilityResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_mhsm_name_availability( - self, mhsm_name: IO[bytes], *, content_type: str = "application/json", **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. Required. - :type mhsm_name: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CheckMhsmNameAvailabilityResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.CheckMhsmNameAvailabilityResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_mhsm_name_availability( - self, mhsm_name: Union[_models.CheckMhsmNameAvailabilityParameters, IO[bytes]], **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. Is either a CheckMhsmNameAvailabilityParameters - type or a IO[bytes] type. Required. - :type mhsm_name: ~azure.mgmt.keyvault.models.CheckMhsmNameAvailabilityParameters or IO[bytes] - :return: CheckMhsmNameAvailabilityResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.CheckMhsmNameAvailabilityResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CheckMhsmNameAvailabilityResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(mhsm_name, (IOBase, bytes)): - _content = mhsm_name - else: - _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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CheckMhsmNameAvailabilityResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_mhsm_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_mhsm_private_endpoint_connections_operations.py deleted file mode 100644 index 0e240fd0a47f..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_mhsm_private_endpoint_connections_operations.py +++ /dev/null @@ -1,484 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._mhsm_private_endpoint_connections_operations import ( - build_delete_request, - build_get_request, - build_list_by_resource_request, - build_put_request, -) -from .._configuration import KeyVaultManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class MHSMPrivateEndpointConnectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.keyvault.aio.KeyVaultManagementClient`'s - :attr:`mhsm_private_endpoint_connections` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = 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 - ) -> AsyncItemPaged["_models.MHSMPrivateEndpointConnection"]: - """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. - Required. - :type resource_group_name: str - :param name: Name of the managed HSM Pool. Required. - :type name: str - :return: An iterator like instance of either MHSMPrivateEndpointConnection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MHSMPrivateEndpointConnectionsListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_request( - resource_group_name=resource_group_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("MHSMPrivateEndpointConnectionsListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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) - - @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. - Required. - :type resource_group_name: str - :param name: Name of the managed HSM Pool. Required. - :type name: str - :param private_endpoint_connection_name: Name of the private endpoint connection associated - with the managed hsm pool. Required. - :type private_endpoint_connection_name: str - :return: MHSMPrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MHSMPrivateEndpointConnection] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - name=name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MHSMPrivateEndpointConnection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def put( - self, - resource_group_name: str, - name: str, - private_endpoint_connection_name: str, - properties: _models.MHSMPrivateEndpointConnection, - *, - content_type: str = "application/json", - **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. - Required. - :type resource_group_name: str - :param name: Name of the managed HSM Pool. Required. - :type name: str - :param private_endpoint_connection_name: Name of the private endpoint connection associated - with the managed hsm pool. Required. - :type private_endpoint_connection_name: str - :param properties: The intended state of private endpoint connection. Required. - :type properties: ~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MHSMPrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def put( - self, - resource_group_name: str, - name: str, - private_endpoint_connection_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **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. - Required. - :type resource_group_name: str - :param name: Name of the managed HSM Pool. Required. - :type name: str - :param private_endpoint_connection_name: Name of the private endpoint connection associated - with the managed hsm pool. Required. - :type private_endpoint_connection_name: str - :param properties: The intended state of private endpoint connection. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: MHSMPrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def put( - self, - resource_group_name: str, - name: str, - private_endpoint_connection_name: str, - properties: Union[_models.MHSMPrivateEndpointConnection, IO[bytes]], - **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. - Required. - :type resource_group_name: str - :param name: Name of the managed HSM Pool. Required. - :type name: str - :param private_endpoint_connection_name: Name of the private endpoint connection associated - with the managed hsm pool. Required. - :type private_endpoint_connection_name: str - :param properties: The intended state of private endpoint connection. Is either a - MHSMPrivateEndpointConnection type or a IO[bytes] type. Required. - :type properties: ~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection or IO[bytes] - :return: MHSMPrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MHSMPrivateEndpointConnection] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "MHSMPrivateEndpointConnection") - - _request = build_put_request( - resource_group_name=resource_group_name, - name=name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - 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.http_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - async def _delete_initial( - self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - name=name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, 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. - Required. - :type resource_group_name: str - :param name: Name of the managed HSM Pool. Required. - :type name: str - :param private_endpoint_connection_name: Name of the private endpoint connection associated - with the managed hsm pool. Required. - :type private_endpoint_connection_name: str - :return: An instance of AsyncLROPoller that returns either MHSMPrivateEndpointConnection or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MHSMPrivateEndpointConnection] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - 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 - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MHSMPrivateEndpointConnection", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MHSMPrivateEndpointConnection].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MHSMPrivateEndpointConnection]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_mhsm_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_mhsm_private_link_resources_operations.py deleted file mode 100644 index 1c7c1d955059..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_mhsm_private_link_resources_operations.py +++ /dev/null @@ -1,110 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._mhsm_private_link_resources_operations import build_list_by_mhsm_resource_request -from .._configuration import KeyVaultManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class MHSMPrivateLinkResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.keyvault.aio.KeyVaultManagementClient`'s - :attr:`mhsm_private_link_resources` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = 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. - Required. - :type resource_group_name: str - :param name: Name of the managed HSM Pool. Required. - :type name: str - :return: MHSMPrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.MHSMPrivateLinkResourceListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MHSMPrivateLinkResourceListResult] = kwargs.pop("cls", None) - - _request = build_list_by_mhsm_resource_request( - resource_group_name=resource_group_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MHSMPrivateLinkResourceListResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_mhsm_regions_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_mhsm_regions_operations.py deleted file mode 100644 index 39fa399ab3e5..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_mhsm_regions_operations.py +++ /dev/null @@ -1,141 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._mhsm_regions_operations import build_list_by_resource_request -from .._configuration import KeyVaultManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class MHSMRegionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.keyvault.aio.KeyVaultManagementClient`'s - :attr:`mhsm_regions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = 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 - ) -> AsyncItemPaged["_models.MHSMGeoReplicatedRegion"]: - """The List operation gets information about the regions associated with the managed HSM Pool. - - :param resource_group_name: Name of the resource group that contains the managed HSM pool. - Required. - :type resource_group_name: str - :param name: Name of the managed HSM Pool. Required. - :type name: str - :return: An iterator like instance of either MHSMGeoReplicatedRegion or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.models.MHSMGeoReplicatedRegion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MHSMRegionsListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_request( - resource_group_name=resource_group_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("MHSMRegionsListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py index c5598e88c40d..8285d0c15174 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py @@ -1,12 +1,15 @@ +# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar +from io import IOBase +import json +from typing import Any, AsyncIterator, Callable, IO, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import AsyncPipelineClient @@ -17,21 +20,77 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from ..._utils.serialization import Deserializer, Serializer -from ...operations._operations import build_list_request +from ...operations._operations import ( + build_keys_create_if_not_exist_request, + build_keys_get_request, + build_keys_get_version_request, + build_keys_list_request, + build_keys_list_versions_request, + build_managed_hsm_keys_create_if_not_exist_request, + build_managed_hsm_keys_get_request, + build_managed_hsm_keys_get_version_request, + build_managed_hsm_keys_list_request, + build_managed_hsm_keys_list_versions_request, + build_managed_hsms_check_mhsm_name_availability_request, + build_managed_hsms_create_or_update_request, + build_managed_hsms_delete_request, + build_managed_hsms_get_deleted_request, + build_managed_hsms_get_request, + build_managed_hsms_list_by_resource_group_request, + build_managed_hsms_list_by_subscription_request, + build_managed_hsms_list_deleted_request, + build_managed_hsms_purge_deleted_request, + build_managed_hsms_update_request, + build_mhsm_private_endpoint_connections_delete_request, + build_mhsm_private_endpoint_connections_get_request, + build_mhsm_private_endpoint_connections_list_by_resource_request, + build_mhsm_private_endpoint_connections_put_request, + build_mhsm_private_link_resources_list_by_mhsm_resource_request, + build_mhsm_regions_list_by_resource_request, + build_operations_list_request, + build_private_endpoint_connections_delete_request, + build_private_endpoint_connections_get_request, + build_private_endpoint_connections_list_by_resource_request, + build_private_endpoint_connections_put_request, + build_private_link_resources_list_by_vault_request, + build_secrets_create_or_update_request, + build_secrets_get_request, + build_secrets_list_request, + build_secrets_update_request, + build_vaults_check_name_availability_request, + build_vaults_create_or_update_request, + build_vaults_delete_request, + build_vaults_get_deleted_request, + build_vaults_get_request, + build_vaults_list_by_resource_group_request, + build_vaults_list_by_subscription_request, + build_vaults_list_deleted_request, + build_vaults_list_request, + build_vaults_purge_deleted_request, + build_vaults_update_access_policy_request, + build_vaults_update_request, +) from .._configuration import KeyVaultManagementClientConfiguration T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] List = list @@ -45,8 +104,6 @@ class Operations: :attr:`operations` attribute. """ - models = _models - def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") @@ -56,17 +113,16 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Operation"]: - """Lists all of the available Key Vault Rest API operations. + """List the operations for the provider. - :return: An iterator like instance of either Operation or the result of cls(response) + :return: An iterator like instance of Operation :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -79,12 +135,646 @@ def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - _request = build_list_request( - api_version=api_version, + _request = build_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Operation], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class VaultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.aio.KeyVaultManagementClient`'s + :attr:`vaults` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = 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, **kwargs: Any) -> _models.Vault: + """Gets the specified Azure key vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :return: Vault. The Vault is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Vault + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Vault] = kwargs.pop("cls", None) + + _request = build_vaults_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Vault, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + vault_name: str, + parameters: Union[_models.VaultCreateOrUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_vaults_create_or_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vault_name: str, + parameters: _models.VaultCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param parameters: Parameters to create or update the vault. Required. + :type parameters: ~azure.mgmt.keyvault.models.VaultCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Vault. The Vault is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.models.Vault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vault_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param parameters: Parameters to create or update the vault. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Vault. The Vault is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.models.Vault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + vault_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param parameters: Parameters to create or update the vault. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Vault. The Vault is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.models.Vault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + vault_name: str, + parameters: Union[_models.VaultCreateOrUpdateParameters, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param parameters: Parameters to create or update the vault. Is one of the following types: + VaultCreateOrUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.keyvault.models.VaultCreateOrUpdateParameters or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns Vault. The Vault is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.models.Vault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Vault] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Vault, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Vault].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Vault]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + async def update( + self, + resource_group_name: str, + vault_name: str, + parameters: _models.VaultPatchParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Vault: + """Update a key vault in the specified subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param parameters: Parameters to patch the vault. Required. + :type parameters: ~azure.mgmt.keyvault.models.VaultPatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Vault. The Vault is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Vault + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + vault_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Vault: + """Update a key vault in the specified subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param parameters: Parameters to patch the vault. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Vault. The Vault is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Vault + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + vault_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Vault: + """Update a key vault in the specified subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param parameters: Parameters to patch the vault. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Vault. The Vault is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Vault + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + vault_name: str, + parameters: Union[_models.VaultPatchParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Vault: + """Update a key vault in the specified subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param parameters: Parameters to patch the vault. Is one of the following types: + VaultPatchParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.keyvault.models.VaultPatchParameters or JSON or IO[bytes] + :return: Vault. The Vault is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Vault + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Vault] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_vaults_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Vault, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_vaults_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, *, top: Optional[int] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.Vault"]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword top: Maximum number of results to return. Default value is None. + :paramtype top: int + :return: An iterator like instance of Vault + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.models.Vault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Vault]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_vaults_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -99,16 +789,4933 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Vault], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription(self, *, top: Optional[int] = None, **kwargs: Any) -> AsyncItemPaged["_models.Vault"]: + """The List operation gets information about the vaults associated with the subscription. + + :keyword top: Maximum number of results to return. Default value is None. + :paramtype top: int + :return: An iterator like instance of Vault + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.models.Vault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Vault]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_vaults_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Vault], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @overload + async def update_access_policy( + self, + resource_group_name: str, + vault_name: str, + operation_kind: Union[str, _models.AccessPolicyUpdateKind], + parameters: _models.VaultAccessPolicyParameters, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: Name of the vault. Required. + :type vault_name: str + :param operation_kind: Name of the operation. Known values are: "add", "replace", and "remove". + Required. + :type operation_kind: str or ~azure.mgmt.keyvault.models.AccessPolicyUpdateKind + :param parameters: Access policy to merge into the vault. Required. + :type parameters: ~azure.mgmt.keyvault.models.VaultAccessPolicyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: VaultAccessPolicyParameters. The VaultAccessPolicyParameters is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.VaultAccessPolicyParameters + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_access_policy( + self, + resource_group_name: str, + vault_name: str, + operation_kind: Union[str, _models.AccessPolicyUpdateKind], + parameters: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: Name of the vault. Required. + :type vault_name: str + :param operation_kind: Name of the operation. Known values are: "add", "replace", and "remove". + Required. + :type operation_kind: str or ~azure.mgmt.keyvault.models.AccessPolicyUpdateKind + :param parameters: Access policy to merge into the vault. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: VaultAccessPolicyParameters. The VaultAccessPolicyParameters is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.VaultAccessPolicyParameters + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_access_policy( + self, + resource_group_name: str, + vault_name: str, + operation_kind: Union[str, _models.AccessPolicyUpdateKind], + parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: Name of the vault. Required. + :type vault_name: str + :param operation_kind: Name of the operation. Known values are: "add", "replace", and "remove". + Required. + :type operation_kind: str or ~azure.mgmt.keyvault.models.AccessPolicyUpdateKind + :param parameters: Access policy to merge into the vault. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: VaultAccessPolicyParameters. The VaultAccessPolicyParameters is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.VaultAccessPolicyParameters + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_access_policy( + self, + resource_group_name: str, + vault_name: str, + operation_kind: Union[str, _models.AccessPolicyUpdateKind], + parameters: Union[_models.VaultAccessPolicyParameters, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: Name of the vault. Required. + :type vault_name: str + :param operation_kind: Name of the operation. Known values are: "add", "replace", and "remove". + Required. + :type operation_kind: str or ~azure.mgmt.keyvault.models.AccessPolicyUpdateKind + :param parameters: Access policy to merge into the vault. Is one of the following types: + VaultAccessPolicyParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.keyvault.models.VaultAccessPolicyParameters or JSON or IO[bytes] + :return: VaultAccessPolicyParameters. The VaultAccessPolicyParameters is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.VaultAccessPolicyParameters + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VaultAccessPolicyParameters] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_vaults_update_access_policy_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + operation_kind=operation_kind, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VaultAccessPolicyParameters, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type vault_name: str + :param location: The name of the Azure region. Required. + :type location: str + :return: DeletedVault. The DeletedVault is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.DeletedVault + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DeletedVault] = kwargs.pop("cls", None) + + _request = build_vaults_get_deleted_request( + vault_name=vault_name, + location=location, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DeletedVault, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _purge_deleted_initial(self, vault_name: str, location: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_vaults_purge_deleted_request( + vault_name=vault_name, + location=location, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_purge_deleted(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 vault. Required. + :type vault_name: str + :param location: The name of the Azure region. Required. + :type location: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._purge_deleted_initial( + vault_name=vault_name, + location=location, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_deleted(self, **kwargs: Any) -> AsyncItemPaged["_models.DeletedVault"]: + """Gets information about the deleted vaults in a subscription. + + :return: An iterator like instance of DeletedVault + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.models.DeletedVault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DeletedVault]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_vaults_list_deleted_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DeletedVault], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, *, top: Optional[int] = None, **kwargs: Any) -> AsyncItemPaged["_models.TrackedResource"]: + """The List operation gets information about the vaults associated with the subscription. + + :keyword top: Maximum number of results to return. Default value is None. + :paramtype top: int + :return: An iterator like instance of TrackedResource + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.models.TrackedResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop("filter") + api_version: Literal["2015-11-01"] = kwargs.pop("api_version") + cls: ClsType[List[_models.TrackedResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_vaults_list_request( + subscription_id=self._config.subscription_id, + top=top, + filter=filter, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.TrackedResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @overload + async def check_name_availability( + self, + vault_name: _models.VaultCheckNameAvailabilityParameters, + *, + content_type: str = "application/json", + **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. Required. + :type vault_name: ~azure.mgmt.keyvault.models.VaultCheckNameAvailabilityParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityResult. The CheckNameAvailabilityResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, vault_name: JSON, *, content_type: str = "application/json", **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. Required. + :type vault_name: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityResult. The CheckNameAvailabilityResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, vault_name: IO[bytes], *, content_type: str = "application/json", **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. Required. + :type vault_name: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityResult. The CheckNameAvailabilityResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_name_availability( + self, vault_name: Union[_models.VaultCheckNameAvailabilityParameters, JSON, IO[bytes]], **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. Is one of the following types: + VaultCheckNameAvailabilityParameters, JSON, IO[bytes] Required. + :type vault_name: ~azure.mgmt.keyvault.models.VaultCheckNameAvailabilityParameters or JSON or + IO[bytes] + :return: CheckNameAvailabilityResult. The CheckNameAvailabilityResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(vault_name, (IOBase, bytes)): + _content = vault_name + else: + _content = json.dumps(vault_name, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_vaults_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CheckNameAvailabilityResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.aio.KeyVaultManagementClient`'s + :attr:`private_endpoint_connections` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = 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: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection or None. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.PrivateEndpointConnection or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def put( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + properties: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates the specified private endpoint connection associated with the key vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. Required. + :type private_endpoint_connection_name: str + :param properties: The intended state of private endpoint connection. Required. + :type properties: ~azure.mgmt.keyvault.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def put( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates the specified private endpoint connection associated with the key vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. Required. + :type private_endpoint_connection_name: str + :param properties: The intended state of private endpoint connection. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def put( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates the specified private endpoint connection associated with the key vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. Required. + :type private_endpoint_connection_name: str + :param properties: The intended state of private endpoint connection. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def put( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + properties: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates the specified private endpoint connection associated with the key vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. Required. + :type private_endpoint_connection_name: str + :param properties: The intended state of private endpoint connection. Is one of the following + types: PrivateEndpointConnection, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.keyvault.models.PrivateEndpointConnection or JSON or IO[bytes] + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_private_endpoint_connections_put_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, 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") + ) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, resource_group_name: str, vault_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, 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: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. Required. + :type private_endpoint_connection_name: str + :return: An instance of AsyncLROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_resource( + self, resource_group_name: str, vault_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.PrivateEndpointConnection"]: + """The List operation gets information about the private endpoint connections associated with the + vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :return: An iterator like instance of PrivateEndpointConnection + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_private_endpoint_connections_list_by_resource_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.PrivateEndpointConnection], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ManagedHsmsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.aio.KeyVaultManagementClient`'s + :attr:`managed_hsms` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :return: ManagedHsm or None. The ManagedHsm is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.ManagedHsm or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Optional[_models.ManagedHsm]] = kwargs.pop("cls", None) + + _request = build_managed_hsms_get_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ManagedHsm, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, resource_group_name: str, name: str, parameters: Union[_models.ManagedHsm, JSON, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_managed_hsms_create_or_update_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + name: str, + parameters: _models.ManagedHsm, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedHsm]: + """Create or update a managed HSM Pool in the specified subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :param parameters: Parameters to create or update the managed HSM Pool. Required. + :type parameters: ~azure.mgmt.keyvault.models.ManagedHsm + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ManagedHsm. The ManagedHsm is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.models.ManagedHsm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedHsm]: + """Create or update a managed HSM Pool in the specified subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :param parameters: Parameters to create or update the managed HSM Pool. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ManagedHsm. The ManagedHsm is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.models.ManagedHsm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedHsm]: + """Create or update a managed HSM Pool in the specified subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :param parameters: Parameters to create or update the managed HSM Pool. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ManagedHsm. The ManagedHsm is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.models.ManagedHsm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, name: str, parameters: Union[_models.ManagedHsm, JSON, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedHsm]: + """Create or update a managed HSM Pool in the specified subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :param parameters: Parameters to create or update the managed HSM Pool. Is one of the following + types: ManagedHsm, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.keyvault.models.ManagedHsm or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns ManagedHsm. The ManagedHsm is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.models.ManagedHsm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ManagedHsm] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + name=name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ManagedHsm, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ManagedHsm].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ManagedHsm]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, resource_group_name: str, name: str, parameters: Union[_models.ManagedHsm, JSON, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_managed_hsms_update_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + name: str, + parameters: _models.ManagedHsm, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedHsm]: + """Update a managed HSM Pool in the specified subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :param parameters: Parameters to patch the managed HSM Pool. Required. + :type parameters: ~azure.mgmt.keyvault.models.ManagedHsm + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ManagedHsm. The ManagedHsm is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.models.ManagedHsm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedHsm]: + """Update a managed HSM Pool in the specified subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :param parameters: Parameters to patch the managed HSM Pool. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ManagedHsm. The ManagedHsm is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.models.ManagedHsm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedHsm]: + """Update a managed HSM Pool in the specified subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :param parameters: Parameters to patch the managed HSM Pool. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ManagedHsm. The ManagedHsm is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.models.ManagedHsm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, resource_group_name: str, name: str, parameters: Union[_models.ManagedHsm, JSON, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedHsm]: + """Update a managed HSM Pool in the specified subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :param parameters: Parameters to patch the managed HSM Pool. Is one of the following types: + ManagedHsm, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.keyvault.models.ManagedHsm or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns ManagedHsm. The ManagedHsm is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.models.ManagedHsm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ManagedHsm] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + name=name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ManagedHsm, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ManagedHsm].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ManagedHsm]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_managed_hsms_delete_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes the specified managed HSM Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + name=name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, *, top: Optional[int] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.ManagedHsm"]: + """The List operation gets information about the managed HSM Pools associated with the + subscription and within the specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword top: Maximum number of results to return. Default value is None. + :paramtype top: int + :return: An iterator like instance of ManagedHsm + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.models.ManagedHsm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ManagedHsm]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_managed_hsms_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ManagedHsm], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription(self, *, top: Optional[int] = None, **kwargs: Any) -> AsyncItemPaged["_models.ManagedHsm"]: + """The List operation gets information about the managed HSM Pools associated with the + subscription. + + :keyword top: Maximum number of results to return. Default value is None. + :paramtype top: int + :return: An iterator like instance of ManagedHsm + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.models.ManagedHsm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ManagedHsm]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_managed_hsms_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ManagedHsm], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @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. Required. + :type name: str + :param location: The name of the Azure region. Required. + :type location: str + :return: DeletedManagedHsm. The DeletedManagedHsm is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.DeletedManagedHsm + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DeletedManagedHsm] = kwargs.pop("cls", None) + + _request = build_managed_hsms_get_deleted_request( + name=name, + location=location, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DeletedManagedHsm, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_managed_hsms_purge_deleted_request( + name=name, + location=location, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_purge_deleted(self, name: str, location: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Permanently deletes the specified managed HSM. + + :param name: The name of the deleted managed HSM. Required. + :type name: str + :param location: The name of the Azure region. Required. + :type location: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._purge_deleted_initial( + name=name, location=location, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_deleted(self, **kwargs: Any) -> AsyncItemPaged["_models.DeletedManagedHsm"]: + """The List operation gets information about the deleted managed HSMs associated with the + subscription. + + :return: An iterator like instance of DeletedManagedHsm + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.models.DeletedManagedHsm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DeletedManagedHsm]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_managed_hsms_list_deleted_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DeletedManagedHsm], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @overload + async def check_mhsm_name_availability( + self, + mhsm_name: _models.CheckMhsmNameAvailabilityParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckMhsmNameAvailabilityResult: + """Checks that the managed hsm name is valid and is not already in use. + + :param mhsm_name: The request body. Required. + :type mhsm_name: ~azure.mgmt.keyvault.models.CheckMhsmNameAvailabilityParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckMhsmNameAvailabilityResult. The CheckMhsmNameAvailabilityResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.CheckMhsmNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_mhsm_name_availability( + self, mhsm_name: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckMhsmNameAvailabilityResult: + """Checks that the managed hsm name is valid and is not already in use. + + :param mhsm_name: The request body. Required. + :type mhsm_name: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckMhsmNameAvailabilityResult. The CheckMhsmNameAvailabilityResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.CheckMhsmNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_mhsm_name_availability( + self, mhsm_name: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckMhsmNameAvailabilityResult: + """Checks that the managed hsm name is valid and is not already in use. + + :param mhsm_name: The request body. Required. + :type mhsm_name: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckMhsmNameAvailabilityResult. The CheckMhsmNameAvailabilityResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.CheckMhsmNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_mhsm_name_availability( + self, mhsm_name: Union[_models.CheckMhsmNameAvailabilityParameters, JSON, IO[bytes]], **kwargs: Any + ) -> _models.CheckMhsmNameAvailabilityResult: + """Checks that the managed hsm name is valid and is not already in use. + + :param mhsm_name: The request body. Is one of the following types: + CheckMhsmNameAvailabilityParameters, JSON, IO[bytes] Required. + :type mhsm_name: ~azure.mgmt.keyvault.models.CheckMhsmNameAvailabilityParameters or JSON or + IO[bytes] + :return: CheckMhsmNameAvailabilityResult. The CheckMhsmNameAvailabilityResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.CheckMhsmNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckMhsmNameAvailabilityResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(mhsm_name, (IOBase, bytes)): + _content = mhsm_name + else: + _content = json.dumps(mhsm_name, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_managed_hsms_check_mhsm_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CheckMhsmNameAvailabilityResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class SecretsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.aio.KeyVaultManagementClient`'s + :attr:`secrets` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = 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, 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :return: Secret. The Secret is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Secret + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Secret] = kwargs.pop("cls", None) + + _request = build_secrets_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + secret_name=secret_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Secret, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + vault_name: str, + secret_name: str, + parameters: _models.SecretCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: Parameters to create or update the secret. Required. + :type parameters: ~azure.mgmt.keyvault.models.SecretCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Secret. The Secret is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Secret + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + vault_name: str, + secret_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: Parameters to create or update the secret. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Secret. The Secret is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Secret + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + vault_name: str, + secret_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: Parameters to create or update the secret. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Secret. The Secret is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Secret + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + vault_name: str, + secret_name: str, + parameters: Union[_models.SecretCreateOrUpdateParameters, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: Parameters to create or update the secret. Is one of the following types: + SecretCreateOrUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.keyvault.models.SecretCreateOrUpdateParameters or JSON or + IO[bytes] + :return: Secret. The Secret is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Secret + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Secret] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_secrets_create_or_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + secret_name=secret_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Secret, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + vault_name: str, + secret_name: str, + parameters: _models.SecretPatchParameters, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: Parameters to patch the secret. Required. + :type parameters: ~azure.mgmt.keyvault.models.SecretPatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Secret. The Secret is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Secret + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + vault_name: str, + secret_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: Parameters to patch the secret. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Secret. The Secret is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Secret + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + vault_name: str, + secret_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: Parameters to patch the secret. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Secret. The Secret is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Secret + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + vault_name: str, + secret_name: str, + parameters: Union[_models.SecretPatchParameters, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: Parameters to patch the secret. Is one of the following types: + SecretPatchParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.keyvault.models.SecretPatchParameters or JSON or IO[bytes] + :return: Secret. The Secret is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Secret + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Secret] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_secrets_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + secret_name=secret_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Secret, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, vault_name: str, *, top: Optional[int] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.Secret"]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :keyword top: Maximum number of results to return. Default value is None. + :paramtype top: int + :return: An iterator like instance of Secret + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.models.Secret] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Secret]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_secrets_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + top=top, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Secret], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class KeysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.aio.KeyVaultManagementClient`'s + :attr:`keys` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = 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, 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key to be retrieved. Required. + :type vault_name: str + :param key_name: The name of the key to be retrieved. Required. + :type key_name: str + :return: Key. The Key is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Key + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Key] = kwargs.pop("cls", None) + + _request = build_keys_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Key, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_if_not_exist( + self, + resource_group_name: str, + vault_name: str, + key_name: str, + parameters: _models.KeyCreateParameters, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key to be retrieved. Required. + :type vault_name: str + :param key_name: The name of the key to be retrieved. Required. + :type key_name: str + :param parameters: The parameters used to create the specified key. Required. + :type parameters: ~azure.mgmt.keyvault.models.KeyCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Key. The Key is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Key + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_if_not_exist( + self, + resource_group_name: str, + vault_name: str, + key_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key to be retrieved. Required. + :type vault_name: str + :param key_name: The name of the key to be retrieved. Required. + :type key_name: str + :param parameters: The parameters used to create the specified key. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Key. The Key is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Key + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_if_not_exist( + self, + resource_group_name: str, + vault_name: str, + key_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key to be retrieved. Required. + :type vault_name: str + :param key_name: The name of the key to be retrieved. Required. + :type key_name: str + :param parameters: The parameters used to create the specified key. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Key. The Key is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Key + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_if_not_exist( + self, + resource_group_name: str, + vault_name: str, + key_name: str, + parameters: Union[_models.KeyCreateParameters, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key to be retrieved. Required. + :type vault_name: str + :param key_name: The name of the key to be retrieved. Required. + :type key_name: str + :param parameters: The parameters used to create the specified key. Is one of the following + types: KeyCreateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.keyvault.models.KeyCreateParameters or JSON or IO[bytes] + :return: Key. The Key is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Key + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Key] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_keys_create_if_not_exist_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Key, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Key"]: + """Lists the keys in the specified key vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key to be retrieved. Required. + :type vault_name: str + :return: An iterator like instance of Key + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.models.Key] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Key]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_keys_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Key], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key version to be retrieved. + Required. + :type vault_name: str + :param key_name: The name of the key version to be retrieved. Required. + :type key_name: str + :param key_version: The version of the key to be retrieved. Required. + :type key_version: str + :return: Key. The Key is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Key + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Key] = kwargs.pop("cls", None) + + _request = build_keys_get_version_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + key_version=key_version, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Key, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_versions( + self, resource_group_name: str, vault_name: str, key_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.Key"]: + """Lists the keys in the specified key vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key version to be retrieved. + Required. + :type vault_name: str + :param key_name: The name of the key version to be retrieved. Required. + :type key_name: str + :return: An iterator like instance of Key + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.models.Key] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Key]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_keys_list_versions_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Key], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ManagedHsmKeysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.aio.KeyVaultManagementClient`'s + :attr:`managed_hsm_keys` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, resource_group_name: str, name: str, key_name: str, **kwargs: Any) -> _models.ManagedHsmKey: + """Gets the current version of the specified key from the specified managed HSM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the Managed HSM Pool within the specified resource group. Required. + :type name: str + :param key_name: The name of the key to be created. The value you provide may be copied + globally for the purpose of running the service. The value provided should not include + personally identifiable or sensitive information. Required. + :type key_name: str + :return: ManagedHsmKey. The ManagedHsmKey is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.ManagedHsmKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ManagedHsmKey] = kwargs.pop("cls", None) + + _request = build_managed_hsm_keys_get_request( + resource_group_name=resource_group_name, + name=name, + key_name=key_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ManagedHsmKey, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_if_not_exist( + self, + resource_group_name: str, + name: str, + key_name: str, + parameters: _models.ManagedHsmKeyCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedHsmKey: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the Managed HSM Pool within the specified resource group. Required. + :type name: str + :param key_name: The name of the key to be created. The value you provide may be copied + globally for the purpose of running the service. The value provided should not include + personally identifiable or sensitive information. Required. + :type key_name: str + :param parameters: The parameters used to create the specified key. Required. + :type parameters: ~azure.mgmt.keyvault.models.ManagedHsmKeyCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ManagedHsmKey. The ManagedHsmKey is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.ManagedHsmKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_if_not_exist( + self, + resource_group_name: str, + name: str, + key_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedHsmKey: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the Managed HSM Pool within the specified resource group. Required. + :type name: str + :param key_name: The name of the key to be created. The value you provide may be copied + globally for the purpose of running the service. The value provided should not include + personally identifiable or sensitive information. Required. + :type key_name: str + :param parameters: The parameters used to create the specified key. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ManagedHsmKey. The ManagedHsmKey is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.ManagedHsmKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_if_not_exist( + self, + resource_group_name: str, + name: str, + key_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedHsmKey: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the Managed HSM Pool within the specified resource group. Required. + :type name: str + :param key_name: The name of the key to be created. The value you provide may be copied + globally for the purpose of running the service. The value provided should not include + personally identifiable or sensitive information. Required. + :type key_name: str + :param parameters: The parameters used to create the specified key. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ManagedHsmKey. The ManagedHsmKey is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.ManagedHsmKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_if_not_exist( + self, + resource_group_name: str, + name: str, + key_name: str, + parameters: Union[_models.ManagedHsmKeyCreateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ManagedHsmKey: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the Managed HSM Pool within the specified resource group. Required. + :type name: str + :param key_name: The name of the key to be created. The value you provide may be copied + globally for the purpose of running the service. The value provided should not include + personally identifiable or sensitive information. Required. + :type key_name: str + :param parameters: The parameters used to create the specified key. Is one of the following + types: ManagedHsmKeyCreateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.keyvault.models.ManagedHsmKeyCreateParameters or JSON or + IO[bytes] + :return: ManagedHsmKey. The ManagedHsmKey is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.ManagedHsmKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ManagedHsmKey] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_managed_hsm_keys_create_if_not_exist_request( + resource_group_name=resource_group_name, + name=name, + key_name=key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ManagedHsmKey, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncItemPaged["_models.ManagedHsmKey"]: + """Lists the keys in the specified managed HSM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the Managed HSM Pool within the specified resource group. Required. + :type name: str + :return: An iterator like instance of ManagedHsmKey + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.models.ManagedHsmKey] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ManagedHsmKey]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_managed_hsm_keys_list_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ManagedHsmKey], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get_version( + self, resource_group_name: str, name: str, key_name: str, key_version: str, **kwargs: Any + ) -> _models.ManagedHsmKey: + """Gets the specified version of the specified key in the specified managed HSM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the Managed HSM Pool within the specified resource group. Required. + :type name: str + :param key_name: The name of the key to be created. The value you provide may be copied + globally for the purpose of running the service. The value provided should not include + personally identifiable or sensitive information. Required. + :type key_name: str + :param key_version: The version of the key to be retrieved. Required. + :type key_version: str + :return: ManagedHsmKey. The ManagedHsmKey is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.ManagedHsmKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ManagedHsmKey] = kwargs.pop("cls", None) + + _request = build_managed_hsm_keys_get_version_request( + resource_group_name=resource_group_name, + name=name, + key_name=key_name, + key_version=key_version, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ManagedHsmKey, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_versions( + self, resource_group_name: str, name: str, key_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.ManagedHsmKey"]: + """Lists the keys in the specified managed HSM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the Managed HSM Pool within the specified resource group. Required. + :type name: str + :param key_name: The name of the key to be created. The value you provide may be copied + globally for the purpose of running the service. The value provided should not include + personally identifiable or sensitive information. Required. + :type key_name: str + :return: An iterator like instance of ManagedHsmKey + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.models.ManagedHsmKey] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ManagedHsmKey]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_managed_hsm_keys_list_versions_request( + resource_group_name=resource_group_name, + name=name, + key_name=key_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ManagedHsmKey], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.aio.KeyVaultManagementClient`'s + :attr:`private_link_resources` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = 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: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :return: PrivateLinkResourceListResult. The PrivateLinkResourceListResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.PrivateLinkResourceListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) + + _request = build_private_link_resources_list_by_vault_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PrivateLinkResourceListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class MHSMPrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.aio.KeyVaultManagementClient`'s + :attr:`mhsm_private_link_resources` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = 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: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :return: MHSMPrivateLinkResourceListResult. The MHSMPrivateLinkResourceListResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.MHSMPrivateLinkResourceListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.MHSMPrivateLinkResourceListResult] = kwargs.pop("cls", None) + + _request = build_mhsm_private_link_resources_list_by_mhsm_resource_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.MHSMPrivateLinkResourceListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class MHSMRegionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.aio.KeyVaultManagementClient`'s + :attr:`mhsm_regions` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = 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 + ) -> AsyncItemPaged["_models.MHSMGeoReplicatedRegion"]: + """The List operation gets information about the regions associated with the managed HSM Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :return: An iterator like instance of MHSMGeoReplicatedRegion + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.models.MHSMGeoReplicatedRegion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.MHSMGeoReplicatedRegion]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_mhsm_regions_list_by_resource_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.MHSMGeoReplicatedRegion], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class MHSMPrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.aio.KeyVaultManagementClient`'s + :attr:`mhsm_private_endpoint_connections` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the managed hsm pool. Required. + :type private_endpoint_connection_name: str + :return: MHSMPrivateEndpointConnection. The MHSMPrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.MHSMPrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_mhsm_private_endpoint_connections_get_request( + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.MHSMPrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def put( + self, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + properties: _models.MHSMPrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MHSMPrivateEndpointConnection: + """Updates the specified private endpoint connection associated with the managed hsm pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the managed hsm pool. Required. + :type private_endpoint_connection_name: str + :param properties: The intended state of private endpoint connection. Required. + :type properties: ~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: MHSMPrivateEndpointConnection. The MHSMPrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def put( + self, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MHSMPrivateEndpointConnection: + """Updates the specified private endpoint connection associated with the managed hsm pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the managed hsm pool. Required. + :type private_endpoint_connection_name: str + :param properties: The intended state of private endpoint connection. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: MHSMPrivateEndpointConnection. The MHSMPrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def put( + self, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MHSMPrivateEndpointConnection: + """Updates the specified private endpoint connection associated with the managed hsm pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the managed hsm pool. Required. + :type private_endpoint_connection_name: str + :param properties: The intended state of private endpoint connection. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: MHSMPrivateEndpointConnection. The MHSMPrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def put( + self, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + properties: Union[_models.MHSMPrivateEndpointConnection, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.MHSMPrivateEndpointConnection: + """Updates the specified private endpoint connection associated with the managed hsm pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the managed hsm pool. Required. + :type private_endpoint_connection_name: str + :param properties: The intended state of private endpoint connection. Is one of the following + types: MHSMPrivateEndpointConnection, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection or JSON or + IO[bytes] + :return: MHSMPrivateEndpointConnection. The MHSMPrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MHSMPrivateEndpointConnection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_mhsm_private_endpoint_connections_put_request( + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, 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") + ) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.MHSMPrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_mhsm_private_endpoint_connections_delete_request( + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, 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: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the managed hsm pool. Required. + :type private_endpoint_connection_name: str + :return: An instance of AsyncLROPoller that returns MHSMPrivateEndpointConnection. The + MHSMPrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.MHSMPrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.MHSMPrivateEndpointConnection, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.MHSMPrivateEndpointConnection].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.MHSMPrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_resource( + self, resource_group_name: str, name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.MHSMPrivateEndpointConnection"]: + """The List operation gets information about the private endpoint connections associated with the + managed HSM Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :return: An iterator like instance of MHSMPrivateEndpointConnection + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.MHSMPrivateEndpointConnection]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_mhsm_private_endpoint_connections_list_by_resource_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.MHSMPrivateEndpointConnection], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) async def get_next(next_link=None): _request = prepare_request(next_link) @@ -121,7 +5728,8 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = _failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_patch.py index 3e907c37e646..87676c65a8f0 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_patch.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_patch.py @@ -1,121 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import Any, Optional, List, Literal -import urllib.parse -from collections.abc import MutableMapping -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -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 ._vaults_operations import VaultsOperations as _VaultsOperations, ClsType -from ...operations._vaults_operations import build_list_request - - -class VaultsOperations(_VaultsOperations): - - @distributed_trace - def list(self, top: Optional[int] = None, **kwargs: Any) -> AsyncItemPaged["_models.Resource"]: - """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 - :return: An iterator like instance of either Resource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2024_11_01.models.Resource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop( - "filter", _params.pop("$filter", "resourceType eq 'Microsoft.KeyVault/vaults'") - ) - api_version: Literal["2015-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-11-01")) - cls: ClsType[_models.ResourceListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - top=top, - filter=filter, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - -__all__: List[str] = ["VaultsOperations"] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_private_endpoint_connections_operations.py deleted file mode 100644 index 5875e489635b..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_private_endpoint_connections_operations.py +++ /dev/null @@ -1,479 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._private_endpoint_connections_operations import ( - build_delete_request, - build_get_request, - build_list_by_resource_request, - build_put_request, -) -from .._configuration import KeyVaultManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class PrivateEndpointConnectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.keyvault.aio.KeyVaultManagementClient`'s - :attr:`private_endpoint_connections` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = 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. Required. - :type resource_group_name: str - :param vault_name: The name of the key vault. Required. - :type vault_name: str - :param private_endpoint_connection_name: Name of the private endpoint connection associated - with the key vault. Required. - :type private_endpoint_connection_name: str - :return: PrivateEndpointConnection or None or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.PrivateEndpointConnection or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def put( - self, - resource_group_name: str, - vault_name: str, - private_endpoint_connection_name: str, - properties: _models.PrivateEndpointConnection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param vault_name: The name of the key vault. Required. - :type vault_name: str - :param private_endpoint_connection_name: Name of the private endpoint connection associated - with the key vault. Required. - :type private_endpoint_connection_name: str - :param properties: The intended state of private endpoint connection. Required. - :type properties: ~azure.mgmt.keyvault.models.PrivateEndpointConnection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def put( - self, - resource_group_name: str, - vault_name: str, - private_endpoint_connection_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param vault_name: The name of the key vault. Required. - :type vault_name: str - :param private_endpoint_connection_name: Name of the private endpoint connection associated - with the key vault. Required. - :type private_endpoint_connection_name: str - :param properties: The intended state of private endpoint connection. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def put( - self, - resource_group_name: str, - vault_name: str, - private_endpoint_connection_name: str, - properties: Union[_models.PrivateEndpointConnection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param vault_name: The name of the key vault. Required. - :type vault_name: str - :param private_endpoint_connection_name: Name of the private endpoint connection associated - with the key vault. Required. - :type private_endpoint_connection_name: str - :param properties: The intended state of private endpoint connection. Is either a - PrivateEndpointConnection type or a IO[bytes] type. Required. - :type properties: ~azure.mgmt.keyvault.models.PrivateEndpointConnection or IO[bytes] - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "PrivateEndpointConnection") - - _request = build_put_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - 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.http_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - async def _delete_initial( - self, resource_group_name: str, vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - 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")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, 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. Required. - :type resource_group_name: str - :param vault_name: The name of the key vault. Required. - :type vault_name: str - :param private_endpoint_connection_name: Name of the private endpoint connection associated - with the key vault. Required. - :type private_endpoint_connection_name: str - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - 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 - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.PrivateEndpointConnection]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_by_resource( - self, resource_group_name: str, vault_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.PrivateEndpointConnection"]: - """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. Required. - :type resource_group_name: str - :param vault_name: The name of the key vault. Required. - :type vault_name: str - :return: An iterator like instance of either PrivateEndpointConnection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_private_link_resources_operations.py deleted file mode 100644 index bcecb2f19819..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_private_link_resources_operations.py +++ /dev/null @@ -1,109 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, 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 ..._utils.serialization import Deserializer, Serializer -from ...operations._private_link_resources_operations import build_list_by_vault_request -from .._configuration import KeyVaultManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class PrivateLinkResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.keyvault.aio.KeyVaultManagementClient`'s - :attr:`private_link_resources` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = 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. Required. - :type resource_group_name: str - :param vault_name: The name of the key vault. Required. - :type vault_name: str - :return: PrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.PrivateLinkResourceListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - - _request = build_list_by_vault_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_secrets_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_secrets_operations.py deleted file mode 100644 index b44a70659918..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_secrets_operations.py +++ /dev/null @@ -1,507 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._secrets_operations import ( - build_create_or_update_request, - build_get_request, - build_list_request, - build_update_request, -) -from .._configuration import KeyVaultManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class SecretsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.keyvault.aio.KeyVaultManagementClient`'s - :attr:`secrets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - async def create_or_update( - self, - resource_group_name: str, - vault_name: str, - secret_name: str, - parameters: _models.SecretCreateOrUpdateParameters, - *, - content_type: str = "application/json", - **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. - Required. - :type resource_group_name: str - :param vault_name: Name of the vault. Required. - :type vault_name: str - :param secret_name: Name of the secret. The value you provide may be copied globally for the - purpose of running the service. The value provided should not include personally identifiable - or sensitive information. Required. - :type secret_name: str - :param parameters: Parameters to create or update the secret. Required. - :type parameters: ~azure.mgmt.keyvault.models.SecretCreateOrUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - vault_name: str, - secret_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. - Required. - :type resource_group_name: str - :param vault_name: Name of the vault. Required. - :type vault_name: str - :param secret_name: Name of the secret. The value you provide may be copied globally for the - purpose of running the service. The value provided should not include personally identifiable - or sensitive information. Required. - :type secret_name: str - :param parameters: Parameters to create or update the secret. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - vault_name: str, - secret_name: str, - parameters: Union[_models.SecretCreateOrUpdateParameters, IO[bytes]], - **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. - Required. - :type resource_group_name: str - :param vault_name: Name of the vault. Required. - :type vault_name: str - :param secret_name: Name of the secret. The value you provide may be copied globally for the - purpose of running the service. The value provided should not include personally identifiable - or sensitive information. Required. - :type secret_name: str - :param parameters: Parameters to create or update the secret. Is either a - SecretCreateOrUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.keyvault.models.SecretCreateOrUpdateParameters or IO[bytes] - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Secret] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Secret", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - vault_name: str, - secret_name: str, - parameters: _models.SecretPatchParameters, - *, - content_type: str = "application/json", - **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. - Required. - :type resource_group_name: str - :param vault_name: Name of the vault. Required. - :type vault_name: str - :param secret_name: Name of the secret. Required. - :type secret_name: str - :param parameters: Parameters to patch the secret. Required. - :type parameters: ~azure.mgmt.keyvault.models.SecretPatchParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - vault_name: str, - secret_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. - Required. - :type resource_group_name: str - :param vault_name: Name of the vault. Required. - :type vault_name: str - :param secret_name: Name of the secret. Required. - :type secret_name: str - :param parameters: Parameters to patch the secret. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - vault_name: str, - secret_name: str, - parameters: Union[_models.SecretPatchParameters, IO[bytes]], - **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. - Required. - :type resource_group_name: str - :param vault_name: Name of the vault. Required. - :type vault_name: str - :param secret_name: Name of the secret. Required. - :type secret_name: str - :param parameters: Parameters to patch the secret. Is either a SecretPatchParameters type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.keyvault.models.SecretPatchParameters or IO[bytes] - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Secret] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Secret", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. - Required. - :type resource_group_name: str - :param vault_name: The name of the vault. Required. - :type vault_name: str - :param secret_name: The name of the secret. Required. - :type secret_name: str - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.Secret] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Secret", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, vault_name: str, top: Optional[int] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.Secret"]: - """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. - Required. - :type resource_group_name: str - :param vault_name: The name of the vault. Required. - :type vault_name: str - :param top: Maximum number of results to return. Default value is None. - :type top: int - :return: An iterator like instance of either Secret or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.models.Secret] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SecretListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - top=top, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("SecretListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_vaults_operations.py deleted file mode 100644 index a7c40cb59ceb..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_vaults_operations.py +++ /dev/null @@ -1,1214 +0,0 @@ -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Literal, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._vaults_operations import ( - build_check_name_availability_request, - build_create_or_update_request, - 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, - build_update_access_policy_request, - build_update_request, -) -from .._configuration import KeyVaultManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class VaultsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.keyvault.aio.KeyVaultManagementClient`'s - :attr:`vaults` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = 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: Union[_models.VaultCreateOrUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "VaultCreateOrUpdateParameters") - - _request = build_create_or_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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - vault_name: str, - parameters: _models.VaultCreateOrUpdateParameters, - *, - content_type: str = "application/json", - **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. - Required. - :type resource_group_name: str - :param vault_name: Name of the vault. Required. - :type vault_name: str - :param parameters: Parameters to create or update the vault. Required. - :type parameters: ~azure.mgmt.keyvault.models.VaultCreateOrUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Vault or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.models.Vault] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - vault_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. - Required. - :type resource_group_name: str - :param vault_name: Name of the vault. Required. - :type vault_name: str - :param parameters: Parameters to create or update the vault. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Vault or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.models.Vault] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - vault_name: str, - parameters: Union[_models.VaultCreateOrUpdateParameters, IO[bytes]], - **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. - Required. - :type resource_group_name: str - :param vault_name: Name of the vault. Required. - :type vault_name: str - :param parameters: Parameters to create or update the vault. Is either a - VaultCreateOrUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.keyvault.models.VaultCreateOrUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Vault or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Vault] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - 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 - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Vault", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Vault].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Vault]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def update( - self, - resource_group_name: str, - vault_name: str, - parameters: _models.VaultPatchParameters, - *, - content_type: str = "application/json", - **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. - Required. - :type resource_group_name: str - :param vault_name: Name of the vault. Required. - :type vault_name: str - :param parameters: Parameters to patch the vault. Required. - :type parameters: ~azure.mgmt.keyvault.models.VaultPatchParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Vault or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.Vault - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - vault_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. - Required. - :type resource_group_name: str - :param vault_name: Name of the vault. Required. - :type vault_name: str - :param parameters: Parameters to patch the vault. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Vault or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.Vault - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - vault_name: str, - parameters: Union[_models.VaultPatchParameters, IO[bytes]], - **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. - Required. - :type resource_group_name: str - :param vault_name: Name of the vault. Required. - :type vault_name: str - :param parameters: Parameters to patch the vault. Is either a VaultPatchParameters type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.keyvault.models.VaultPatchParameters or IO[bytes] - :return: Vault or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.Vault - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Vault] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Vault", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete(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. - Required. - :type resource_group_name: str - :param vault_name: The name of the vault to delete. Required. - :type vault_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", 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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def 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. - Required. - :type resource_group_name: str - :param vault_name: The name of the vault. Required. - :type vault_name: str - :return: Vault or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.Vault - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.Vault] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Vault", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update_access_policy( - self, - resource_group_name: str, - vault_name: str, - operation_kind: Union[str, _models.AccessPolicyUpdateKind], - parameters: _models.VaultAccessPolicyParameters, - *, - content_type: str = "application/json", - **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. - Required. - :type resource_group_name: str - :param vault_name: Name of the vault. Required. - :type vault_name: str - :param operation_kind: Name of the operation. Known values are: "add", "replace", and "remove". - Required. - :type operation_kind: str or ~azure.mgmt.keyvault.models.AccessPolicyUpdateKind - :param parameters: Access policy to merge into the vault. Required. - :type parameters: ~azure.mgmt.keyvault.models.VaultAccessPolicyParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: VaultAccessPolicyParameters or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.VaultAccessPolicyParameters - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update_access_policy( - self, - resource_group_name: str, - vault_name: str, - operation_kind: Union[str, _models.AccessPolicyUpdateKind], - parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. - Required. - :type resource_group_name: str - :param vault_name: Name of the vault. Required. - :type vault_name: str - :param operation_kind: Name of the operation. Known values are: "add", "replace", and "remove". - Required. - :type operation_kind: str or ~azure.mgmt.keyvault.models.AccessPolicyUpdateKind - :param parameters: Access policy to merge into the vault. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: VaultAccessPolicyParameters or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.VaultAccessPolicyParameters - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update_access_policy( - self, - resource_group_name: str, - vault_name: str, - operation_kind: Union[str, _models.AccessPolicyUpdateKind], - parameters: Union[_models.VaultAccessPolicyParameters, IO[bytes]], - **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. - Required. - :type resource_group_name: str - :param vault_name: Name of the vault. Required. - :type vault_name: str - :param operation_kind: Name of the operation. Known values are: "add", "replace", and "remove". - Required. - :type operation_kind: str or ~azure.mgmt.keyvault.models.AccessPolicyUpdateKind - :param parameters: Access policy to merge into the vault. Is either a - VaultAccessPolicyParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.keyvault.models.VaultAccessPolicyParameters or IO[bytes] - :return: VaultAccessPolicyParameters or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.VaultAccessPolicyParameters - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VaultAccessPolicyParameters] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.Vault"]: - """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. - Required. - :type resource_group_name: str - :param top: Maximum number of results to return. Default value is None. - :type top: int - :return: An iterator like instance of either Vault or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.models.Vault] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.VaultListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - top=top, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("VaultListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_subscription(self, top: Optional[int] = None, **kwargs: Any) -> AsyncItemPaged["_models.Vault"]: - """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 - :return: An iterator like instance of either Vault or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.models.Vault] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.VaultListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - top=top, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("VaultListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_deleted(self, **kwargs: Any) -> AsyncItemPaged["_models.DeletedVault"]: - """Gets information about the deleted vaults in a subscription. - - :return: An iterator like instance of either DeletedVault or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.models.DeletedVault] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DeletedVaultListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_deleted_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DeletedVaultListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get_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. Required. - :type vault_name: str - :param location: The location of the deleted vault. Required. - :type location: str - :return: DeletedVault or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.DeletedVault - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DeletedVault] = kwargs.pop("cls", None) - - _request = build_get_deleted_request( - vault_name=vault_name, - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DeletedVault", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _purge_deleted_initial(self, vault_name: str, location: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_purge_deleted_request( - vault_name=vault_name, - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_purge_deleted(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. Required. - :type vault_name: str - :param location: The location of the soft-deleted vault. Required. - :type location: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._purge_deleted_initial( - vault_name=vault_name, - location=location, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, top: Optional[int] = None, **kwargs: Any) -> AsyncItemPaged["_models.Resource"]: - """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 - :return: An iterator like instance of either Resource or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.models.Resource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop( - "filter", _params.pop("$filter", "resourceType eq 'Microsoft.KeyVault/vaults'") - ) - api_version: Literal["2015-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-11-01")) - cls: ClsType[_models.ResourceListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - top=top, - filter=filter, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @overload - async def check_name_availability( - self, - vault_name: _models.VaultCheckNameAvailabilityParameters, - *, - content_type: str = "application/json", - **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. Required. - :type vault_name: ~azure.mgmt.keyvault.models.VaultCheckNameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CheckNameAvailabilityResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.CheckNameAvailabilityResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_name_availability( - self, vault_name: IO[bytes], *, content_type: str = "application/json", **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. Required. - :type vault_name: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CheckNameAvailabilityResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.CheckNameAvailabilityResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_name_availability( - self, vault_name: Union[_models.VaultCheckNameAvailabilityParameters, IO[bytes]], **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. Is either a VaultCheckNameAvailabilityParameters type - or a IO[bytes] type. Required. - :type vault_name: ~azure.mgmt.keyvault.models.VaultCheckNameAvailabilityParameters or IO[bytes] - :return: CheckNameAvailabilityResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.CheckNameAvailabilityResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(vault_name, (IOBase, bytes)): - _content = vault_name - else: - _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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/__init__.py index 5b57250a3406..12996df9c26f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -13,19 +13,19 @@ from ._patch import * # pylint: disable=unused-wildcard-import -from ._models_py3 import ( # type: ignore +from ._models import ( # type: ignore AccessPolicyEntry, Action, + ArmResource, Attributes, CheckMhsmNameAvailabilityParameters, CheckMhsmNameAvailabilityResult, CheckNameAvailabilityResult, + CloudError, CloudErrorBody, DeletedManagedHsm, - DeletedManagedHsmListResult, DeletedManagedHsmProperties, DeletedVault, - DeletedVaultListResult, DeletedVaultProperties, DimensionProperties, Error, @@ -33,7 +33,6 @@ Key, KeyAttributes, KeyCreateParameters, - KeyListResult, KeyProperties, KeyReleasePolicy, KeyRotationPolicyAttributes, @@ -45,11 +44,11 @@ MHSMPrivateEndpoint, MHSMPrivateEndpointConnection, MHSMPrivateEndpointConnectionItem, - MHSMPrivateEndpointConnectionsListResult, + MHSMPrivateEndpointConnectionProperties, MHSMPrivateLinkResource, MHSMPrivateLinkResourceListResult, + MHSMPrivateLinkResourceProperties, MHSMPrivateLinkServiceConnectionState, - MHSMRegionsListResult, MHSMServiceTagRule, MHSMVirtualNetworkRule, ManagedHSMSecurityDomainProperties, @@ -59,12 +58,10 @@ ManagedHsmKey, ManagedHsmKeyAttributes, ManagedHsmKeyCreateParameters, - ManagedHsmKeyListResult, ManagedHsmKeyProperties, ManagedHsmKeyReleasePolicy, ManagedHsmKeyRotationPolicyAttributes, ManagedHsmLifetimeAction, - ManagedHsmListResult, ManagedHsmProperties, ManagedHsmResource, ManagedHsmRotationPolicy, @@ -75,29 +72,28 @@ NetworkRuleSet, Operation, OperationDisplay, - OperationListResult, + OperationProperties, Permissions, PrivateEndpoint, PrivateEndpointConnection, PrivateEndpointConnectionItem, - PrivateEndpointConnectionListResult, + PrivateEndpointConnectionProperties, PrivateLinkResource, PrivateLinkResourceListResult, + PrivateLinkResourceProperties, PrivateLinkServiceConnectionState, - ProxyResourceWithoutSystemData, - Resource, - ResourceListResult, + ProxyResource, RotationPolicy, Secret, SecretAttributes, SecretCreateOrUpdateParameters, - SecretListResult, SecretPatchParameters, SecretPatchProperties, SecretProperties, ServiceSpecification, Sku, SystemData, + TrackedResource, Trigger, UserAssignedIdentity, Vault, @@ -105,22 +101,21 @@ VaultAccessPolicyProperties, VaultCheckNameAvailabilityParameters, VaultCreateOrUpdateParameters, - VaultListResult, VaultPatchParameters, VaultPatchProperties, VaultProperties, VirtualNetworkRule, ) -from ._key_vault_management_client_enums import ( # type: ignore +from ._enums import ( # type: ignore AccessPolicyUpdateKind, ActionsRequired, ActivationStatus, CertificatePermissions, CreateMode, + CreatedByType, DeletionRecoveryLevel, GeoReplicationRegionProvisioningState, - IdentityType, JsonWebKeyCurveName, JsonWebKeyOperation, JsonWebKeyType, @@ -149,16 +144,16 @@ __all__ = [ "AccessPolicyEntry", "Action", + "ArmResource", "Attributes", "CheckMhsmNameAvailabilityParameters", "CheckMhsmNameAvailabilityResult", "CheckNameAvailabilityResult", + "CloudError", "CloudErrorBody", "DeletedManagedHsm", - "DeletedManagedHsmListResult", "DeletedManagedHsmProperties", "DeletedVault", - "DeletedVaultListResult", "DeletedVaultProperties", "DimensionProperties", "Error", @@ -166,7 +161,6 @@ "Key", "KeyAttributes", "KeyCreateParameters", - "KeyListResult", "KeyProperties", "KeyReleasePolicy", "KeyRotationPolicyAttributes", @@ -178,11 +172,11 @@ "MHSMPrivateEndpoint", "MHSMPrivateEndpointConnection", "MHSMPrivateEndpointConnectionItem", - "MHSMPrivateEndpointConnectionsListResult", + "MHSMPrivateEndpointConnectionProperties", "MHSMPrivateLinkResource", "MHSMPrivateLinkResourceListResult", + "MHSMPrivateLinkResourceProperties", "MHSMPrivateLinkServiceConnectionState", - "MHSMRegionsListResult", "MHSMServiceTagRule", "MHSMVirtualNetworkRule", "ManagedHSMSecurityDomainProperties", @@ -192,12 +186,10 @@ "ManagedHsmKey", "ManagedHsmKeyAttributes", "ManagedHsmKeyCreateParameters", - "ManagedHsmKeyListResult", "ManagedHsmKeyProperties", "ManagedHsmKeyReleasePolicy", "ManagedHsmKeyRotationPolicyAttributes", "ManagedHsmLifetimeAction", - "ManagedHsmListResult", "ManagedHsmProperties", "ManagedHsmResource", "ManagedHsmRotationPolicy", @@ -208,29 +200,28 @@ "NetworkRuleSet", "Operation", "OperationDisplay", - "OperationListResult", + "OperationProperties", "Permissions", "PrivateEndpoint", "PrivateEndpointConnection", "PrivateEndpointConnectionItem", - "PrivateEndpointConnectionListResult", + "PrivateEndpointConnectionProperties", "PrivateLinkResource", "PrivateLinkResourceListResult", + "PrivateLinkResourceProperties", "PrivateLinkServiceConnectionState", - "ProxyResourceWithoutSystemData", - "Resource", - "ResourceListResult", + "ProxyResource", "RotationPolicy", "Secret", "SecretAttributes", "SecretCreateOrUpdateParameters", - "SecretListResult", "SecretPatchParameters", "SecretPatchProperties", "SecretProperties", "ServiceSpecification", "Sku", "SystemData", + "TrackedResource", "Trigger", "UserAssignedIdentity", "Vault", @@ -238,7 +229,6 @@ "VaultAccessPolicyProperties", "VaultCheckNameAvailabilityParameters", "VaultCreateOrUpdateParameters", - "VaultListResult", "VaultPatchParameters", "VaultPatchProperties", "VaultProperties", @@ -248,9 +238,9 @@ "ActivationStatus", "CertificatePermissions", "CreateMode", + "CreatedByType", "DeletionRecoveryLevel", "GeoReplicationRegionProvisioningState", - "IdentityType", "JsonWebKeyCurveName", "JsonWebKeyOperation", "JsonWebKeyType", diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_key_vault_management_client_enums.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_enums.py similarity index 92% rename from sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_key_vault_management_client_enums.py rename to sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_enums.py index 37c7908f43d1..8168f266dc3d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_key_vault_management_client_enums.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_enums.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -11,7 +11,7 @@ class AccessPolicyUpdateKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """AccessPolicyUpdateKind.""" + """Type of AccessPolicyUpdateKind.""" ADD = "add" REPLACE = "replace" @@ -38,7 +38,7 @@ class ActivationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): class CertificatePermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """CertificatePermissions.""" + """Type of CertificatePermissions.""" ALL = "all" GET = "get" @@ -57,7 +57,19 @@ class CertificatePermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): PURGE = "purge" BACKUP = "backup" RESTORE = "restore" - IMPORT_ENUM = "import" + + +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of entity that created the resource.""" + + USER = "User" + """The entity was created by a user.""" + APPLICATION = "Application" + """The entity was created by an application.""" + MANAGED_IDENTITY = "ManagedIdentity" + """The entity was created by a managed identity.""" + KEY = "Key" + """The entity was created by a key.""" class CreateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -90,15 +102,6 @@ class GeoReplicationRegionProvisioningState(str, Enum, metaclass=CaseInsensitive CLEANUP = "Cleanup" -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. Default for EC and EC-HSM keys is P-256. @@ -123,7 +126,6 @@ class JsonWebKeyOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): UNWRAP_KEY = "unwrapKey" IMPORT = "import" RELEASE = "release" - IMPORT_ENUM = "import" class JsonWebKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -136,7 +138,7 @@ class JsonWebKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class KeyPermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """KeyPermissions.""" + """Type of KeyPermissions.""" ALL = "all" ENCRYPT = "encrypt" @@ -159,7 +161,6 @@ class KeyPermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): ROTATE = "rotate" GETROTATIONPOLICY = "getrotationpolicy" SETROTATIONPOLICY = "setrotationpolicy" - IMPORT_ENUM = "import" class KeyRotationPolicyActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -192,9 +193,13 @@ class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ NONE = "None" + """No managed identity.""" SYSTEM_ASSIGNED = "SystemAssigned" + """System assigned managed identity.""" USER_ASSIGNED = "UserAssigned" + """User assigned managed identity.""" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" + """System and user assigned managed identity.""" class NetworkRuleAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -273,7 +278,7 @@ class Reason(str, Enum, metaclass=CaseInsensitiveEnumMeta): class SecretPermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """SecretPermissions.""" + """Type of SecretPermissions.""" ALL = "all" GET = "get" @@ -300,7 +305,7 @@ class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): class StoragePermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """StoragePermissions.""" + """Type of StoragePermissions.""" ALL = "all" GET = "get" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_models.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_models.py new file mode 100644 index 000000000000..ea4d57d105bd --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_models.py @@ -0,0 +1,4291 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=useless-super-delegation + +import datetime +from typing import Any, Literal, Mapping, Optional, TYPE_CHECKING, Union, overload + +from .._utils.model_base import Model as _Model, rest_field + +if TYPE_CHECKING: + from .. import models as _models + + +class AccessPolicyEntry(_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. + + :ivar tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + requests to the key vault. Required. + :vartype tenant_id: str + :ivar object_id: 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. Required. + :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: Permissions the identity has for keys, secrets and certificates. Required. + :vartype permissions: ~azure.mgmt.keyvault.models.Permissions + """ + + tenant_id: str = rest_field(name="tenantId", visibility=["read", "create", "update", "delete", "query"]) + """The Azure Active Directory tenant ID that should be used for authenticating requests to the key + vault. Required.""" + object_id: str = rest_field(name="objectId", visibility=["read", "create", "update", "delete", "query"]) + """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. Required.""" + application_id: Optional[str] = rest_field( + name="applicationId", visibility=["read", "create", "update", "delete", "query"] + ) + """Application ID of the client making request on behalf of a principal.""" + permissions: "_models.Permissions" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Permissions the identity has for keys, secrets and certificates. Required.""" + + @overload + def __init__( + self, + *, + tenant_id: str, + object_id: str, + permissions: "_models.Permissions", + application_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Action(_Model): + """Action. + + :ivar type: The type of action. Known values are: "rotate" and "notify". + :vartype type: str or ~azure.mgmt.keyvault.models.KeyRotationPolicyActionType + """ + + type: Optional[Union[str, "_models.KeyRotationPolicyActionType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The type of action. Known values are: \"rotate\" and \"notify\".""" + + @overload + def __init__( + self, + *, + type: Optional[Union[str, "_models.KeyRotationPolicyActionType"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ArmResource(_Model): + """Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.keyvault.models.SystemData + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or + \"Microsoft.Storage/storageAccounts\".""" + system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"]) + """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" + + +class Attributes(_Model): + """The object attributes managed by the KeyVault service. + + :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 + """ + + enabled: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Determines whether the object is enabled.""" + not_before: Optional[datetime.datetime] = rest_field( + name="nbf", visibility=["read", "create", "update", "delete", "query"], format="unix-timestamp" + ) + """Not before date in seconds since 1970-01-01T00:00:00Z.""" + expires: Optional[datetime.datetime] = rest_field( + name="exp", visibility=["read", "create", "update", "delete", "query"], format="unix-timestamp" + ) + """Expiry date in seconds since 1970-01-01T00:00:00Z.""" + created: Optional[datetime.datetime] = rest_field(visibility=["read"], format="unix-timestamp") + """Creation time in seconds since 1970-01-01T00:00:00Z.""" + updated: Optional[datetime.datetime] = rest_field(visibility=["read"], format="unix-timestamp") + """Last updated time in seconds since 1970-01-01T00:00:00Z.""" + + @overload + def __init__( + self, + *, + enabled: Optional[bool] = None, + not_before: Optional[datetime.datetime] = None, + expires: Optional[datetime.datetime] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CheckMhsmNameAvailabilityParameters(_Model): + """The parameters used to check the availability of the managed hsm name. + + :ivar name: The managed hsm name. Required. + :vartype name: str + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The managed hsm name. Required.""" + + @overload + def __init__( + self, + *, + name: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CheckMhsmNameAvailabilityResult(_Model): + """The CheckMhsmNameAvailability operation response. + + :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" and "AlreadyExists". + :vartype reason: str or ~azure.mgmt.keyvault.models.Reason + :ivar message: An error message explaining the Reason value in more detail. + :vartype message: str + """ + + name_available: Optional[bool] = rest_field(name="nameAvailable", visibility=["read"]) + """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.""" + reason: Optional[Union[str, "_models.Reason"]] = rest_field(visibility=["read"]) + """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\" and \"AlreadyExists\".""" + message: Optional[str] = rest_field(visibility=["read"]) + """An error message explaining the Reason value in more detail.""" + + +class CheckNameAvailabilityResult(_Model): + """The CheckNameAvailability operation response. + + :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" and "AlreadyExists". + :vartype reason: str or ~azure.mgmt.keyvault.models.Reason + :ivar message: An error message explaining the Reason value in more detail. + :vartype message: str + """ + + name_available: Optional[bool] = rest_field(name="nameAvailable", visibility=["read"]) + """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.""" + reason: Optional[Union[str, "_models.Reason"]] = rest_field(visibility=["read"]) + """The reason that a vault name could not be used. The Reason element is only returned if + NameAvailable is false. Known values are: \"AccountNameInvalid\" and \"AlreadyExists\".""" + message: Optional[str] = rest_field(visibility=["read"]) + """An error message explaining the Reason value in more detail.""" + + +class CloudError(_Model): + """An error response from Key Vault resource provider. + + :ivar error: An error response from Key Vault resource provider. + :vartype error: ~azure.mgmt.keyvault.models.CloudErrorBody + """ + + error: Optional["_models.CloudErrorBody"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """An error response from Key Vault resource provider.""" + + @overload + def __init__( + self, + *, + error: Optional["_models.CloudErrorBody"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CloudErrorBody(_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 + """ + + code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Error code. This is a mnemonic that can be consumed programmatically.""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """User friendly error message. The message is typically localized and may vary with service + version.""" + + @overload + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ProxyResource(ArmResource): + """Proxy Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.keyvault.models.SystemData + """ + + +class DeletedManagedHsm(ProxyResource): + """Concrete proxy resource types can be created by aliasing this type using a specific property + type. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.keyvault.models.SystemData + :ivar properties: Properties of the deleted managed HSM. + :vartype properties: ~azure.mgmt.keyvault.models.DeletedManagedHsmProperties + """ + + properties: Optional["_models.DeletedManagedHsmProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the deleted managed HSM.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.DeletedManagedHsmProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DeletedManagedHsmProperties(_Model): + """Properties of the deleted managed HSM. + + :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: Tags of the original managed HSM. + :vartype tags: dict[str, str] + """ + + mhsm_id: Optional[str] = rest_field(name="mhsmId", visibility=["read"]) + """The resource id of the original managed HSM.""" + location: Optional[str] = rest_field(visibility=["read"]) + """The location of the original managed HSM.""" + deletion_date: Optional[datetime.datetime] = rest_field(name="deletionDate", visibility=["read"], format="rfc3339") + """The deleted date.""" + scheduled_purge_date: Optional[datetime.datetime] = rest_field( + name="scheduledPurgeDate", visibility=["read"], format="rfc3339" + ) + """The scheduled purged date.""" + purge_protection_enabled: Optional[bool] = rest_field(name="purgeProtectionEnabled", visibility=["read"]) + """Purge protection status of the original managed HSM.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read"]) + """Tags of the original managed HSM.""" + + +class DeletedVault(ProxyResource): + """Deleted vault information with extended details. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.keyvault.models.SystemData + :ivar properties: Properties of the vault. + :vartype properties: ~azure.mgmt.keyvault.models.DeletedVaultProperties + """ + + properties: Optional["_models.DeletedVaultProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the vault.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.DeletedVaultProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DeletedVaultProperties(_Model): + """Properties of the deleted vault. + + :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: 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 + """ + + vault_id: Optional[str] = rest_field(name="vaultId", visibility=["read"]) + """The resource id of the original vault.""" + location: Optional[str] = rest_field(visibility=["read"]) + """The location of the original vault.""" + deletion_date: Optional[datetime.datetime] = rest_field(name="deletionDate", visibility=["read"], format="rfc3339") + """The deleted date.""" + scheduled_purge_date: Optional[datetime.datetime] = rest_field( + name="scheduledPurgeDate", visibility=["read"], format="rfc3339" + ) + """The scheduled purged date.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read"]) + """Tags of the original vault.""" + purge_protection_enabled: Optional[bool] = rest_field(name="purgeProtectionEnabled", visibility=["read"]) + """Purge protection status of the original vault.""" + + +class DimensionProperties(_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 + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of dimension.""" + display_name: Optional[str] = rest_field( + name="displayName", visibility=["read", "create", "update", "delete", "query"] + ) + """Display name of dimension.""" + to_be_exported_for_shoebox: Optional[bool] = rest_field( + name="toBeExportedForShoebox", visibility=["read", "create", "update", "delete", "query"] + ) + """Property to specify whether the dimension should be exported for Shoebox.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + to_be_exported_for_shoebox: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Error(_Model): + """The server error. + + :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.models.Error + """ + + code: Optional[str] = rest_field(visibility=["read"]) + """The error code.""" + message: Optional[str] = rest_field(visibility=["read"]) + """The error message.""" + inner_error: Optional["_models.Error"] = rest_field(name="innererror", visibility=["read"]) + """The inner error, contains a more specific error code.""" + + +class IPRule(_Model): + """A rule governing the accessibility of a vault from a specific ip address or ip range. + + :ivar value: 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). Required. + :vartype value: str + """ + + value: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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). Required.""" + + @overload + def __init__( + self, + *, + value: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Key(ProxyResource): + """The key resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.keyvault.models.SystemData + :ivar properties: The properties of the key. Required. + :vartype properties: ~azure.mgmt.keyvault.models.KeyProperties + :ivar location: The supported Azure location where the managed HSM Pool should be created. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + properties: "_models.KeyProperties" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The properties of the key. Required.""" + location: Optional[str] = rest_field(visibility=["read"]) + """The supported Azure location where the managed HSM Pool should be created.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read"]) + """Resource tags.""" + + __flattened_items = [ + "attributes", + "kty", + "key_ops", + "key_size", + "curve_name", + "key_uri", + "key_uri_with_version", + "rotation_policy", + "release_policy", + ] + + @overload + def __init__( + self, + *, + properties: "_models.KeyProperties", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class KeyAttributes(_Model): + """The object attributes managed by the Azure Key Vault service. + + :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: int + :ivar expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :vartype expires: int + :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. + :vartype created: int + :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. + :vartype updated: int + :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", and + "Recoverable+ProtectedSubscription". + :vartype recovery_level: str or ~azure.mgmt.keyvault.models.DeletionRecoveryLevel + :ivar exportable: Indicates if the private key can be exported. + :vartype exportable: bool + """ + + enabled: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Determines whether or not the object is enabled.""" + not_before: Optional[int] = rest_field(name="nbf", visibility=["read", "create", "update", "delete", "query"]) + """Not before date in seconds since 1970-01-01T00:00:00Z.""" + expires: Optional[int] = rest_field(name="exp", visibility=["read", "create", "update", "delete", "query"]) + """Expiry date in seconds since 1970-01-01T00:00:00Z.""" + created: Optional[int] = rest_field(visibility=["read"]) + """Creation time in seconds since 1970-01-01T00:00:00Z.""" + updated: Optional[int] = rest_field(visibility=["read"]) + """Last updated time in seconds since 1970-01-01T00:00:00Z.""" + recovery_level: Optional[Union[str, "_models.DeletionRecoveryLevel"]] = rest_field( + name="recoveryLevel", visibility=["read"] + ) + """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\", and \"Recoverable+ProtectedSubscription\".""" + exportable: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Indicates if the private key can be exported.""" + + @overload + def __init__( + self, + *, + enabled: Optional[bool] = None, + not_before: Optional[int] = None, + expires: Optional[int] = None, + exportable: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class KeyCreateParameters(_Model): + """The parameters used to create a key. + + :ivar tags: The tags that will be assigned to the key. + :vartype tags: dict[str, str] + :ivar properties: The properties of the key to be created. Required. + :vartype properties: ~azure.mgmt.keyvault.models.KeyProperties + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The tags that will be assigned to the key.""" + properties: "_models.KeyProperties" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The properties of the key to be created. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.KeyProperties", + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class KeyProperties(_Model): + """The properties of the key. + + :ivar attributes: The attributes of the key. + :vartype attributes: ~azure.mgmt.keyvault.models.KeyAttributes + :ivar kty: The type of the key. For valid values, see JsonWebKeyType. Known values are: "EC", + "EC-HSM", "RSA", and "RSA-HSM". + :vartype kty: str or ~azure.mgmt.keyvault.models.JsonWebKeyType + :ivar key_ops: + :vartype key_ops: list[str or ~azure.mgmt.keyvault.models.JsonWebKeyOperation] + :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. Default for RSA + and RSA-HSM keys is 2048. Exception made for bring your own key (BYOK), key exchange keys + default to 4096. + :vartype key_size: int + :ivar curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Default + for EC and EC-HSM keys is P-256. Known values are: "P-256", "P-384", "P-521", and "P-256K". + :vartype curve_name: str or ~azure.mgmt.keyvault.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.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.models.KeyReleasePolicy + """ + + attributes: Optional["_models.KeyAttributes"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The attributes of the key.""" + kty: Optional[Union[str, "_models.JsonWebKeyType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The type of the key. For valid values, see JsonWebKeyType. Known values are: \"EC\", + \"EC-HSM\", \"RSA\", and \"RSA-HSM\".""" + key_ops: Optional[list[Union[str, "_models.JsonWebKeyOperation"]]] = rest_field( + name="keyOps", visibility=["read", "create", "update", "delete", "query"] + ) + key_size: Optional[int] = rest_field(name="keySize", visibility=["read", "create", "update", "delete", "query"]) + """The key size in bits. For example: 2048, 3072, or 4096 for RSA. Default for RSA and RSA-HSM + keys is 2048. Exception made for bring your own key (BYOK), key exchange keys default to 4096.""" + curve_name: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = rest_field( + name="curveName", visibility=["read", "create", "update", "delete", "query"] + ) + """The elliptic curve name. For valid values, see JsonWebKeyCurveName. Default for EC and EC-HSM + keys is P-256. Known values are: \"P-256\", \"P-384\", \"P-521\", and \"P-256K\".""" + key_uri: Optional[str] = rest_field(name="keyUri", visibility=["read"]) + """The URI to retrieve the current version of the key.""" + key_uri_with_version: Optional[str] = rest_field(name="keyUriWithVersion", visibility=["read"]) + """The URI to retrieve the specific version of the key.""" + rotation_policy: Optional["_models.RotationPolicy"] = rest_field( + name="rotationPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Key rotation policy in response. It will be used for both output and input. Omitted if empty.""" + release_policy: Optional["_models.KeyReleasePolicy"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Key release policy in response. It will be used for both output and input. Omitted if empty.""" + + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class KeyReleasePolicy(_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 + """ + + content_type: Optional[str] = rest_field( + name="contentType", visibility=["read", "create", "update", "delete", "query"] + ) + """Content type and version of key release policy.""" + data: Optional[bytes] = rest_field(visibility=["read", "create", "update", "delete", "query"], format="base64url") + """Blob encoding the policy rules under which the key can be released.""" + + @overload + def __init__( + self, + *, + content_type: Optional[str] = None, + data: Optional[bytes] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class KeyRotationPolicyAttributes(_Model): + """KeyRotationPolicyAttributes. + + :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. + :vartype created: int + :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. + :vartype updated: int + :ivar expiry_time: The expiration time for the new key version. It should be in ISO8601 format. + Eg: 'P90D', 'P1Y'. + :vartype expiry_time: str + """ + + created: Optional[int] = rest_field(visibility=["read"]) + """Creation time in seconds since 1970-01-01T00:00:00Z.""" + updated: Optional[int] = rest_field(visibility=["read"]) + """Last updated time in seconds since 1970-01-01T00:00:00Z.""" + expiry_time: Optional[str] = rest_field( + name="expiryTime", visibility=["read", "create", "update", "delete", "query"] + ) + """The expiration time for the new key version. It should be in ISO8601 format. Eg: 'P90D', 'P1Y'.""" + + @overload + def __init__( + self, + *, + expiry_time: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class LifetimeAction(_Model): + """LifetimeAction. + + :ivar trigger: The trigger of key rotation policy lifetimeAction. + :vartype trigger: ~azure.mgmt.keyvault.models.Trigger + :ivar action: The action of key rotation policy lifetimeAction. + :vartype action: ~azure.mgmt.keyvault.models.Action + """ + + trigger: Optional["_models.Trigger"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The trigger of key rotation policy lifetimeAction.""" + action: Optional["_models.Action"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The action of key rotation policy lifetimeAction.""" + + @overload + def __init__( + self, + *, + trigger: Optional["_models.Trigger"] = None, + action: Optional["_models.Action"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class LogSpecification(_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 + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of log specification.""" + display_name: Optional[str] = rest_field( + name="displayName", visibility=["read", "create", "update", "delete", "query"] + ) + """Display name of log specification.""" + blob_duration: Optional[str] = rest_field( + name="blobDuration", visibility=["read", "create", "update", "delete", "query"] + ) + """Blob duration of specification.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + blob_duration: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ManagedHsm(ArmResource): + """Resource information with extended details. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.keyvault.models.SystemData + :ivar properties: Properties of the managed HSM. + :vartype properties: ~azure.mgmt.keyvault.models.ManagedHsmProperties + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar sku: SKU details. + :vartype sku: ~azure.mgmt.keyvault.models.ManagedHsmSku + :ivar identity: Managed service identity. + :vartype identity: ~azure.mgmt.keyvault.models.ManagedServiceIdentity + """ + + properties: Optional["_models.ManagedHsmProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the managed HSM.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + location: Optional[str] = rest_field(visibility=["read", "create"]) + """The geo-location where the resource lives.""" + sku: Optional["_models.ManagedHsmSku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """SKU details.""" + identity: Optional["_models.ManagedServiceIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Managed service identity.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.ManagedHsmProperties"] = None, + tags: Optional[dict[str, str]] = None, + location: Optional[str] = None, + sku: Optional["_models.ManagedHsmSku"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ManagedHsmAction(_Model): + """ManagedHsmAction. + + :ivar type: The type of action. Known values are: "rotate" and "notify". + :vartype type: str or ~azure.mgmt.keyvault.models.KeyRotationPolicyActionType + """ + + type: Optional[Union[str, "_models.KeyRotationPolicyActionType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The type of action. Known values are: \"rotate\" and \"notify\".""" + + @overload + def __init__( + self, + *, + type: Optional[Union[str, "_models.KeyRotationPolicyActionType"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ManagedHsmError(_Model): + """The error exception. + + :ivar error: The server error. + :vartype error: ~azure.mgmt.keyvault.models.Error + """ + + error: Optional["_models.Error"] = rest_field(visibility=["read"]) + """The server error.""" + + +class ManagedHsmKey(ProxyResource): + """The key resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.keyvault.models.SystemData + :ivar properties: The properties of the key. Required. + :vartype properties: ~azure.mgmt.keyvault.models.ManagedHsmKeyProperties + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + properties: "_models.ManagedHsmKeyProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of the key. Required.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update"]) + """Resource tags.""" + + __flattened_items = [ + "attributes", + "kty", + "key_ops", + "key_size", + "curve_name", + "key_uri", + "key_uri_with_version", + "rotation_policy", + "release_policy", + ] + + @overload + def __init__( + self, + *, + properties: "_models.ManagedHsmKeyProperties", + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class ManagedHsmKeyAttributes(_Model): + """The object attributes managed by the Azure Key Vault service. + + :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: int + :ivar expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :vartype expires: int + :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. + :vartype created: int + :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. + :vartype updated: int + :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", and + "Recoverable+ProtectedSubscription". + :vartype recovery_level: str or ~azure.mgmt.keyvault.models.DeletionRecoveryLevel + :ivar exportable: Indicates if the private key can be exported. + :vartype exportable: bool + """ + + enabled: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Determines whether or not the object is enabled.""" + not_before: Optional[int] = rest_field(name="nbf", visibility=["read", "create", "update", "delete", "query"]) + """Not before date in seconds since 1970-01-01T00:00:00Z.""" + expires: Optional[int] = rest_field(name="exp", visibility=["read", "create", "update", "delete", "query"]) + """Expiry date in seconds since 1970-01-01T00:00:00Z.""" + created: Optional[int] = rest_field(visibility=["read"]) + """Creation time in seconds since 1970-01-01T00:00:00Z.""" + updated: Optional[int] = rest_field(visibility=["read"]) + """Last updated time in seconds since 1970-01-01T00:00:00Z.""" + recovery_level: Optional[Union[str, "_models.DeletionRecoveryLevel"]] = rest_field( + name="recoveryLevel", visibility=["read"] + ) + """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\", and \"Recoverable+ProtectedSubscription\".""" + exportable: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Indicates if the private key can be exported.""" + + @overload + def __init__( + self, + *, + enabled: Optional[bool] = None, + not_before: Optional[int] = None, + expires: Optional[int] = None, + exportable: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ManagedHsmKeyCreateParameters(_Model): + """The parameters used to create a key. + + :ivar tags: The tags that will be assigned to the key. + :vartype tags: dict[str, str] + :ivar properties: The properties of the key to be created. Required. + :vartype properties: ~azure.mgmt.keyvault.models.ManagedHsmKeyProperties + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The tags that will be assigned to the key.""" + properties: "_models.ManagedHsmKeyProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of the key to be created. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.ManagedHsmKeyProperties", + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ManagedHsmKeyProperties(_Model): + """The properties of the key. + + :ivar attributes: The attributes of the key. + :vartype attributes: ~azure.mgmt.keyvault.models.ManagedHsmKeyAttributes + :ivar kty: The type of the key. For valid values, see JsonWebKeyType. Known values are: "EC", + "EC-HSM", "RSA", and "RSA-HSM". + :vartype kty: str or ~azure.mgmt.keyvault.models.JsonWebKeyType + :ivar key_ops: + :vartype key_ops: list[str or ~azure.mgmt.keyvault.models.JsonWebKeyOperation] + :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. Default for RSA + and RSA-HSM keys is 2048. Exception made for bring your own key (BYOK), key exchange keys + default to 4096. + :vartype key_size: int + :ivar curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Default + for EC and EC-HSM keys is P-256. Known values are: "P-256", "P-384", "P-521", and "P-256K". + :vartype curve_name: str or ~azure.mgmt.keyvault.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.models.ManagedHsmRotationPolicy + :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.models.ManagedHsmKeyReleasePolicy + """ + + attributes: Optional["_models.ManagedHsmKeyAttributes"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The attributes of the key.""" + kty: Optional[Union[str, "_models.JsonWebKeyType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The type of the key. For valid values, see JsonWebKeyType. Known values are: \"EC\", + \"EC-HSM\", \"RSA\", and \"RSA-HSM\".""" + key_ops: Optional[list[Union[str, "_models.JsonWebKeyOperation"]]] = rest_field( + name="keyOps", visibility=["read", "create", "update", "delete", "query"] + ) + key_size: Optional[int] = rest_field(name="keySize", visibility=["read", "create", "update", "delete", "query"]) + """The key size in bits. For example: 2048, 3072, or 4096 for RSA. Default for RSA and RSA-HSM + keys is 2048. Exception made for bring your own key (BYOK), key exchange keys default to 4096.""" + curve_name: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = rest_field( + name="curveName", visibility=["read", "create", "update", "delete", "query"] + ) + """The elliptic curve name. For valid values, see JsonWebKeyCurveName. Default for EC and EC-HSM + keys is P-256. Known values are: \"P-256\", \"P-384\", \"P-521\", and \"P-256K\".""" + key_uri: Optional[str] = rest_field(name="keyUri", visibility=["read"]) + """The URI to retrieve the current version of the key.""" + key_uri_with_version: Optional[str] = rest_field(name="keyUriWithVersion", visibility=["read"]) + """The URI to retrieve the specific version of the key.""" + rotation_policy: Optional["_models.ManagedHsmRotationPolicy"] = rest_field( + name="rotationPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Key rotation policy in response. It will be used for both output and input. Omitted if empty.""" + release_policy: Optional["_models.ManagedHsmKeyReleasePolicy"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Key release policy in response. It will be used for both output and input. Omitted if empty.""" + + @overload + def __init__( + self, + *, + attributes: Optional["_models.ManagedHsmKeyAttributes"] = 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.ManagedHsmRotationPolicy"] = None, + release_policy: Optional["_models.ManagedHsmKeyReleasePolicy"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ManagedHsmKeyReleasePolicy(_Model): + """ManagedHsmKeyReleasePolicy. + + :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 + """ + + content_type: Optional[str] = rest_field( + name="contentType", visibility=["read", "create", "update", "delete", "query"] + ) + """Content type and version of key release policy.""" + data: Optional[bytes] = rest_field(visibility=["read", "create", "update", "delete", "query"], format="base64url") + """Blob encoding the policy rules under which the key can be released.""" + + @overload + def __init__( + self, + *, + content_type: Optional[str] = None, + data: Optional[bytes] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ManagedHsmKeyRotationPolicyAttributes(_Model): + """ManagedHsmKeyRotationPolicyAttributes. + + :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. + :vartype created: int + :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. + :vartype updated: int + :ivar expiry_time: The expiration time for the new key version. It should be in ISO8601 format. + Eg: 'P90D', 'P1Y'. + :vartype expiry_time: str + """ + + created: Optional[int] = rest_field(visibility=["read"]) + """Creation time in seconds since 1970-01-01T00:00:00Z.""" + updated: Optional[int] = rest_field(visibility=["read"]) + """Last updated time in seconds since 1970-01-01T00:00:00Z.""" + expiry_time: Optional[str] = rest_field( + name="expiryTime", visibility=["read", "create", "update", "delete", "query"] + ) + """The expiration time for the new key version. It should be in ISO8601 format. Eg: 'P90D', 'P1Y'.""" + + @overload + def __init__( + self, + *, + expiry_time: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ManagedHsmLifetimeAction(_Model): + """ManagedHsmLifetimeAction. + + :ivar trigger: The trigger of key rotation policy lifetimeAction. + :vartype trigger: ~azure.mgmt.keyvault.models.ManagedHsmTrigger + :ivar action: The action of key rotation policy lifetimeAction. + :vartype action: ~azure.mgmt.keyvault.models.ManagedHsmAction + """ + + trigger: Optional["_models.ManagedHsmTrigger"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The trigger of key rotation policy lifetimeAction.""" + action: Optional["_models.ManagedHsmAction"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The action of key rotation policy lifetimeAction.""" + + @overload + def __init__( + self, + *, + trigger: Optional["_models.ManagedHsmTrigger"] = None, + action: Optional["_models.ManagedHsmAction"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ManagedHsmProperties(_Model): + """Properties of the managed HSM Pool. + + :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. Soft delete is enabled by default for all managed HSMs and + is immutable. + :vartype enable_soft_delete: bool + :ivar soft_delete_retention_in_days: Soft deleted data retention days. When you delete an HSM + or a key, it will remain recoverable for the configured retention period or for a default + period of 90 days. It accepts values between 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. 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" and "default". + :vartype create_mode: str or ~azure.mgmt.keyvault.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", and "Restoring". + :vartype provisioning_state: str or ~azure.mgmt.keyvault.models.ProvisioningState + :ivar network_acls: Rules governing the accessibility of the key vault from specific network + locations. + :vartype network_acls: ~azure.mgmt.keyvault.models.MHSMNetworkRuleSet + :ivar regions: List of all regions associated with the managed hsm pool. + :vartype regions: list[~azure.mgmt.keyvault.models.MHSMGeoReplicatedRegion] + :ivar private_endpoint_connections: List of private endpoint connections associated with the + managed hsm pool. + :vartype private_endpoint_connections: + list[~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnectionItem] + :ivar public_network_access: Control permission to the managed HSM from public networks. Known + values are: "Enabled" and "Disabled". + :vartype public_network_access: str or ~azure.mgmt.keyvault.models.PublicNetworkAccess + :ivar scheduled_purge_date: The scheduled purge date in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar security_domain_properties: Managed HSM security domain properties. + :vartype security_domain_properties: + ~azure.mgmt.keyvault.models.ManagedHSMSecurityDomainProperties + """ + + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read", "create", "update", "delete", "query"]) + """The Azure Active Directory tenant ID that should be used for authenticating requests to the + managed HSM pool.""" + initial_admin_object_ids: Optional[list[str]] = rest_field( + name="initialAdminObjectIds", visibility=["read", "create", "update", "delete", "query"] + ) + """Array of initial administrators object ids for this managed hsm pool.""" + hsm_uri: Optional[str] = rest_field(name="hsmUri", visibility=["read"]) + """The URI of the managed hsm pool for performing operations on keys.""" + enable_soft_delete: Optional[bool] = rest_field( + name="enableSoftDelete", visibility=["read", "create", "update", "delete", "query"] + ) + """Property to specify whether the 'soft delete' functionality is enabled for this managed HSM + pool. Soft delete is enabled by default for all managed HSMs and is immutable.""" + soft_delete_retention_in_days: Optional[int] = rest_field( + name="softDeleteRetentionInDays", visibility=["read", "create", "update", "delete", "query"] + ) + """Soft deleted data retention days. When you delete an HSM or a key, it will remain recoverable + for the configured retention period or for a default period of 90 days. It accepts values + between 7 and 90.""" + enable_purge_protection: Optional[bool] = rest_field( + name="enablePurgeProtection", visibility=["read", "create", "update", "delete", "query"] + ) + """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. + Enabling this functionality is irreversible.""" + create_mode: Optional[Union[str, "_models.CreateMode"]] = rest_field( + name="createMode", visibility=["create", "update"] + ) + """The create mode to indicate whether the resource is being created or is being recovered from a + deleted resource. Known values are: \"recover\" and \"default\".""" + status_message: Optional[str] = rest_field(name="statusMessage", visibility=["read"]) + """Resource Status Message.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning state. Known values are: \"Succeeded\", \"Provisioning\", \"Failed\", + \"Updating\", \"Deleting\", \"Activated\", \"SecurityDomainRestore\", and \"Restoring\".""" + network_acls: Optional["_models.MHSMNetworkRuleSet"] = rest_field( + name="networkAcls", visibility=["read", "create", "update", "delete", "query"] + ) + """Rules governing the accessibility of the key vault from specific network locations.""" + regions: Optional[list["_models.MHSMGeoReplicatedRegion"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """List of all regions associated with the managed hsm pool.""" + private_endpoint_connections: Optional[list["_models.MHSMPrivateEndpointConnectionItem"]] = rest_field( + name="privateEndpointConnections", visibility=["read"] + ) + """List of private endpoint connections associated with the managed hsm pool.""" + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = rest_field( + name="publicNetworkAccess", visibility=["read", "create", "update", "delete", "query"] + ) + """Control permission to the managed HSM from public networks. Known values are: \"Enabled\" and + \"Disabled\".""" + scheduled_purge_date: Optional[datetime.datetime] = rest_field( + name="scheduledPurgeDate", visibility=["read"], format="rfc3339" + ) + """The scheduled purge date in UTC.""" + security_domain_properties: Optional["_models.ManagedHSMSecurityDomainProperties"] = rest_field( + name="securityDomainProperties", visibility=["read"] + ) + """Managed HSM security domain properties.""" + + @overload + def __init__( + self, + *, + tenant_id: Optional[str] = None, + initial_admin_object_ids: Optional[list[str]] = None, + enable_soft_delete: Optional[bool] = None, + soft_delete_retention_in_days: Optional[int] = None, + enable_purge_protection: Optional[bool] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, + network_acls: Optional["_models.MHSMNetworkRuleSet"] = None, + regions: Optional[list["_models.MHSMGeoReplicatedRegion"]] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ManagedHsmResource(_Model): + """Managed HSM resource. + + :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.models.ManagedHsmSku + :ivar 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.models.SystemData + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.keyvault.models.ManagedServiceIdentity + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """The Azure Resource Manager resource ID for the managed HSM Pool.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the managed HSM Pool.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The resource type of the managed HSM Pool.""" + location: Optional[str] = rest_field(visibility=["read", "create"]) + """The supported Azure location where the managed HSM Pool should be created.""" + sku: Optional["_models.ManagedHsmSku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """SKU details.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"]) + """Metadata pertaining to creation and last modification of the key vault resource.""" + identity: Optional["_models.ManagedServiceIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Managed service identity (system assigned and/or user assigned identities).""" + + @overload + def __init__( + self, + *, + location: Optional[str] = None, + sku: Optional["_models.ManagedHsmSku"] = None, + tags: Optional[dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ManagedHsmRotationPolicy(_Model): + """ManagedHsmRotationPolicy. + + :ivar attributes: The attributes of key rotation policy. + :vartype attributes: ~azure.mgmt.keyvault.models.ManagedHsmKeyRotationPolicyAttributes + :ivar lifetime_actions: The lifetimeActions for key rotation action. + :vartype lifetime_actions: list[~azure.mgmt.keyvault.models.ManagedHsmLifetimeAction] + """ + + attributes: Optional["_models.ManagedHsmKeyRotationPolicyAttributes"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The attributes of key rotation policy.""" + lifetime_actions: Optional[list["_models.ManagedHsmLifetimeAction"]] = rest_field( + name="lifetimeActions", visibility=["read", "create", "update", "delete", "query"] + ) + """The lifetimeActions for key rotation action.""" + + @overload + def __init__( + self, + *, + attributes: Optional["_models.ManagedHsmKeyRotationPolicyAttributes"] = None, + lifetime_actions: Optional[list["_models.ManagedHsmLifetimeAction"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ManagedHSMSecurityDomainProperties(_Model): + """The security domain properties of the managed hsm. + + :ivar activation_status: Activation Status. Known values are: "Active", "NotActivated", + "Unknown", and "Failed". + :vartype activation_status: str or ~azure.mgmt.keyvault.models.ActivationStatus + :ivar activation_status_message: Activation Status Message. + :vartype activation_status_message: str + """ + + activation_status: Optional[Union[str, "_models.ActivationStatus"]] = rest_field( + name="activationStatus", visibility=["read"] + ) + """Activation Status. Known values are: \"Active\", \"NotActivated\", \"Unknown\", and \"Failed\".""" + activation_status_message: Optional[str] = rest_field(name="activationStatusMessage", visibility=["read"]) + """Activation Status Message.""" + + +class ManagedHsmSku(_Model): + """SKU details. + + :ivar family: SKU Family of the managed HSM Pool. Required. Known values are: "B" and "C". + :vartype family: str or ~azure.mgmt.keyvault.models.ManagedHsmSkuFamily + :ivar name: SKU of the managed HSM Pool. Required. Known values are: "Standard_B1", + "Custom_B32", "Custom_B6", "Custom_C42", and "Custom_C10". + :vartype name: str or ~azure.mgmt.keyvault.models.ManagedHsmSkuName + """ + + family: Union[str, "_models.ManagedHsmSkuFamily"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """SKU Family of the managed HSM Pool. Required. Known values are: \"B\" and \"C\".""" + name: Union[str, "_models.ManagedHsmSkuName"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """SKU of the managed HSM Pool. Required. Known values are: \"Standard_B1\", \"Custom_B32\", + \"Custom_B6\", \"Custom_C42\", and \"Custom_C10\".""" + + @overload + def __init__( + self, + *, + family: Union[str, "_models.ManagedHsmSkuFamily"], + name: Union[str, "_models.ManagedHsmSkuName"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ManagedHsmTrigger(_Model): + """ManagedHsmTrigger. + + :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 + """ + + time_after_create: Optional[str] = rest_field( + name="timeAfterCreate", visibility=["read", "create", "update", "delete", "query"] + ) + """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'.""" + time_before_expiry: Optional[str] = rest_field( + name="timeBeforeExpiry", visibility=["read", "create", "update", "delete", "query"] + ) + """The time duration before key expiring to rotate or notify. It will be in ISO 8601 duration + format. Eg: 'P90D', 'P1Y'.""" + + @overload + def __init__( + self, + *, + time_after_create: Optional[str] = None, + time_before_expiry: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ManagedServiceIdentity(_Model): + """Managed service identity (system assigned and/or user assigned identities). + + :ivar principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: The type of managed identity assigned to this resource. Required. Known values are: + "None", "SystemAssigned", "UserAssigned", and "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.keyvault.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The identities assigned to this resource by the user. + :vartype user_assigned_identities: dict[str, ~azure.mgmt.keyvault.models.UserAssignedIdentity] + """ + + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The service principal ID of the system assigned identity. This property will only be provided + for a system assigned identity.""" + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"]) + """The tenant ID of the system assigned identity. This property will only be provided for a system + assigned identity.""" + type: Union[str, "_models.ManagedServiceIdentityType"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The type of managed identity assigned to this resource. Required. Known values are: \"None\", + \"SystemAssigned\", \"UserAssigned\", and \"SystemAssigned,UserAssigned\".""" + user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentity"]] = rest_field( + name="userAssignedIdentities", visibility=["read", "create", "update", "delete", "query"] + ) + """The identities assigned to this resource by the user.""" + + @overload + def __init__( + self, + *, + type: Union[str, "_models.ManagedServiceIdentityType"], + user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentity"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MetricSpecification(_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.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 + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of metric specification.""" + display_name: Optional[str] = rest_field( + name="displayName", visibility=["read", "create", "update", "delete", "query"] + ) + """Display name of metric specification.""" + display_description: Optional[str] = rest_field( + name="displayDescription", visibility=["read", "create", "update", "delete", "query"] + ) + """Display description of metric specification.""" + unit: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'.""" + aggregation_type: Optional[str] = rest_field( + name="aggregationType", visibility=["read", "create", "update", "delete", "query"] + ) + """The metric aggregation type. Possible values include: 'Average', 'Count', 'Total'.""" + supported_aggregation_types: Optional[list[str]] = rest_field( + name="supportedAggregationTypes", visibility=["read", "create", "update", "delete", "query"] + ) + """The supported aggregation types for the metrics.""" + supported_time_grain_types: Optional[list[str]] = rest_field( + name="supportedTimeGrainTypes", visibility=["read", "create", "update", "delete", "query"] + ) + """The supported time grain types for the metrics.""" + lock_aggregation_type: Optional[str] = rest_field( + name="lockAggregationType", visibility=["read", "create", "update", "delete", "query"] + ) + """The metric lock aggregation type.""" + dimensions: Optional[list["_models.DimensionProperties"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The dimensions of metric.""" + fill_gap_with_zero: Optional[bool] = rest_field( + name="fillGapWithZero", visibility=["read", "create", "update", "delete", "query"] + ) + """Property to specify whether to fill gap with zero.""" + internal_metric_name: Optional[str] = rest_field( + name="internalMetricName", visibility=["read", "create", "update", "delete", "query"] + ) + """The internal metric name.""" + + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MHSMGeoReplicatedRegion(_Model): + """A region that this managed HSM Pool has been extended to. + + :ivar name: Name of the geo replicated region. + :vartype name: str + :ivar provisioning_state: Provisioning state of the geo replicated region. Known values are: + "Preprovisioning", "Provisioning", "Succeeded", "Failed", "Deleting", and "Cleanup". + :vartype provisioning_state: str or + ~azure.mgmt.keyvault.models.GeoReplicationRegionProvisioningState + :ivar is_primary: A boolean value that indicates whether the region is the primary region or a + secondary region. + :vartype is_primary: bool + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the geo replicated region.""" + provisioning_state: Optional[Union[str, "_models.GeoReplicationRegionProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning state of the geo replicated region. Known values are: \"Preprovisioning\", + \"Provisioning\", \"Succeeded\", \"Failed\", \"Deleting\", and \"Cleanup\".""" + is_primary: Optional[bool] = rest_field( + name="isPrimary", visibility=["read", "create", "update", "delete", "query"] + ) + """A boolean value that indicates whether the region is the primary region or a secondary region.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + is_primary: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MHSMIPRule(_Model): + """A rule governing the accessibility of a managed HSM pool from a specific IP address or IP + range. + + :ivar value: 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). Required. + :vartype value: str + """ + + value: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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). Required.""" + + @overload + def __init__( + self, + *, + value: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MHSMNetworkRuleSet(_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" and + "None". + :vartype bypass: str or ~azure.mgmt.keyvault.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" and "Deny". + :vartype default_action: str or ~azure.mgmt.keyvault.models.NetworkRuleAction + :ivar ip_rules: The list of IP address rules. + :vartype ip_rules: list[~azure.mgmt.keyvault.models.MHSMIPRule] + :ivar service_tags: The list of service tags. + :vartype service_tags: list[~azure.mgmt.keyvault.models.MHSMServiceTagRule] + :ivar virtual_network_rules: The list of virtual network rules. + :vartype virtual_network_rules: list[~azure.mgmt.keyvault.models.MHSMVirtualNetworkRule] + """ + + bypass: Optional[Union[str, "_models.NetworkRuleBypassOptions"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not + specified the default is 'AzureServices'. Known values are: \"AzureServices\" and \"None\".""" + default_action: Optional[Union[str, "_models.NetworkRuleAction"]] = rest_field( + name="defaultAction", visibility=["read", "create", "update", "delete", "query"] + ) + """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\" and \"Deny\".""" + ip_rules: Optional[list["_models.MHSMIPRule"]] = rest_field( + name="ipRules", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of IP address rules.""" + service_tags: Optional[list["_models.MHSMServiceTagRule"]] = rest_field( + name="serviceTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of service tags.""" + virtual_network_rules: Optional[list["_models.MHSMVirtualNetworkRule"]] = rest_field( + name="virtualNetworkRules", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of virtual network rules.""" + + @overload + 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, + service_tags: Optional[list["_models.MHSMServiceTagRule"]] = None, + virtual_network_rules: Optional[list["_models.MHSMVirtualNetworkRule"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MHSMPrivateEndpoint(_Model): + """Private endpoint object properties. + + :ivar id: Full identifier of the private endpoint resource. + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Full identifier of the private endpoint resource.""" + + +class MHSMPrivateEndpointConnection(ArmResource): + """Private endpoint connection resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.keyvault.models.SystemData + :ivar properties: Resource properties. + :vartype properties: ~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnectionProperties + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar sku: SKU details. + :vartype sku: ~azure.mgmt.keyvault.models.ManagedHsmSku + :ivar identity: Managed service identity. + :vartype identity: ~azure.mgmt.keyvault.models.ManagedServiceIdentity + :ivar etag: Modified whenever there is a change in the state of private endpoint connection. + :vartype etag: str + """ + + properties: Optional["_models.MHSMPrivateEndpointConnectionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Resource properties.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + location: Optional[str] = rest_field(visibility=["read", "create"]) + """The geo-location where the resource lives.""" + sku: Optional["_models.ManagedHsmSku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """SKU details.""" + identity: Optional["_models.ManagedServiceIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Managed service identity.""" + etag: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Modified whenever there is a change in the state of private endpoint connection.""" + + __flattened_items = ["private_endpoint", "private_link_service_connection_state", "provisioning_state"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.MHSMPrivateEndpointConnectionProperties"] = None, + tags: Optional[dict[str, str]] = None, + location: Optional[str] = None, + sku: Optional["_models.ManagedHsmSku"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + etag: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class MHSMPrivateEndpointConnectionItem(_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 properties: Private endpoint connection properties. + :vartype properties: ~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnectionProperties + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Id of private endpoint connection.""" + etag: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Modified whenever there is a change in the state of private endpoint connection.""" + properties: Optional["_models.MHSMPrivateEndpointConnectionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Private endpoint connection properties.""" + + __flattened_items = ["private_endpoint", "private_link_service_connection_state", "provisioning_state"] + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + etag: Optional[str] = None, + properties: Optional["_models.MHSMPrivateEndpointConnectionProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class MHSMPrivateEndpointConnectionProperties(_Model): + """Properties of the private endpoint connection resource. + + :ivar private_endpoint: Properties of the private endpoint object. + :vartype private_endpoint: ~azure.mgmt.keyvault.models.MHSMPrivateEndpoint + :ivar private_link_service_connection_state: Approval state of the private link connection. + :vartype private_link_service_connection_state: + ~azure.mgmt.keyvault.models.MHSMPrivateLinkServiceConnectionState + :ivar provisioning_state: Provisioning state of the private endpoint connection. Known values + are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", and "Disconnected". + :vartype provisioning_state: str or + ~azure.mgmt.keyvault.models.PrivateEndpointConnectionProvisioningState + """ + + private_endpoint: Optional["_models.MHSMPrivateEndpoint"] = rest_field( + name="privateEndpoint", visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the private endpoint object.""" + private_link_service_connection_state: Optional["_models.MHSMPrivateLinkServiceConnectionState"] = rest_field( + name="privateLinkServiceConnectionState", visibility=["read", "create", "update", "delete", "query"] + ) + """Approval state of the private link connection.""" + provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning state of the private endpoint connection. Known values are: \"Succeeded\", + \"Creating\", \"Updating\", \"Deleting\", \"Failed\", and \"Disconnected\".""" + + @overload + def __init__( + self, + *, + private_endpoint: Optional["_models.MHSMPrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.MHSMPrivateLinkServiceConnectionState"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MHSMPrivateLinkResource(ManagedHsmResource): + """A private link resource. + + :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.models.ManagedHsmSku + :ivar 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.models.SystemData + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.keyvault.models.ManagedServiceIdentity + :ivar properties: Resource properties. + :vartype properties: ~azure.mgmt.keyvault.models.MHSMPrivateLinkResourceProperties + """ + + properties: Optional["_models.MHSMPrivateLinkResourceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Resource properties.""" + + __flattened_items = ["group_id", "required_members", "required_zone_names"] + + @overload + def __init__( + self, + *, + location: Optional[str] = None, + sku: Optional["_models.ManagedHsmSku"] = None, + tags: Optional[dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + properties: Optional["_models.MHSMPrivateLinkResourceProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class MHSMPrivateLinkResourceListResult(_Model): + """A list of private link resources. + + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.keyvault.models.MHSMPrivateLinkResource] + """ + + value: Optional[list["_models.MHSMPrivateLinkResource"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Array of private link resources.""" + + @overload + def __init__( + self, + *, + value: Optional[list["_models.MHSMPrivateLinkResource"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MHSMPrivateLinkResourceProperties(_Model): + """Properties of a private link resource. + + :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] + """ + + group_id: Optional[str] = rest_field(name="groupId", visibility=["read"]) + """Group identifier of private link resource.""" + required_members: Optional[list[str]] = rest_field(name="requiredMembers", visibility=["read"]) + """Required member names of private link resource.""" + required_zone_names: Optional[list[str]] = rest_field( + name="requiredZoneNames", visibility=["read", "create", "update", "delete", "query"] + ) + """Required DNS zone names of the the private link resource.""" + + @overload + def __init__( + self, + *, + required_zone_names: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MHSMPrivateLinkServiceConnectionState(_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", and "Disconnected". + :vartype status: str or ~azure.mgmt.keyvault.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. "None" + :vartype actions_required: str or ~azure.mgmt.keyvault.models.ActionsRequired + """ + + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether the connection has been approved, rejected or removed by the key vault owner. + Known values are: \"Pending\", \"Approved\", \"Rejected\", and \"Disconnected\".""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The reason for approval or rejection.""" + actions_required: Optional[Union[str, "_models.ActionsRequired"]] = rest_field( + name="actionsRequired", visibility=["read", "create", "update", "delete", "query"] + ) + """A message indicating if changes on the service provider require any updates on the consumer. + \"None\"""" + + @overload + def __init__( + self, + *, + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[Union[str, "_models.ActionsRequired"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MHSMServiceTagRule(_Model): + """A rule governing the accessibility of a managed hsm pool from a specific service tags. + + :ivar tag: Name of the service tag. Required. + :vartype tag: str + """ + + tag: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the service tag. Required.""" + + @overload + def __init__( + self, + *, + tag: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MHSMVirtualNetworkRule(_Model): + """A rule governing the accessibility of a managed hsm pool from a specific virtual network. + + :ivar id: Full resource id of a vnet subnet, such as + '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + Required. + :vartype id: str + """ + + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Full resource id of a vnet subnet, such as + '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + Required.""" + + @overload + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NetworkRuleSet(_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" and + "None". + :vartype bypass: str or ~azure.mgmt.keyvault.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" and "Deny". + :vartype default_action: str or ~azure.mgmt.keyvault.models.NetworkRuleAction + :ivar ip_rules: The list of IP address rules. + :vartype ip_rules: list[~azure.mgmt.keyvault.models.IPRule] + :ivar virtual_network_rules: The list of virtual network rules. + :vartype virtual_network_rules: list[~azure.mgmt.keyvault.models.VirtualNetworkRule] + """ + + bypass: Optional[Union[str, "_models.NetworkRuleBypassOptions"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not + specified the default is 'AzureServices'. Known values are: \"AzureServices\" and \"None\".""" + default_action: Optional[Union[str, "_models.NetworkRuleAction"]] = rest_field( + name="defaultAction", visibility=["read", "create", "update", "delete", "query"] + ) + """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\" and \"Deny\".""" + ip_rules: Optional[list["_models.IPRule"]] = rest_field( + name="ipRules", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of IP address rules.""" + virtual_network_rules: Optional[list["_models.VirtualNetworkRule"]] = rest_field( + name="virtualNetworkRules", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of virtual network rules.""" + + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Operation(_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.models.OperationDisplay + :ivar origin: The origin of operations. + :vartype origin: str + :ivar operation_properties: Properties of operation, include metric specifications. + :vartype operation_properties: ~azure.mgmt.keyvault.models.OperationProperties + :ivar is_data_action: Property to specify whether the action is a data action. + :vartype is_data_action: bool + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Operation name: {provider}/{resource}/{operation}.""" + display: Optional["_models.OperationDisplay"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Display metadata associated with the operation.""" + origin: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The origin of operations.""" + operation_properties: Optional["_models.OperationProperties"] = rest_field( + name="properties", visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of operation, include metric specifications.""" + is_data_action: Optional[bool] = rest_field( + name="isDataAction", visibility=["read", "create", "update", "delete", "query"] + ) + """Property to specify whether the action is a data action.""" + + __flattened_items = ["service_specification"] + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["_models.OperationDisplay"] = None, + origin: Optional[str] = None, + operation_properties: Optional["_models.OperationProperties"] = None, + is_data_action: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.operation_properties is None: + return None + return getattr(self.operation_properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.operation_properties is None: + self.operation_properties = self._attr_to_rest_field["operation_properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class OperationDisplay(_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 + """ + + provider: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Service provider: Microsoft Key Vault.""" + resource: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource on which the operation is performed etc.""" + operation: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Type of operation: get, read, delete, etc.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Description of operation.""" + + @overload + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OperationProperties(_Model): + """Properties of operation, include metric specifications. + + :ivar service_specification: One property of operation, include metric specifications. + :vartype service_specification: ~azure.mgmt.keyvault.models.ServiceSpecification + """ + + service_specification: Optional["_models.ServiceSpecification"] = rest_field( + name="serviceSpecification", visibility=["read", "create", "update", "delete", "query"] + ) + """One property of operation, include metric specifications.""" + + @overload + def __init__( + self, + *, + service_specification: Optional["_models.ServiceSpecification"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Permissions(_Model): + """Permissions the identity has for keys, secrets, certificates and storage. + + :ivar keys_property: Permissions to keys. + :vartype keys_property: list[str or ~azure.mgmt.keyvault.models.KeyPermissions] + :ivar secrets: Permissions to secrets. + :vartype secrets: list[str or ~azure.mgmt.keyvault.models.SecretPermissions] + :ivar certificates: Permissions to certificates. + :vartype certificates: list[str or ~azure.mgmt.keyvault.models.CertificatePermissions] + :ivar storage: Permissions to storage accounts. + :vartype storage: list[str or ~azure.mgmt.keyvault.models.StoragePermissions] + """ + + keys_property: Optional[list[Union[str, "_models.KeyPermissions"]]] = rest_field( + name="keys", visibility=["read", "create", "update", "delete", "query"] + ) + """Permissions to keys.""" + secrets: Optional[list[Union[str, "_models.SecretPermissions"]]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Permissions to secrets.""" + certificates: Optional[list[Union[str, "_models.CertificatePermissions"]]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Permissions to certificates.""" + storage: Optional[list[Union[str, "_models.StoragePermissions"]]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Permissions to storage accounts.""" + + @overload + def __init__( + self, + *, + keys_property: 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateEndpoint(_Model): + """Private endpoint object properties. + + :ivar id: Full identifier of the private endpoint resource. + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Full identifier of the private endpoint resource.""" + + +class PrivateEndpointConnection(ProxyResource): + """Private endpoint connection resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.keyvault.models.SystemData + :ivar properties: Resource properties. + :vartype properties: ~azure.mgmt.keyvault.models.PrivateEndpointConnectionProperties + :ivar location: Azure location of the key vault resource. + :vartype location: str + :ivar 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 + """ + + properties: Optional["_models.PrivateEndpointConnectionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Resource properties.""" + location: Optional[str] = rest_field(visibility=["read"]) + """Azure location of the key vault resource.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read"]) + """Tags assigned to the key vault resource.""" + etag: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Modified whenever there is a change in the state of private endpoint connection.""" + + __flattened_items = ["private_endpoint", "private_link_service_connection_state", "provisioning_state"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.PrivateEndpointConnectionProperties"] = None, + etag: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class PrivateEndpointConnectionItem(_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 properties: Private endpoint connection properties. + :vartype properties: ~azure.mgmt.keyvault.models.PrivateEndpointConnectionProperties + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Id of private endpoint connection.""" + etag: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Modified whenever there is a change in the state of private endpoint connection.""" + properties: Optional["_models.PrivateEndpointConnectionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Private endpoint connection properties.""" + + __flattened_items = ["private_endpoint", "private_link_service_connection_state", "provisioning_state"] + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + etag: Optional[str] = None, + properties: Optional["_models.PrivateEndpointConnectionProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class PrivateEndpointConnectionProperties(_Model): + """Properties of the private endpoint connection resource. + + :ivar private_endpoint: Properties of the private endpoint object. + :vartype private_endpoint: ~azure.mgmt.keyvault.models.PrivateEndpoint + :ivar private_link_service_connection_state: Approval state of the private link connection. + :vartype private_link_service_connection_state: + ~azure.mgmt.keyvault.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: Provisioning state of the private endpoint connection. Known values + are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", and "Disconnected". + :vartype provisioning_state: str or + ~azure.mgmt.keyvault.models.PrivateEndpointConnectionProvisioningState + """ + + private_endpoint: Optional["_models.PrivateEndpoint"] = rest_field( + name="privateEndpoint", visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the private endpoint object.""" + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = rest_field( + name="privateLinkServiceConnectionState", visibility=["read", "create", "update", "delete", "query"] + ) + """Approval state of the private link connection.""" + provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning state of the private endpoint connection. Known values are: \"Succeeded\", + \"Creating\", \"Updating\", \"Deleting\", \"Failed\", and \"Disconnected\".""" + + @overload + def __init__( + self, + *, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateLinkResource(ProxyResource): + """A private link resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.keyvault.models.SystemData + :ivar properties: Resource properties. + :vartype properties: ~azure.mgmt.keyvault.models.PrivateLinkResourceProperties + :ivar location: Azure location of the key vault resource. + :vartype location: str + :ivar tags: Tags assigned to the key vault resource. + :vartype tags: dict[str, str] + """ + + properties: Optional["_models.PrivateLinkResourceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Resource properties.""" + location: Optional[str] = rest_field(visibility=["read"]) + """Azure location of the key vault resource.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read"]) + """Tags assigned to the key vault resource.""" + + __flattened_items = ["group_id", "required_members", "required_zone_names"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.PrivateLinkResourceProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class PrivateLinkResourceListResult(_Model): + """A list of private link resources. + + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.keyvault.models.PrivateLinkResource] + """ + + value: Optional[list["_models.PrivateLinkResource"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Array of private link resources.""" + + @overload + def __init__( + self, + *, + value: Optional[list["_models.PrivateLinkResource"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateLinkResourceProperties(_Model): + """Properties of a private link resource. + + :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] + """ + + group_id: Optional[str] = rest_field(name="groupId", visibility=["read"]) + """Group identifier of private link resource.""" + required_members: Optional[list[str]] = rest_field(name="requiredMembers", visibility=["read"]) + """Required member names of private link resource.""" + required_zone_names: Optional[list[str]] = rest_field( + name="requiredZoneNames", visibility=["read", "create", "update", "delete", "query"] + ) + """Required DNS zone names of the the private link resource.""" + + @overload + def __init__( + self, + *, + required_zone_names: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateLinkServiceConnectionState(_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", and "Disconnected". + :vartype status: str or ~azure.mgmt.keyvault.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. "None" + :vartype actions_required: str or ~azure.mgmt.keyvault.models.ActionsRequired + """ + + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether the connection has been approved, rejected or removed by the key vault owner. + Known values are: \"Pending\", \"Approved\", \"Rejected\", and \"Disconnected\".""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The reason for approval or rejection.""" + actions_required: Optional[Union[str, "_models.ActionsRequired"]] = rest_field( + name="actionsRequired", visibility=["read", "create", "update", "delete", "query"] + ) + """A message indicating if changes on the service provider require any updates on the consumer. + \"None\"""" + + @overload + def __init__( + self, + *, + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[Union[str, "_models.ActionsRequired"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RotationPolicy(_Model): + """RotationPolicy. + + :ivar attributes: The attributes of key rotation policy. + :vartype attributes: ~azure.mgmt.keyvault.models.KeyRotationPolicyAttributes + :ivar lifetime_actions: The lifetimeActions for key rotation action. + :vartype lifetime_actions: list[~azure.mgmt.keyvault.models.LifetimeAction] + """ + + attributes: Optional["_models.KeyRotationPolicyAttributes"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The attributes of key rotation policy.""" + lifetime_actions: Optional[list["_models.LifetimeAction"]] = rest_field( + name="lifetimeActions", visibility=["read", "create", "update", "delete", "query"] + ) + """The lifetimeActions for key rotation action.""" + + @overload + def __init__( + self, + *, + attributes: Optional["_models.KeyRotationPolicyAttributes"] = None, + lifetime_actions: Optional[list["_models.LifetimeAction"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Secret(ProxyResource): + """Resource information with extended details. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.keyvault.models.SystemData + :ivar properties: Properties of the secret. Required. + :vartype properties: ~azure.mgmt.keyvault.models.SecretProperties + :ivar location: Azure location of the key vault resource. + :vartype location: str + :ivar tags: Tags assigned to the key vault resource. + :vartype tags: dict[str, str] + """ + + properties: "_models.SecretProperties" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Properties of the secret. Required.""" + location: Optional[str] = rest_field(visibility=["read"]) + """Azure location of the key vault resource.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read"]) + """Tags assigned to the key vault resource.""" + + @overload + def __init__( + self, + *, + properties: "_models.SecretProperties", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SecretAttributes(Attributes): + """The secret management attributes. + + :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 + """ + + @overload + def __init__( + self, + *, + enabled: Optional[bool] = None, + not_before: Optional[datetime.datetime] = None, + expires: Optional[datetime.datetime] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SecretCreateOrUpdateParameters(_Model): + """Parameters for creating or updating a secret. + + :ivar tags: The tags that will be assigned to the secret. + :vartype tags: dict[str, str] + :ivar properties: Properties of the secret. Required. + :vartype properties: ~azure.mgmt.keyvault.models.SecretProperties + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The tags that will be assigned to the secret.""" + properties: "_models.SecretProperties" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Properties of the secret. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.SecretProperties", + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SecretPatchParameters(_Model): + """Parameters for patching a secret. + + :ivar 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.models.SecretPatchProperties + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The tags that will be assigned to the secret.""" + properties: Optional["_models.SecretPatchProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the secret.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.SecretPatchProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SecretPatchProperties(_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.models.SecretAttributes + """ + + value: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The value of the secret.""" + content_type: Optional[str] = rest_field( + name="contentType", visibility=["read", "create", "update", "delete", "query"] + ) + """The content type of the secret.""" + attributes: Optional["_models.SecretAttributes"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The attributes of the secret.""" + + @overload + def __init__( + self, + *, + value: Optional[str] = None, + content_type: Optional[str] = None, + attributes: Optional["_models.SecretAttributes"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SecretProperties(_Model): + """Properties of the secret. + + :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.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 + """ + + value: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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.""" + content_type: Optional[str] = rest_field( + name="contentType", visibility=["read", "create", "update", "delete", "query"] + ) + """The content type of the secret.""" + attributes: Optional["_models.SecretAttributes"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The attributes of the secret.""" + secret_uri: Optional[str] = rest_field(name="secretUri", visibility=["read"]) + """The URI to retrieve the current version of the secret.""" + secret_uri_with_version: Optional[str] = rest_field(name="secretUriWithVersion", visibility=["read"]) + """The URI to retrieve the specific version of the secret.""" + + @overload + def __init__( + self, + *, + value: Optional[str] = None, + content_type: Optional[str] = None, + attributes: Optional["_models.SecretAttributes"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ServiceSpecification(_Model): + """One property of operation, include log specifications. + + :ivar log_specifications: Log specifications of operation. + :vartype log_specifications: list[~azure.mgmt.keyvault.models.LogSpecification] + :ivar metric_specifications: Metric specifications of operation. + :vartype metric_specifications: list[~azure.mgmt.keyvault.models.MetricSpecification] + """ + + log_specifications: Optional[list["_models.LogSpecification"]] = rest_field( + name="logSpecifications", visibility=["read", "create", "update", "delete", "query"] + ) + """Log specifications of operation.""" + metric_specifications: Optional[list["_models.MetricSpecification"]] = rest_field( + name="metricSpecifications", visibility=["read", "create", "update", "delete", "query"] + ) + """Metric specifications of operation.""" + + @overload + def __init__( + self, + *, + log_specifications: Optional[list["_models.LogSpecification"]] = None, + metric_specifications: Optional[list["_models.MetricSpecification"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Sku(_Model): + """SKU details. + + :ivar family: SKU family name. Required. "A" + :vartype family: str or ~azure.mgmt.keyvault.models.SkuFamily + :ivar name: SKU name to specify whether the key vault is a standard vault or a premium vault. + Required. Known values are: "standard" and "premium". + :vartype name: str or ~azure.mgmt.keyvault.models.SkuName + """ + + family: Union[str, "_models.SkuFamily"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """SKU family name. Required. \"A\"""" + name: Union[str, "_models.SkuName"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """SKU name to specify whether the key vault is a standard vault or a premium vault. Required. + Known values are: \"standard\" and \"premium\".""" + + @overload + def __init__( + self, + *, + family: Union[str, "_models.SkuFamily"], + name: Union[str, "_models.SkuName"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SystemData(_Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.keyvault.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.keyvault.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + created_by: Optional[str] = rest_field(name="createdBy", visibility=["read", "create", "update", "delete", "query"]) + """The identity that created the resource.""" + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="createdByType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity that created the resource. Known values are: \"User\", \"Application\", + \"ManagedIdentity\", and \"Key\".""" + created_at: Optional[datetime.datetime] = rest_field( + name="createdAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp of resource creation (UTC).""" + last_modified_by: Optional[str] = rest_field( + name="lastModifiedBy", visibility=["read", "create", "update", "delete", "query"] + ) + """The identity that last modified the resource.""" + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="lastModifiedByType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity that last modified the resource. Known values are: \"User\", + \"Application\", \"ManagedIdentity\", and \"Key\".""" + last_modified_at: Optional[datetime.datetime] = rest_field( + name="lastModifiedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp of resource last modification (UTC).""" + + @overload + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TrackedResource(ArmResource): + """Tracked Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.keyvault.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + location: str = rest_field(visibility=["read", "create"]) + """The geo-location where the resource lives. Required.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Trigger(_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 + """ + + time_after_create: Optional[str] = rest_field( + name="timeAfterCreate", visibility=["read", "create", "update", "delete", "query"] + ) + """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'.""" + time_before_expiry: Optional[str] = rest_field( + name="timeBeforeExpiry", visibility=["read", "create", "update", "delete", "query"] + ) + """The time duration before key expiring to rotate or notify. It will be in ISO 8601 duration + format. Eg: 'P90D', 'P1Y'.""" + + @overload + def __init__( + self, + *, + time_after_create: Optional[str] = None, + time_before_expiry: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UserAssignedIdentity(_Model): + """User assigned identity properties. + + :ivar principal_id: The principal ID of the assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the assigned identity. + :vartype client_id: str + """ + + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The principal ID of the assigned identity.""" + client_id: Optional[str] = rest_field(name="clientId", visibility=["read"]) + """The client ID of the assigned identity.""" + + +class Vault(ProxyResource): + """Resource information with extended details. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.keyvault.models.SystemData + :ivar properties: Properties of the vault. Required. + :vartype properties: ~azure.mgmt.keyvault.models.VaultProperties + :ivar location: Azure location of the key vault resource. + :vartype location: str + :ivar tags: Tags assigned to the key vault resource. + :vartype tags: dict[str, str] + """ + + properties: "_models.VaultProperties" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Properties of the vault. Required.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Azure location of the key vault resource.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Tags assigned to the key vault resource.""" + + @overload + def __init__( + self, + *, + properties: "_models.VaultProperties", + location: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VaultAccessPolicyParameters(_Model): + """Parameters for updating the access policy in a vault. + + :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: Properties of the access policy. Required. + :vartype properties: ~azure.mgmt.keyvault.models.VaultAccessPolicyProperties + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """The resource id of the access policy.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The resource name of the access policy.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The resource name of the access policy.""" + location: Optional[str] = rest_field(visibility=["read"]) + """The resource type of the access policy.""" + properties: "_models.VaultAccessPolicyProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the access policy. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.VaultAccessPolicyProperties", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VaultAccessPolicyProperties(_Model): + """Properties of the vault access policy. + + :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. Required. + :vartype access_policies: list[~azure.mgmt.keyvault.models.AccessPolicyEntry] + """ + + access_policies: list["_models.AccessPolicyEntry"] = rest_field( + name="accessPolicies", visibility=["read", "create", "update", "delete", "query"] + ) + """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. Required.""" + + @overload + def __init__( + self, + *, + access_policies: list["_models.AccessPolicyEntry"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VaultCheckNameAvailabilityParameters(_Model): + """The parameters used to check the availability of the vault name. + + :ivar name: The vault name. Required. + :vartype name: str + :ivar type: The type of resource, Microsoft.KeyVault/vaults. Required. Default value is + "Microsoft.KeyVault/vaults". + :vartype type: str + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The vault name. Required.""" + type: Literal["Microsoft.KeyVault/vaults"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The type of resource, Microsoft.KeyVault/vaults. Required. Default value is + \"Microsoft.KeyVault/vaults\".""" + + @overload + def __init__( + self, + *, + name: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type: Literal["Microsoft.KeyVault/vaults"] = "Microsoft.KeyVault/vaults" + + +class VaultCreateOrUpdateParameters(_Model): + """Parameters for creating or updating a vault. + + :ivar location: The supported Azure location where the key vault should be created. Required. + :vartype location: str + :ivar tags: The tags that will be assigned to the key vault. + :vartype tags: dict[str, str] + :ivar properties: Properties of the vault. Required. + :vartype properties: ~azure.mgmt.keyvault.models.VaultProperties + """ + + location: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The supported Azure location where the key vault should be created. Required.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The tags that will be assigned to the key vault.""" + properties: "_models.VaultProperties" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Properties of the vault. Required.""" + + @overload + def __init__( + self, + *, + location: str, + properties: "_models.VaultProperties", + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VaultPatchParameters(_Model): + """Parameters for creating or updating a vault. + + :ivar 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.models.VaultPatchProperties + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The tags that will be assigned to the key vault.""" + properties: Optional["_models.VaultPatchProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the vault.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.VaultPatchProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VaultPatchProperties(_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.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.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" and "default". + :vartype create_mode: str or ~azure.mgmt.keyvault.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.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 + """ + + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read", "create", "update", "delete", "query"]) + """The Azure Active Directory tenant ID that should be used for authenticating requests to the key + vault.""" + sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """SKU details.""" + access_policies: Optional[list["_models.AccessPolicyEntry"]] = rest_field( + name="accessPolicies", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + enabled_for_deployment: Optional[bool] = rest_field( + name="enabledForDeployment", visibility=["read", "create", "update", "delete", "query"] + ) + """Property to specify whether Azure Virtual Machines are permitted to retrieve certificates + stored as secrets from the key vault.""" + enabled_for_disk_encryption: Optional[bool] = rest_field( + name="enabledForDiskEncryption", visibility=["read", "create", "update", "delete", "query"] + ) + """Property to specify whether Azure Disk Encryption is permitted to retrieve secrets from the + vault and unwrap keys.""" + enabled_for_template_deployment: Optional[bool] = rest_field( + name="enabledForTemplateDeployment", visibility=["read", "create", "update", "delete", "query"] + ) + """Property to specify whether Azure Resource Manager is permitted to retrieve secrets from the + key vault.""" + enable_soft_delete: Optional[bool] = rest_field( + name="enableSoftDelete", visibility=["read", "create", "update", "delete", "query"] + ) + """Property to specify whether the 'soft delete' functionality is enabled for this key vault. Once + set to true, it cannot be reverted to false.""" + enable_rbac_authorization: Optional[bool] = rest_field( + name="enableRbacAuthorization", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + soft_delete_retention_in_days: Optional[int] = rest_field( + name="softDeleteRetentionInDays", visibility=["read", "create", "update", "delete", "query"] + ) + """softDelete data retention days. It accepts >=7 and <=90.""" + create_mode: Optional[Union[str, "_models.CreateMode"]] = rest_field( + name="createMode", visibility=["read", "create", "update", "delete", "query"] + ) + """The vault's create mode to indicate whether the vault need to be recovered or not. Known values + are: \"recover\" and \"default\".""" + enable_purge_protection: Optional[bool] = rest_field( + name="enablePurgeProtection", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + network_acls: Optional["_models.NetworkRuleSet"] = rest_field( + name="networkAcls", visibility=["read", "create", "update", "delete", "query"] + ) + """A collection of rules governing the accessibility of the vault from specific network locations.""" + public_network_access: Optional[str] = rest_field( + name="publicNetworkAccess", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VaultProperties(_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. Required. + :vartype tenant_id: str + :ivar sku: SKU details. Required. + :vartype sku: ~azure.mgmt.keyvault.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.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" and "default". + :vartype create_mode: str or ~azure.mgmt.keyvault.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.models.NetworkRuleSet + :ivar provisioning_state: Provisioning state of the vault. Known values are: "Succeeded" and + "RegisteringDns". + :vartype provisioning_state: str or ~azure.mgmt.keyvault.models.VaultProvisioningState + :ivar private_endpoint_connections: List of private endpoint connections associated with the + key vault. + :vartype private_endpoint_connections: + list[~azure.mgmt.keyvault.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 + """ + + tenant_id: str = rest_field(name="tenantId", visibility=["read", "create", "update", "delete", "query"]) + """The Azure Active Directory tenant ID that should be used for authenticating requests to the key + vault. Required.""" + sku: "_models.Sku" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """SKU details. Required.""" + access_policies: Optional[list["_models.AccessPolicyEntry"]] = rest_field( + name="accessPolicies", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + vault_uri: Optional[str] = rest_field(name="vaultUri", visibility=["read", "create", "update", "delete", "query"]) + """The URI of the vault for performing operations on keys and secrets.""" + hsm_pool_resource_id: Optional[str] = rest_field(name="hsmPoolResourceId", visibility=["read"]) + """The resource id of HSM Pool.""" + enabled_for_deployment: Optional[bool] = rest_field( + name="enabledForDeployment", visibility=["read", "create", "update", "delete", "query"] + ) + """Property to specify whether Azure Virtual Machines are permitted to retrieve certificates + stored as secrets from the key vault.""" + enabled_for_disk_encryption: Optional[bool] = rest_field( + name="enabledForDiskEncryption", visibility=["read", "create", "update", "delete", "query"] + ) + """Property to specify whether Azure Disk Encryption is permitted to retrieve secrets from the + vault and unwrap keys.""" + enabled_for_template_deployment: Optional[bool] = rest_field( + name="enabledForTemplateDeployment", visibility=["read", "create", "update", "delete", "query"] + ) + """Property to specify whether Azure Resource Manager is permitted to retrieve secrets from the + key vault.""" + enable_soft_delete: Optional[bool] = rest_field( + name="enableSoftDelete", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + soft_delete_retention_in_days: Optional[int] = rest_field( + name="softDeleteRetentionInDays", visibility=["read", "create", "update", "delete", "query"] + ) + """softDelete data retention days. It accepts >=7 and <=90.""" + enable_rbac_authorization: Optional[bool] = rest_field( + name="enableRbacAuthorization", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + create_mode: Optional[Union[str, "_models.CreateMode"]] = rest_field( + name="createMode", visibility=["create", "update"] + ) + """The vault's create mode to indicate whether the vault need to be recovered or not. Known values + are: \"recover\" and \"default\".""" + enable_purge_protection: Optional[bool] = rest_field( + name="enablePurgeProtection", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + network_acls: Optional["_models.NetworkRuleSet"] = rest_field( + name="networkAcls", visibility=["read", "create", "update", "delete", "query"] + ) + """Rules governing the accessibility of the key vault from specific network locations.""" + provisioning_state: Optional[Union[str, "_models.VaultProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read", "create", "update", "delete", "query"] + ) + """Provisioning state of the vault. Known values are: \"Succeeded\" and \"RegisteringDns\".""" + private_endpoint_connections: Optional[list["_models.PrivateEndpointConnectionItem"]] = rest_field( + name="privateEndpointConnections", visibility=["read"] + ) + """List of private endpoint connections associated with the key vault.""" + public_network_access: Optional[str] = rest_field( + name="publicNetworkAccess", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + + @overload + 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] = None, + soft_delete_retention_in_days: Optional[int] = None, + enable_rbac_authorization: Optional[bool] = None, + 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] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class VirtualNetworkRule(_Model): + """A rule governing the accessibility of a vault from a specific virtual network. + + :ivar id: Full resource id of a vnet subnet, such as + '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + Required. + :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 + """ + + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Full resource id of a vnet subnet, such as + '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + Required.""" + ignore_missing_vnet_service_endpoint: Optional[bool] = rest_field( + name="ignoreMissingVnetServiceEndpoint", visibility=["read", "create", "update", "delete", "query"] + ) + """Property to specify whether NRP will ignore the check if parent subnet has serviceEndpoints + configured.""" + + @overload + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + ignore_missing_vnet_service_endpoint: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_models_py3.py deleted file mode 100644 index 57feb8e659d4..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_models_py3.py +++ /dev/null @@ -1,4581 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -from typing import Any, Optional, TYPE_CHECKING, Union - -from .._utils import serialization as _serialization - -if TYPE_CHECKING: - from .. import models as _models - - -class AccessPolicyEntry(_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 server. - - :ivar tenant_id: The Azure Active Directory tenant ID that should be used for authenticating - requests to the key vault. Required. - :vartype tenant_id: str - :ivar object_id: 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. Required. - :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: Permissions the identity has for keys, secrets and certificates. Required. - :vartype permissions: ~azure.mgmt.keyvault.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: Any - ) -> None: - """ - :keyword tenant_id: The Azure Active Directory tenant ID that should be used for authenticating - requests to the key vault. Required. - :paramtype tenant_id: str - :keyword object_id: 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. Required. - :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: Permissions the identity has for keys, secrets and certificates. - Required. - :paramtype permissions: ~azure.mgmt.keyvault.models.Permissions - """ - super().__init__(**kwargs) - self.tenant_id = tenant_id - self.object_id = object_id - self.application_id = application_id - self.permissions = permissions - - -class Action(_serialization.Model): - """Action. - - :ivar type: The type of action. Known values are: "rotate" and "notify". - :vartype type: str or ~azure.mgmt.keyvault.models.KeyRotationPolicyActionType - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - def __init__( - self, *, type: Optional[Union[str, "_models.KeyRotationPolicyActionType"]] = None, **kwargs: Any - ) -> None: - """ - :keyword type: The type of action. Known values are: "rotate" and "notify". - :paramtype type: str or ~azure.mgmt.keyvault.models.KeyRotationPolicyActionType - """ - super().__init__(**kwargs) - self.type = type - - -class Attributes(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.enabled = enabled - self.not_before = not_before - self.expires = expires - self.created: Optional[datetime.datetime] = None - self.updated: Optional[datetime.datetime] = None - - -class CheckMhsmNameAvailabilityParameters(_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 server. - - :ivar name: The managed hsm name. Required. - :vartype name: str - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: The managed hsm name. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class CheckMhsmNameAvailabilityResult(_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" and "AlreadyExists". - :vartype reason: str or ~azure.mgmt.keyvault.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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name_available: Optional[bool] = None - self.reason: Optional[Union[str, "_models.Reason"]] = None - self.message: Optional[str] = None - - -class CheckNameAvailabilityResult(_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" and "AlreadyExists". - :vartype reason: str or ~azure.mgmt.keyvault.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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name_available: Optional[bool] = None - self.reason: Optional[Union[str, "_models.Reason"]] = None - self.message: Optional[str] = None - - -class CloudErrorBody(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.code = code - self.message = message - - -class DeletedManagedHsm(_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.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: Any) -> None: - """ - :keyword properties: Properties of the deleted managed HSM. - :paramtype properties: ~azure.mgmt.keyvault.models.DeletedManagedHsmProperties - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.properties = properties - - -class DeletedManagedHsmListResult(_serialization.Model): - """List of deleted managed HSM Pools. - - :ivar value: The list of deleted managed HSM Pools. - :vartype value: list[~azure.mgmt.keyvault.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: Any - ) -> None: - """ - :keyword value: The list of deleted managed HSM Pools. - :paramtype value: list[~azure.mgmt.keyvault.models.DeletedManagedHsm] - :keyword next_link: The URL to get the next set of deleted managed HSM Pools. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DeletedManagedHsmProperties(_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: 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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.mhsm_id: Optional[str] = None - self.location: Optional[str] = None - self.deletion_date: Optional[datetime.datetime] = None - self.scheduled_purge_date: Optional[datetime.datetime] = None - self.purge_protection_enabled: Optional[bool] = None - self.tags: Optional[dict[str, str]] = None - - -class DeletedVault(_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.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: Any) -> None: - """ - :keyword properties: Properties of the vault. - :paramtype properties: ~azure.mgmt.keyvault.models.DeletedVaultProperties - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.properties = properties - - -class DeletedVaultListResult(_serialization.Model): - """List of vaults. - - :ivar value: The list of deleted vaults. - :vartype value: list[~azure.mgmt.keyvault.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: Any - ) -> None: - """ - :keyword value: The list of deleted vaults. - :paramtype value: list[~azure.mgmt.keyvault.models.DeletedVault] - :keyword next_link: The URL to get the next set of deleted vaults. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DeletedVaultProperties(_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: 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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.vault_id: Optional[str] = None - self.location: Optional[str] = None - self.deletion_date: Optional[datetime.datetime] = None - self.scheduled_purge_date: Optional[datetime.datetime] = None - self.tags: Optional[dict[str, str]] = None - self.purge_protection_enabled: Optional[bool] = None - - -class DimensionProperties(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.to_be_exported_for_shoebox = to_be_exported_for_shoebox - - -class Error(_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.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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code: Optional[str] = None - self.message: Optional[str] = None - self.inner_error: Optional["_models.Error"] = None - - -class IPRule(_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 server. - - :ivar value: 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). Required. - :vartype value: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "str"}, - } - - def __init__(self, *, value: str, **kwargs: Any) -> None: - """ - :keyword value: 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). Required. - :paramtype value: str - """ - super().__init__(**kwargs) - self.value = value - - -class Resource(_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: 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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.location: Optional[str] = None - self.tags: Optional[dict[str, str]] = 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: Tags assigned to the key vault resource. - :vartype tags: dict[str, str] - :ivar attributes: The attributes of the key. - :vartype attributes: ~azure.mgmt.keyvault.models.KeyAttributes - :ivar kty: The type of the key. For valid values, see JsonWebKeyType. Known values are: "EC", - "EC-HSM", "RSA", and "RSA-HSM". - :vartype kty: str or ~azure.mgmt.keyvault.models.JsonWebKeyType - :ivar key_ops: - :vartype key_ops: list[str or ~azure.mgmt.keyvault.models.JsonWebKeyOperation] - :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. Default for RSA - and RSA-HSM keys is 2048. Exception made for bring your own key (BYOK), key exchange keys - default to 4096. - :vartype key_size: int - :ivar curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Default - for EC and EC-HSM keys is P-256. Known values are: "P-256", "P-384", "P-521", and "P-256K". - :vartype curve_name: str or ~azure.mgmt.keyvault.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.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.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: Any - ) -> None: - """ - :keyword attributes: The attributes of the key. - :paramtype attributes: ~azure.mgmt.keyvault.models.KeyAttributes - :keyword kty: The type of the key. For valid values, see JsonWebKeyType. Known values are: - "EC", "EC-HSM", "RSA", and "RSA-HSM". - :paramtype kty: str or ~azure.mgmt.keyvault.models.JsonWebKeyType - :keyword key_ops: - :paramtype key_ops: list[str or ~azure.mgmt.keyvault.models.JsonWebKeyOperation] - :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. Default for - RSA and RSA-HSM keys is 2048. Exception made for bring your own key (BYOK), key exchange keys - default to 4096. - :paramtype key_size: int - :keyword curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. - Default for EC and EC-HSM keys is P-256. Known values are: "P-256", "P-384", "P-521", and - "P-256K". - :paramtype curve_name: str or ~azure.mgmt.keyvault.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.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.models.KeyReleasePolicy - """ - super().__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: Optional[str] = None - self.key_uri_with_version: Optional[str] = None - self.rotation_policy = rotation_policy - self.release_policy = release_policy - - -class KeyAttributes(_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: int - :ivar expires: Expiry date in seconds since 1970-01-01T00:00:00Z. - :vartype expires: int - :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. - :vartype created: int - :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. - :vartype updated: int - :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", and - "Recoverable+ProtectedSubscription". - :vartype recovery_level: str or ~azure.mgmt.keyvault.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": "int"}, - "expires": {"key": "exp", "type": "int"}, - "created": {"key": "created", "type": "int"}, - "updated": {"key": "updated", "type": "int"}, - "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: bool = False, - **kwargs: Any - ) -> None: - """ - :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: int - :keyword expires: Expiry date in seconds since 1970-01-01T00:00:00Z. - :paramtype expires: int - :keyword exportable: Indicates if the private key can be exported. - :paramtype exportable: bool - """ - super().__init__(**kwargs) - self.enabled = enabled - self.not_before = not_before - self.expires = expires - self.created: Optional[int] = None - self.updated: Optional[int] = None - self.recovery_level: Optional[Union[str, "_models.DeletionRecoveryLevel"]] = None - self.exportable = exportable - - -class KeyCreateParameters(_serialization.Model): - """The parameters used to create a key. - - All required parameters must be populated in order to send to server. - - :ivar tags: The tags that will be assigned to the key. - :vartype tags: dict[str, str] - :ivar properties: The properties of the key to be created. Required. - :vartype properties: ~azure.mgmt.keyvault.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: Any - ) -> None: - """ - :keyword tags: The tags that will be assigned to the key. - :paramtype tags: dict[str, str] - :keyword properties: The properties of the key to be created. Required. - :paramtype properties: ~azure.mgmt.keyvault.models.KeyProperties - """ - super().__init__(**kwargs) - self.tags = tags - self.properties = properties - - -class KeyListResult(_serialization.Model): - """The page of keys. - - :ivar value: The key resources. - :vartype value: list[~azure.mgmt.keyvault.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: Any - ) -> None: - """ - :keyword value: The key resources. - :paramtype value: list[~azure.mgmt.keyvault.models.Key] - :keyword next_link: The URL to get the next page of keys. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class KeyProperties(_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.models.KeyAttributes - :ivar kty: The type of the key. For valid values, see JsonWebKeyType. Known values are: "EC", - "EC-HSM", "RSA", and "RSA-HSM". - :vartype kty: str or ~azure.mgmt.keyvault.models.JsonWebKeyType - :ivar key_ops: - :vartype key_ops: list[str or ~azure.mgmt.keyvault.models.JsonWebKeyOperation] - :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. Default for RSA - and RSA-HSM keys is 2048. Exception made for bring your own key (BYOK), key exchange keys - default to 4096. - :vartype key_size: int - :ivar curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Default - for EC and EC-HSM keys is P-256. Known values are: "P-256", "P-384", "P-521", and "P-256K". - :vartype curve_name: str or ~azure.mgmt.keyvault.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.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.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: Any - ) -> None: - """ - :keyword attributes: The attributes of the key. - :paramtype attributes: ~azure.mgmt.keyvault.models.KeyAttributes - :keyword kty: The type of the key. For valid values, see JsonWebKeyType. Known values are: - "EC", "EC-HSM", "RSA", and "RSA-HSM". - :paramtype kty: str or ~azure.mgmt.keyvault.models.JsonWebKeyType - :keyword key_ops: - :paramtype key_ops: list[str or ~azure.mgmt.keyvault.models.JsonWebKeyOperation] - :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. Default for - RSA and RSA-HSM keys is 2048. Exception made for bring your own key (BYOK), key exchange keys - default to 4096. - :paramtype key_size: int - :keyword curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. - Default for EC and EC-HSM keys is P-256. Known values are: "P-256", "P-384", "P-521", and - "P-256K". - :paramtype curve_name: str or ~azure.mgmt.keyvault.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.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.models.KeyReleasePolicy - """ - super().__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: Optional[str] = None - self.key_uri_with_version: Optional[str] = None - self.rotation_policy = rotation_policy - self.release_policy = release_policy - - -class KeyReleasePolicy(_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: str = "application/json; charset=utf-8", data: Optional[bytes] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.content_type = content_type - self.data = data - - -class KeyRotationPolicyAttributes(_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: int - :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. - :vartype updated: int - :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": "int"}, - "updated": {"key": "updated", "type": "int"}, - "expiry_time": {"key": "expiryTime", "type": "str"}, - } - - def __init__(self, *, expiry_time: Optional[str] = None, **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.created: Optional[int] = None - self.updated: Optional[int] = None - self.expiry_time = expiry_time - - -class LifetimeAction(_serialization.Model): - """LifetimeAction. - - :ivar trigger: The trigger of key rotation policy lifetimeAction. - :vartype trigger: ~azure.mgmt.keyvault.models.Trigger - :ivar action: The action of key rotation policy lifetimeAction. - :vartype action: ~azure.mgmt.keyvault.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: Any - ) -> None: - """ - :keyword trigger: The trigger of key rotation policy lifetimeAction. - :paramtype trigger: ~azure.mgmt.keyvault.models.Trigger - :keyword action: The action of key rotation policy lifetimeAction. - :paramtype action: ~azure.mgmt.keyvault.models.Action - """ - super().__init__(**kwargs) - self.trigger = trigger - self.action = action - - -class LogSpecification(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.blob_duration = blob_duration - - -class ManagedHsmResource(_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.models.ManagedHsmSku - :ivar 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.models.SystemData - :ivar identity: Managed service identity (system assigned and/or user assigned identities). - :vartype identity: ~azure.mgmt.keyvault.models.ManagedServiceIdentity - """ - - _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"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - sku: Optional["_models.ManagedHsmSku"] = None, - tags: Optional[dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - **kwargs: Any - ) -> None: - """ - :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.models.ManagedHsmSku - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword identity: Managed service identity (system assigned and/or user assigned identities). - :paramtype identity: ~azure.mgmt.keyvault.models.ManagedServiceIdentity - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.location = location - self.sku = sku - self.tags = tags - self.system_data: Optional["_models.SystemData"] = None - self.identity = identity - - -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.models.ManagedHsmSku - :ivar 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.models.SystemData - :ivar identity: Managed service identity (system assigned and/or user assigned identities). - :vartype identity: ~azure.mgmt.keyvault.models.ManagedServiceIdentity - :ivar properties: Properties of the managed HSM. - :vartype properties: ~azure.mgmt.keyvault.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"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "properties": {"key": "properties", "type": "ManagedHsmProperties"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - sku: Optional["_models.ManagedHsmSku"] = None, - tags: Optional[dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - properties: Optional["_models.ManagedHsmProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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.models.ManagedHsmSku - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword identity: Managed service identity (system assigned and/or user assigned identities). - :paramtype identity: ~azure.mgmt.keyvault.models.ManagedServiceIdentity - :keyword properties: Properties of the managed HSM. - :paramtype properties: ~azure.mgmt.keyvault.models.ManagedHsmProperties - """ - super().__init__(location=location, sku=sku, tags=tags, identity=identity, **kwargs) - self.properties = properties - - -class ManagedHsmAction(_serialization.Model): - """ManagedHsmAction. - - :ivar type: The type of action. Known values are: "rotate" and "notify". - :vartype type: str or ~azure.mgmt.keyvault.models.KeyRotationPolicyActionType - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - def __init__( - self, *, type: Optional[Union[str, "_models.KeyRotationPolicyActionType"]] = None, **kwargs: Any - ) -> None: - """ - :keyword type: The type of action. Known values are: "rotate" and "notify". - :paramtype type: str or ~azure.mgmt.keyvault.models.KeyRotationPolicyActionType - """ - super().__init__(**kwargs) - self.type = type - - -class ManagedHsmError(_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.models.Error - """ - - _validation = { - "error": {"readonly": True}, - } - - _attribute_map = { - "error": {"key": "error", "type": "Error"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.error: Optional["_models.Error"] = None - - -class ProxyResourceWithoutSystemData(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.tags = tags - - -class ManagedHsmKey(ProxyResourceWithoutSystemData): - """The key resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar attributes: The attributes of the key. - :vartype attributes: ~azure.mgmt.keyvault.models.ManagedHsmKeyAttributes - :ivar kty: The type of the key. For valid values, see JsonWebKeyType. Known values are: "EC", - "EC-HSM", "RSA", and "RSA-HSM". - :vartype kty: str or ~azure.mgmt.keyvault.models.JsonWebKeyType - :ivar key_ops: - :vartype key_ops: list[str or ~azure.mgmt.keyvault.models.JsonWebKeyOperation] - :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. Default for RSA - and RSA-HSM keys is 2048. Exception made for bring your own key (BYOK), key exchange keys - default to 4096. - :vartype key_size: int - :ivar curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Default - for EC and EC-HSM keys is P-256. Known values are: "P-256", "P-384", "P-521", and "P-256K". - :vartype curve_name: str or ~azure.mgmt.keyvault.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.models.ManagedHsmRotationPolicy - :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.models.ManagedHsmKeyReleasePolicy - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"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"}, - "tags": {"key": "tags", "type": "{str}"}, - "attributes": {"key": "properties.attributes", "type": "ManagedHsmKeyAttributes"}, - "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": "ManagedHsmRotationPolicy"}, - "release_policy": {"key": "properties.release_policy", "type": "ManagedHsmKeyReleasePolicy"}, - } - - def __init__( - self, - *, - tags: Optional[dict[str, str]] = None, - attributes: Optional["_models.ManagedHsmKeyAttributes"] = 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.ManagedHsmRotationPolicy"] = None, - release_policy: Optional["_models.ManagedHsmKeyReleasePolicy"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword attributes: The attributes of the key. - :paramtype attributes: ~azure.mgmt.keyvault.models.ManagedHsmKeyAttributes - :keyword kty: The type of the key. For valid values, see JsonWebKeyType. Known values are: - "EC", "EC-HSM", "RSA", and "RSA-HSM". - :paramtype kty: str or ~azure.mgmt.keyvault.models.JsonWebKeyType - :keyword key_ops: - :paramtype key_ops: list[str or ~azure.mgmt.keyvault.models.JsonWebKeyOperation] - :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. Default for - RSA and RSA-HSM keys is 2048. Exception made for bring your own key (BYOK), key exchange keys - default to 4096. - :paramtype key_size: int - :keyword curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. - Default for EC and EC-HSM keys is P-256. Known values are: "P-256", "P-384", "P-521", and - "P-256K". - :paramtype curve_name: str or ~azure.mgmt.keyvault.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.models.ManagedHsmRotationPolicy - :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.models.ManagedHsmKeyReleasePolicy - """ - super().__init__(tags=tags, **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: Optional[str] = None - self.key_uri_with_version: Optional[str] = None - self.rotation_policy = rotation_policy - self.release_policy = release_policy - - -class ManagedHsmKeyAttributes(_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: int - :ivar expires: Expiry date in seconds since 1970-01-01T00:00:00Z. - :vartype expires: int - :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. - :vartype created: int - :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. - :vartype updated: int - :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", and - "Recoverable+ProtectedSubscription". - :vartype recovery_level: str or ~azure.mgmt.keyvault.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": "int"}, - "expires": {"key": "exp", "type": "int"}, - "created": {"key": "created", "type": "int"}, - "updated": {"key": "updated", "type": "int"}, - "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: Any - ) -> None: - """ - :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: int - :keyword expires: Expiry date in seconds since 1970-01-01T00:00:00Z. - :paramtype expires: int - :keyword exportable: Indicates if the private key can be exported. - :paramtype exportable: bool - """ - super().__init__(**kwargs) - self.enabled = enabled - self.not_before = not_before - self.expires = expires - self.created: Optional[int] = None - self.updated: Optional[int] = None - self.recovery_level: Optional[Union[str, "_models.DeletionRecoveryLevel"]] = None - self.exportable = exportable - - -class ManagedHsmKeyCreateParameters(_serialization.Model): - """The parameters used to create a key. - - All required parameters must be populated in order to send to server. - - :ivar tags: The tags that will be assigned to the key. - :vartype tags: dict[str, str] - :ivar properties: The properties of the key to be created. Required. - :vartype properties: ~azure.mgmt.keyvault.models.ManagedHsmKeyProperties - """ - - _validation = { - "properties": {"required": True}, - } - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "properties": {"key": "properties", "type": "ManagedHsmKeyProperties"}, - } - - def __init__( - self, *, properties: "_models.ManagedHsmKeyProperties", tags: Optional[dict[str, str]] = None, **kwargs: Any - ) -> None: - """ - :keyword tags: The tags that will be assigned to the key. - :paramtype tags: dict[str, str] - :keyword properties: The properties of the key to be created. Required. - :paramtype properties: ~azure.mgmt.keyvault.models.ManagedHsmKeyProperties - """ - super().__init__(**kwargs) - self.tags = tags - self.properties = properties - - -class ManagedHsmKeyListResult(_serialization.Model): - """The page of keys. - - :ivar value: The key resources. - :vartype value: list[~azure.mgmt.keyvault.models.ManagedHsmKey] - :ivar next_link: The URL to get the next page of keys. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ManagedHsmKey]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[list["_models.ManagedHsmKey"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The key resources. - :paramtype value: list[~azure.mgmt.keyvault.models.ManagedHsmKey] - :keyword next_link: The URL to get the next page of keys. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ManagedHsmKeyProperties(_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.models.ManagedHsmKeyAttributes - :ivar kty: The type of the key. For valid values, see JsonWebKeyType. Known values are: "EC", - "EC-HSM", "RSA", and "RSA-HSM". - :vartype kty: str or ~azure.mgmt.keyvault.models.JsonWebKeyType - :ivar key_ops: - :vartype key_ops: list[str or ~azure.mgmt.keyvault.models.JsonWebKeyOperation] - :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. Default for RSA - and RSA-HSM keys is 2048. Exception made for bring your own key (BYOK), key exchange keys - default to 4096. - :vartype key_size: int - :ivar curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Default - for EC and EC-HSM keys is P-256. Known values are: "P-256", "P-384", "P-521", and "P-256K". - :vartype curve_name: str or ~azure.mgmt.keyvault.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.models.ManagedHsmRotationPolicy - :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.models.ManagedHsmKeyReleasePolicy - """ - - _validation = { - "key_uri": {"readonly": True}, - "key_uri_with_version": {"readonly": True}, - } - - _attribute_map = { - "attributes": {"key": "attributes", "type": "ManagedHsmKeyAttributes"}, - "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": "ManagedHsmRotationPolicy"}, - "release_policy": {"key": "release_policy", "type": "ManagedHsmKeyReleasePolicy"}, - } - - def __init__( - self, - *, - attributes: Optional["_models.ManagedHsmKeyAttributes"] = 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.ManagedHsmRotationPolicy"] = None, - release_policy: Optional["_models.ManagedHsmKeyReleasePolicy"] = None, - **kwargs: Any - ) -> None: - """ - :keyword attributes: The attributes of the key. - :paramtype attributes: ~azure.mgmt.keyvault.models.ManagedHsmKeyAttributes - :keyword kty: The type of the key. For valid values, see JsonWebKeyType. Known values are: - "EC", "EC-HSM", "RSA", and "RSA-HSM". - :paramtype kty: str or ~azure.mgmt.keyvault.models.JsonWebKeyType - :keyword key_ops: - :paramtype key_ops: list[str or ~azure.mgmt.keyvault.models.JsonWebKeyOperation] - :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. Default for - RSA and RSA-HSM keys is 2048. Exception made for bring your own key (BYOK), key exchange keys - default to 4096. - :paramtype key_size: int - :keyword curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. - Default for EC and EC-HSM keys is P-256. Known values are: "P-256", "P-384", "P-521", and - "P-256K". - :paramtype curve_name: str or ~azure.mgmt.keyvault.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.models.ManagedHsmRotationPolicy - :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.models.ManagedHsmKeyReleasePolicy - """ - super().__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: Optional[str] = None - self.key_uri_with_version: Optional[str] = None - self.rotation_policy = rotation_policy - self.release_policy = release_policy - - -class ManagedHsmKeyReleasePolicy(_serialization.Model): - """ManagedHsmKeyReleasePolicy. - - :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: str = "application/json; charset=utf-8", data: Optional[bytes] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.content_type = content_type - self.data = data - - -class ManagedHsmKeyRotationPolicyAttributes(_serialization.Model): - """ManagedHsmKeyRotationPolicyAttributes. - - 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: int - :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. - :vartype updated: int - :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": "int"}, - "updated": {"key": "updated", "type": "int"}, - "expiry_time": {"key": "expiryTime", "type": "str"}, - } - - def __init__(self, *, expiry_time: Optional[str] = None, **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.created: Optional[int] = None - self.updated: Optional[int] = None - self.expiry_time = expiry_time - - -class ManagedHsmLifetimeAction(_serialization.Model): - """ManagedHsmLifetimeAction. - - :ivar trigger: The trigger of key rotation policy lifetimeAction. - :vartype trigger: ~azure.mgmt.keyvault.models.ManagedHsmTrigger - :ivar action: The action of key rotation policy lifetimeAction. - :vartype action: ~azure.mgmt.keyvault.models.ManagedHsmAction - """ - - _attribute_map = { - "trigger": {"key": "trigger", "type": "ManagedHsmTrigger"}, - "action": {"key": "action", "type": "ManagedHsmAction"}, - } - - def __init__( - self, - *, - trigger: Optional["_models.ManagedHsmTrigger"] = None, - action: Optional["_models.ManagedHsmAction"] = None, - **kwargs: Any - ) -> None: - """ - :keyword trigger: The trigger of key rotation policy lifetimeAction. - :paramtype trigger: ~azure.mgmt.keyvault.models.ManagedHsmTrigger - :keyword action: The action of key rotation policy lifetimeAction. - :paramtype action: ~azure.mgmt.keyvault.models.ManagedHsmAction - """ - super().__init__(**kwargs) - self.trigger = trigger - self.action = action - - -class ManagedHsmListResult(_serialization.Model): - """List of managed HSM Pools. - - :ivar value: The list of managed HSM Pools. - :vartype value: list[~azure.mgmt.keyvault.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: Any - ) -> None: - """ - :keyword value: The list of managed HSM Pools. - :paramtype value: list[~azure.mgmt.keyvault.models.ManagedHsm] - :keyword next_link: The URL to get the next set of managed HSM Pools. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ManagedHsmProperties(_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. Soft delete is enabled by default for all managed HSMs and - is immutable. - :vartype enable_soft_delete: bool - :ivar soft_delete_retention_in_days: Soft deleted data retention days. When you delete an HSM - or a key, it will remain recoverable for the configured retention period or for a default - period of 90 days. It accepts values between 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. 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" and "default". - :vartype create_mode: str or ~azure.mgmt.keyvault.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", and "Restoring". - :vartype provisioning_state: str or ~azure.mgmt.keyvault.models.ProvisioningState - :ivar network_acls: Rules governing the accessibility of the key vault from specific network - locations. - :vartype network_acls: ~azure.mgmt.keyvault.models.MHSMNetworkRuleSet - :ivar regions: List of all regions associated with the managed hsm pool. - :vartype regions: list[~azure.mgmt.keyvault.models.MHSMGeoReplicatedRegion] - :ivar private_endpoint_connections: List of private endpoint connections associated with the - managed hsm pool. - :vartype private_endpoint_connections: - list[~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnectionItem] - :ivar public_network_access: Control permission to the managed HSM from public networks. Known - values are: "Enabled" and "Disabled". - :vartype public_network_access: str or ~azure.mgmt.keyvault.models.PublicNetworkAccess - :ivar scheduled_purge_date: The scheduled purge date in UTC. - :vartype scheduled_purge_date: ~datetime.datetime - :ivar security_domain_properties: Managed HSM security domain properties. - :vartype security_domain_properties: - ~azure.mgmt.keyvault.models.ManagedHSMSecurityDomainProperties - """ - - _validation = { - "hsm_uri": {"readonly": True}, - "status_message": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "private_endpoint_connections": {"readonly": True}, - "scheduled_purge_date": {"readonly": True}, - "security_domain_properties": {"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"}, - "regions": {"key": "regions", "type": "[MHSMGeoReplicatedRegion]"}, - "private_endpoint_connections": { - "key": "privateEndpointConnections", - "type": "[MHSMPrivateEndpointConnectionItem]", - }, - "public_network_access": {"key": "publicNetworkAccess", "type": "str"}, - "scheduled_purge_date": {"key": "scheduledPurgeDate", "type": "iso-8601"}, - "security_domain_properties": {"key": "securityDomainProperties", "type": "ManagedHSMSecurityDomainProperties"}, - } - - def __init__( - self, - *, - tenant_id: Optional[str] = None, - initial_admin_object_ids: Optional[list[str]] = None, - enable_soft_delete: bool = True, - soft_delete_retention_in_days: int = 90, - enable_purge_protection: bool = True, - create_mode: Optional[Union[str, "_models.CreateMode"]] = None, - network_acls: Optional["_models.MHSMNetworkRuleSet"] = None, - regions: Optional[list["_models.MHSMGeoReplicatedRegion"]] = None, - public_network_access: Union[str, "_models.PublicNetworkAccess"] = "Enabled", - **kwargs: Any - ) -> None: - """ - :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. Soft delete is enabled by default for all managed HSMs and - is immutable. - :paramtype enable_soft_delete: bool - :keyword soft_delete_retention_in_days: Soft deleted data retention days. When you delete an - HSM or a key, it will remain recoverable for the configured retention period or for a default - period of 90 days. It accepts values between 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. 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" and "default". - :paramtype create_mode: str or ~azure.mgmt.keyvault.models.CreateMode - :keyword network_acls: Rules governing the accessibility of the key vault from specific network - locations. - :paramtype network_acls: ~azure.mgmt.keyvault.models.MHSMNetworkRuleSet - :keyword regions: List of all regions associated with the managed hsm pool. - :paramtype regions: list[~azure.mgmt.keyvault.models.MHSMGeoReplicatedRegion] - :keyword public_network_access: Control permission to the managed HSM from public networks. - Known values are: "Enabled" and "Disabled". - :paramtype public_network_access: str or ~azure.mgmt.keyvault.models.PublicNetworkAccess - """ - super().__init__(**kwargs) - self.tenant_id = tenant_id - self.initial_admin_object_ids = initial_admin_object_ids - self.hsm_uri: Optional[str] = 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: Optional[str] = None - self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None - self.network_acls = network_acls - self.regions = regions - self.private_endpoint_connections: Optional[list["_models.MHSMPrivateEndpointConnectionItem"]] = None - self.public_network_access = public_network_access - self.scheduled_purge_date: Optional[datetime.datetime] = None - self.security_domain_properties: Optional["_models.ManagedHSMSecurityDomainProperties"] = None - - -class ManagedHsmRotationPolicy(_serialization.Model): - """ManagedHsmRotationPolicy. - - :ivar attributes: The attributes of key rotation policy. - :vartype attributes: ~azure.mgmt.keyvault.models.ManagedHsmKeyRotationPolicyAttributes - :ivar lifetime_actions: The lifetimeActions for key rotation action. - :vartype lifetime_actions: list[~azure.mgmt.keyvault.models.ManagedHsmLifetimeAction] - """ - - _attribute_map = { - "attributes": {"key": "attributes", "type": "ManagedHsmKeyRotationPolicyAttributes"}, - "lifetime_actions": {"key": "lifetimeActions", "type": "[ManagedHsmLifetimeAction]"}, - } - - def __init__( - self, - *, - attributes: Optional["_models.ManagedHsmKeyRotationPolicyAttributes"] = None, - lifetime_actions: Optional[list["_models.ManagedHsmLifetimeAction"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword attributes: The attributes of key rotation policy. - :paramtype attributes: ~azure.mgmt.keyvault.models.ManagedHsmKeyRotationPolicyAttributes - :keyword lifetime_actions: The lifetimeActions for key rotation action. - :paramtype lifetime_actions: list[~azure.mgmt.keyvault.models.ManagedHsmLifetimeAction] - """ - super().__init__(**kwargs) - self.attributes = attributes - self.lifetime_actions = lifetime_actions - - -class ManagedHSMSecurityDomainProperties(_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", and "Failed". - :vartype activation_status: str or ~azure.mgmt.keyvault.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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.activation_status: Optional[Union[str, "_models.ActivationStatus"]] = None - self.activation_status_message: Optional[str] = None - - -class ManagedHsmSku(_serialization.Model): - """SKU details. - - All required parameters must be populated in order to send to server. - - :ivar family: SKU Family of the managed HSM Pool. Known values are: "B" and "C". - :vartype family: str or ~azure.mgmt.keyvault.models.ManagedHsmSkuFamily - :ivar name: SKU of the managed HSM Pool. Required. Known values are: "Standard_B1", - "Custom_B32", "Custom_B6", "Custom_C42", and "Custom_C10". - :vartype name: str or ~azure.mgmt.keyvault.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: Any - ) -> None: - """ - :keyword family: SKU Family of the managed HSM Pool. Known values are: "B" and "C". - :paramtype family: str or ~azure.mgmt.keyvault.models.ManagedHsmSkuFamily - :keyword name: SKU of the managed HSM Pool. Required. Known values are: "Standard_B1", - "Custom_B32", "Custom_B6", "Custom_C42", and "Custom_C10". - :paramtype name: str or ~azure.mgmt.keyvault.models.ManagedHsmSkuName - """ - super().__init__(**kwargs) - self.family = family - self.name = name - - -class ManagedHsmTrigger(_serialization.Model): - """ManagedHsmTrigger. - - :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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.time_after_create = time_after_create - self.time_before_expiry = time_before_expiry - - -class ManagedServiceIdentity(_serialization.Model): - """Managed service identity (system assigned and/or user assigned identities). - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar principal_id: The service principal ID of the system assigned identity. This property - will only be provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be - provided for a system assigned identity. - :vartype tenant_id: str - :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types - are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.keyvault.models.ManagedServiceIdentityType - :ivar user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - The dictionary values can be empty objects ({}) in requests. - :vartype user_assigned_identities: dict[str, ~azure.mgmt.keyvault.models.UserAssignedIdentity] - """ - - _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - "type": {"required": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, - } - - def __init__( - self, - *, - type: Union[str, "_models.ManagedServiceIdentityType"], - user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentity"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of managed service identity (where both SystemAssigned and UserAssigned - types are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.keyvault.models.ManagedServiceIdentityType - :keyword user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - The dictionary values can be empty objects ({}) in requests. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.keyvault.models.UserAssignedIdentity] - """ - super().__init__(**kwargs) - self.principal_id: Optional[str] = None - self.tenant_id: Optional[str] = None - self.type = type - self.user_assigned_identities = user_assigned_identities - - -class MetricSpecification(_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.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: Any - ) -> None: - """ - :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.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().__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 MHSMGeoReplicatedRegion(_serialization.Model): - """A region that this managed HSM Pool has been extended to. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the geo replicated region. - :vartype name: str - :ivar provisioning_state: Provisioning state of the geo replicated region. Known values are: - "Preprovisioning", "Provisioning", "Succeeded", "Failed", "Deleting", and "Cleanup". - :vartype provisioning_state: str or - ~azure.mgmt.keyvault.models.GeoReplicationRegionProvisioningState - :ivar is_primary: A boolean value that indicates whether the region is the primary region or a - secondary region. - :vartype is_primary: bool - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "is_primary": {"key": "isPrimary", "type": "bool"}, - } - - def __init__(self, *, name: Optional[str] = None, is_primary: Optional[bool] = None, **kwargs: Any) -> None: - """ - :keyword name: Name of the geo replicated region. - :paramtype name: str - :keyword is_primary: A boolean value that indicates whether the region is the primary region or - a secondary region. - :paramtype is_primary: bool - """ - super().__init__(**kwargs) - self.name = name - self.provisioning_state: Optional[Union[str, "_models.GeoReplicationRegionProvisioningState"]] = None - self.is_primary = is_primary - - -class MHSMIPRule(_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 server. - - :ivar value: 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). Required. - :vartype value: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "str"}, - } - - def __init__(self, *, value: str, **kwargs: Any) -> None: - """ - :keyword value: 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). Required. - :paramtype value: str - """ - super().__init__(**kwargs) - self.value = value - - -class MHSMNetworkRuleSet(_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" and - "None". - :vartype bypass: str or ~azure.mgmt.keyvault.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" and "Deny". - :vartype default_action: str or ~azure.mgmt.keyvault.models.NetworkRuleAction - :ivar ip_rules: The list of IP address rules. - :vartype ip_rules: list[~azure.mgmt.keyvault.models.MHSMIPRule] - :ivar service_tags: The list of service tags. - :vartype service_tags: list[~azure.mgmt.keyvault.models.MHSMServiceTagRule] - :ivar virtual_network_rules: The list of virtual network rules. - :vartype virtual_network_rules: list[~azure.mgmt.keyvault.models.MHSMVirtualNetworkRule] - """ - - _attribute_map = { - "bypass": {"key": "bypass", "type": "str"}, - "default_action": {"key": "defaultAction", "type": "str"}, - "ip_rules": {"key": "ipRules", "type": "[MHSMIPRule]"}, - "service_tags": {"key": "serviceTags", "type": "[MHSMServiceTagRule]"}, - "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, - service_tags: Optional[list["_models.MHSMServiceTagRule"]] = None, - virtual_network_rules: Optional[list["_models.MHSMVirtualNetworkRule"]] = None, - **kwargs: Any - ) -> None: - """ - :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" and - "None". - :paramtype bypass: str or ~azure.mgmt.keyvault.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" and "Deny". - :paramtype default_action: str or ~azure.mgmt.keyvault.models.NetworkRuleAction - :keyword ip_rules: The list of IP address rules. - :paramtype ip_rules: list[~azure.mgmt.keyvault.models.MHSMIPRule] - :keyword service_tags: The list of service tags. - :paramtype service_tags: list[~azure.mgmt.keyvault.models.MHSMServiceTagRule] - :keyword virtual_network_rules: The list of virtual network rules. - :paramtype virtual_network_rules: list[~azure.mgmt.keyvault.models.MHSMVirtualNetworkRule] - """ - super().__init__(**kwargs) - self.bypass = bypass - self.default_action = default_action - self.ip_rules = ip_rules - self.service_tags = service_tags - self.virtual_network_rules = virtual_network_rules - - -class MHSMPrivateEndpoint(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id: Optional[str] = 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.models.ManagedHsmSku - :ivar 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.models.SystemData - :ivar identity: Managed service identity (system assigned and/or user assigned identities). - :vartype identity: ~azure.mgmt.keyvault.models.ManagedServiceIdentity - :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.models.MHSMPrivateEndpoint - :ivar private_link_service_connection_state: Approval state of the private link connection. - :vartype private_link_service_connection_state: - ~azure.mgmt.keyvault.models.MHSMPrivateLinkServiceConnectionState - :ivar provisioning_state: Provisioning state of the private endpoint connection. Known values - are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", and "Disconnected". - :vartype provisioning_state: str or - ~azure.mgmt.keyvault.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"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "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, - identity: Optional["_models.ManagedServiceIdentity"] = 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: Any - ) -> None: - """ - :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.models.ManagedHsmSku - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword identity: Managed service identity (system assigned and/or user assigned identities). - :paramtype identity: ~azure.mgmt.keyvault.models.ManagedServiceIdentity - :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.models.MHSMPrivateEndpoint - :keyword private_link_service_connection_state: Approval state of the private link connection. - :paramtype private_link_service_connection_state: - ~azure.mgmt.keyvault.models.MHSMPrivateLinkServiceConnectionState - :keyword provisioning_state: Provisioning state of the private endpoint connection. Known - values are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", and "Disconnected". - :paramtype provisioning_state: str or - ~azure.mgmt.keyvault.models.PrivateEndpointConnectionProvisioningState - """ - super().__init__(location=location, sku=sku, tags=tags, identity=identity, **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(_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.models.MHSMPrivateEndpoint - :ivar private_link_service_connection_state: Approval state of the private link connection. - :vartype private_link_service_connection_state: - ~azure.mgmt.keyvault.models.MHSMPrivateLinkServiceConnectionState - :ivar provisioning_state: Provisioning state of the private endpoint connection. Known values - are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", and "Disconnected". - :vartype provisioning_state: str or - ~azure.mgmt.keyvault.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, # pylint: disable=redefined-builtin - 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: Any - ) -> None: - """ - :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.models.MHSMPrivateEndpoint - :keyword private_link_service_connection_state: Approval state of the private link connection. - :paramtype private_link_service_connection_state: - ~azure.mgmt.keyvault.models.MHSMPrivateLinkServiceConnectionState - :keyword provisioning_state: Provisioning state of the private endpoint connection. Known - values are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", and "Disconnected". - :paramtype provisioning_state: str or - ~azure.mgmt.keyvault.models.PrivateEndpointConnectionProvisioningState - """ - super().__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(_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.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: Any - ) -> None: - """ - :keyword value: The private endpoint connection associated with a managed HSM Pools. - :paramtype value: list[~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection] - :keyword next_link: The URL to get the next set of managed HSM Pools. - :paramtype next_link: str - """ - super().__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.models.ManagedHsmSku - :ivar 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.models.SystemData - :ivar identity: Managed service identity (system assigned and/or user assigned identities). - :vartype identity: ~azure.mgmt.keyvault.models.ManagedServiceIdentity - :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"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "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, - identity: Optional["_models.ManagedServiceIdentity"] = None, - required_zone_names: Optional[list[str]] = None, - **kwargs: Any - ) -> None: - """ - :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.models.ManagedHsmSku - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword identity: Managed service identity (system assigned and/or user assigned identities). - :paramtype identity: ~azure.mgmt.keyvault.models.ManagedServiceIdentity - :keyword required_zone_names: Required DNS zone names of the the private link resource. - :paramtype required_zone_names: list[str] - """ - super().__init__(location=location, sku=sku, tags=tags, identity=identity, **kwargs) - self.group_id: Optional[str] = None - self.required_members: Optional[list[str]] = None - self.required_zone_names = required_zone_names - - -class MHSMPrivateLinkResourceListResult(_serialization.Model): - """A list of private link resources. - - :ivar value: Array of private link resources. - :vartype value: list[~azure.mgmt.keyvault.models.MHSMPrivateLinkResource] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[MHSMPrivateLinkResource]"}, - } - - def __init__(self, *, value: Optional[list["_models.MHSMPrivateLinkResource"]] = None, **kwargs: Any) -> None: - """ - :keyword value: Array of private link resources. - :paramtype value: list[~azure.mgmt.keyvault.models.MHSMPrivateLinkResource] - """ - super().__init__(**kwargs) - self.value = value - - -class MHSMPrivateLinkServiceConnectionState(_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", and "Disconnected". - :vartype status: str or ~azure.mgmt.keyvault.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. "None" - :vartype actions_required: str or ~azure.mgmt.keyvault.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: Any - ) -> None: - """ - :keyword status: Indicates whether the connection has been approved, rejected or removed by the - key vault owner. Known values are: "Pending", "Approved", "Rejected", and "Disconnected". - :paramtype status: str or ~azure.mgmt.keyvault.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. "None" - :paramtype actions_required: str or ~azure.mgmt.keyvault.models.ActionsRequired - """ - super().__init__(**kwargs) - self.status = status - self.description = description - self.actions_required = actions_required - - -class MHSMRegionsListResult(_serialization.Model): - """List of regions associated with a managed HSM Pools. - - :ivar value: The region associated with a managed HSM Pools. - :vartype value: list[~azure.mgmt.keyvault.models.MHSMGeoReplicatedRegion] - :ivar next_link: The URL to get the next set of managed HSM Pools. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[MHSMGeoReplicatedRegion]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[list["_models.MHSMGeoReplicatedRegion"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The region associated with a managed HSM Pools. - :paramtype value: list[~azure.mgmt.keyvault.models.MHSMGeoReplicatedRegion] - :keyword next_link: The URL to get the next set of managed HSM Pools. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class MHSMServiceTagRule(_serialization.Model): - """A rule governing the accessibility of a managed hsm pool from a specific service tags. - - All required parameters must be populated in order to send to server. - - :ivar tag: Name of the service tag. Required. - :vartype tag: str - """ - - _validation = { - "tag": {"required": True}, - } - - _attribute_map = { - "tag": {"key": "tag", "type": "str"}, - } - - def __init__(self, *, tag: str, **kwargs: Any) -> None: - """ - :keyword tag: Name of the service tag. Required. - :paramtype tag: str - """ - super().__init__(**kwargs) - self.tag = tag - - -class MHSMVirtualNetworkRule(_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 server. - - :ivar id: Full resource id of a vnet subnet, such as - '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. - Required. - :vartype id: str - """ - - _validation = { - "id": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - } - - def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: Full resource id of a vnet subnet, such as - '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. - Required. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class NetworkRuleSet(_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" and - "None". - :vartype bypass: str or ~azure.mgmt.keyvault.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" and "Deny". - :vartype default_action: str or ~azure.mgmt.keyvault.models.NetworkRuleAction - :ivar ip_rules: The list of IP address rules. - :vartype ip_rules: list[~azure.mgmt.keyvault.models.IPRule] - :ivar virtual_network_rules: The list of virtual network rules. - :vartype virtual_network_rules: list[~azure.mgmt.keyvault.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: Any - ) -> None: - """ - :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" and - "None". - :paramtype bypass: str or ~azure.mgmt.keyvault.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" and "Deny". - :paramtype default_action: str or ~azure.mgmt.keyvault.models.NetworkRuleAction - :keyword ip_rules: The list of IP address rules. - :paramtype ip_rules: list[~azure.mgmt.keyvault.models.IPRule] - :keyword virtual_network_rules: The list of virtual network rules. - :paramtype virtual_network_rules: list[~azure.mgmt.keyvault.models.VirtualNetworkRule] - """ - super().__init__(**kwargs) - self.bypass = bypass - self.default_action = default_action - self.ip_rules = ip_rules - self.virtual_network_rules = virtual_network_rules - - -class Operation(_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.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.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: Any - ) -> None: - """ - :keyword name: Operation name: {provider}/{resource}/{operation}. - :paramtype name: str - :keyword display: Display metadata associated with the operation. - :paramtype display: ~azure.mgmt.keyvault.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.models.ServiceSpecification - """ - super().__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(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationListResult(_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.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: Any - ) -> None: - """ - :keyword value: List of Storage operations supported by the Storage resource provider. - :paramtype value: list[~azure.mgmt.keyvault.models.Operation] - :keyword next_link: The URL to get the next set of operations. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class Permissions(_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.models.KeyPermissions] - :ivar secrets: Permissions to secrets. - :vartype secrets: list[str or ~azure.mgmt.keyvault.models.SecretPermissions] - :ivar certificates: Permissions to certificates. - :vartype certificates: list[str or ~azure.mgmt.keyvault.models.CertificatePermissions] - :ivar storage: Permissions to storage accounts. - :vartype storage: list[str or ~azure.mgmt.keyvault.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: Any - ) -> None: - """ - :keyword keys: Permissions to keys. - :paramtype keys: list[str or ~azure.mgmt.keyvault.models.KeyPermissions] - :keyword secrets: Permissions to secrets. - :paramtype secrets: list[str or ~azure.mgmt.keyvault.models.SecretPermissions] - :keyword certificates: Permissions to certificates. - :paramtype certificates: list[str or ~azure.mgmt.keyvault.models.CertificatePermissions] - :keyword storage: Permissions to storage accounts. - :paramtype storage: list[str or ~azure.mgmt.keyvault.models.StoragePermissions] - """ - super().__init__(**kwargs) - self.keys = keys - self.secrets = secrets - self.certificates = certificates - self.storage = storage - - -class PrivateEndpoint(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id: Optional[str] = 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: 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.models.PrivateEndpoint - :ivar private_link_service_connection_state: Approval state of the private link connection. - :vartype private_link_service_connection_state: - ~azure.mgmt.keyvault.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: Provisioning state of the private endpoint connection. Known values - are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", and "Disconnected". - :vartype provisioning_state: str or - ~azure.mgmt.keyvault.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: Any - ) -> None: - """ - :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.models.PrivateEndpoint - :keyword private_link_service_connection_state: Approval state of the private link connection. - :paramtype private_link_service_connection_state: - ~azure.mgmt.keyvault.models.PrivateLinkServiceConnectionState - :keyword provisioning_state: Provisioning state of the private endpoint connection. Known - values are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", and "Disconnected". - :paramtype provisioning_state: str or - ~azure.mgmt.keyvault.models.PrivateEndpointConnectionProvisioningState - """ - super().__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(_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.models.PrivateEndpoint - :ivar private_link_service_connection_state: Approval state of the private link connection. - :vartype private_link_service_connection_state: - ~azure.mgmt.keyvault.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: Provisioning state of the private endpoint connection. Known values - are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", and "Disconnected". - :vartype provisioning_state: str or - ~azure.mgmt.keyvault.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, # pylint: disable=redefined-builtin - 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: Any - ) -> None: - """ - :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.models.PrivateEndpoint - :keyword private_link_service_connection_state: Approval state of the private link connection. - :paramtype private_link_service_connection_state: - ~azure.mgmt.keyvault.models.PrivateLinkServiceConnectionState - :keyword provisioning_state: Provisioning state of the private endpoint connection. Known - values are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", and "Disconnected". - :paramtype provisioning_state: str or - ~azure.mgmt.keyvault.models.PrivateEndpointConnectionProvisioningState - """ - super().__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(_serialization.Model): - """List of private endpoint connections. - - :ivar value: The list of private endpoint connections. - :vartype value: list[~azure.mgmt.keyvault.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: Any - ) -> None: - """ - :keyword value: The list of private endpoint connections. - :paramtype value: list[~azure.mgmt.keyvault.models.PrivateEndpointConnection] - :keyword next_link: The URL to get the next set of private endpoint connections. - :paramtype next_link: str - """ - super().__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: 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: Any) -> None: - """ - :keyword required_zone_names: Required DNS zone names of the the private link resource. - :paramtype required_zone_names: list[str] - """ - super().__init__(**kwargs) - self.group_id: Optional[str] = None - self.required_members: Optional[list[str]] = None - self.required_zone_names = required_zone_names - - -class PrivateLinkResourceListResult(_serialization.Model): - """A list of private link resources. - - :ivar value: Array of private link resources. - :vartype value: list[~azure.mgmt.keyvault.models.PrivateLinkResource] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[PrivateLinkResource]"}, - } - - def __init__(self, *, value: Optional[list["_models.PrivateLinkResource"]] = None, **kwargs: Any) -> None: - """ - :keyword value: Array of private link resources. - :paramtype value: list[~azure.mgmt.keyvault.models.PrivateLinkResource] - """ - super().__init__(**kwargs) - self.value = value - - -class PrivateLinkServiceConnectionState(_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", and "Disconnected". - :vartype status: str or ~azure.mgmt.keyvault.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. "None" - :vartype actions_required: str or ~azure.mgmt.keyvault.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: Any - ) -> None: - """ - :keyword status: Indicates whether the connection has been approved, rejected or removed by the - key vault owner. Known values are: "Pending", "Approved", "Rejected", and "Disconnected". - :paramtype status: str or ~azure.mgmt.keyvault.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. "None" - :paramtype actions_required: str or ~azure.mgmt.keyvault.models.ActionsRequired - """ - super().__init__(**kwargs) - self.status = status - self.description = description - self.actions_required = actions_required - - -class ResourceListResult(_serialization.Model): - """List of vault resources. - - :ivar value: The list of vault resources. - :vartype value: list[~azure.mgmt.keyvault.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: Any - ) -> None: - """ - :keyword value: The list of vault resources. - :paramtype value: list[~azure.mgmt.keyvault.models.Resource] - :keyword next_link: The URL to get the next set of vault resources. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class RotationPolicy(_serialization.Model): - """RotationPolicy. - - :ivar attributes: The attributes of key rotation policy. - :vartype attributes: ~azure.mgmt.keyvault.models.KeyRotationPolicyAttributes - :ivar lifetime_actions: The lifetimeActions for key rotation action. - :vartype lifetime_actions: list[~azure.mgmt.keyvault.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: Any - ) -> None: - """ - :keyword attributes: The attributes of key rotation policy. - :paramtype attributes: ~azure.mgmt.keyvault.models.KeyRotationPolicyAttributes - :keyword lifetime_actions: The lifetimeActions for key rotation action. - :paramtype lifetime_actions: list[~azure.mgmt.keyvault.models.LifetimeAction] - """ - super().__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 server. - - :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: Tags assigned to the key vault resource. - :vartype tags: dict[str, str] - :ivar properties: Properties of the secret. Required. - :vartype properties: ~azure.mgmt.keyvault.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: Any) -> None: - """ - :keyword properties: Properties of the secret. Required. - :paramtype properties: ~azure.mgmt.keyvault.models.SecretProperties - """ - super().__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 - """ - - -class SecretCreateOrUpdateParameters(_serialization.Model): - """Parameters for creating or updating a secret. - - All required parameters must be populated in order to send to server. - - :ivar tags: The tags that will be assigned to the secret. - :vartype tags: dict[str, str] - :ivar properties: Properties of the secret. Required. - :vartype properties: ~azure.mgmt.keyvault.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: Any - ) -> None: - """ - :keyword tags: The tags that will be assigned to the secret. - :paramtype tags: dict[str, str] - :keyword properties: Properties of the secret. Required. - :paramtype properties: ~azure.mgmt.keyvault.models.SecretProperties - """ - super().__init__(**kwargs) - self.tags = tags - self.properties = properties - - -class SecretListResult(_serialization.Model): - """List of secrets. - - :ivar value: The list of secrets. - :vartype value: list[~azure.mgmt.keyvault.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: Any - ) -> None: - """ - :keyword value: The list of secrets. - :paramtype value: list[~azure.mgmt.keyvault.models.Secret] - :keyword next_link: The URL to get the next set of secrets. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SecretPatchParameters(_serialization.Model): - """Parameters for patching a secret. - - :ivar 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.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: Any - ) -> None: - """ - :keyword 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.models.SecretPatchProperties - """ - super().__init__(**kwargs) - self.tags = tags - self.properties = properties - - -class SecretPatchProperties(_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.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: Any - ) -> None: - """ - :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.models.SecretAttributes - """ - super().__init__(**kwargs) - self.value = value - self.content_type = content_type - self.attributes = attributes - - -class SecretProperties(_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.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: Any - ) -> None: - """ - :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.models.SecretAttributes - """ - super().__init__(**kwargs) - self.value = value - self.content_type = content_type - self.attributes = attributes - self.secret_uri: Optional[str] = None - self.secret_uri_with_version: Optional[str] = None - - -class ServiceSpecification(_serialization.Model): - """One property of operation, include log specifications. - - :ivar log_specifications: Log specifications of operation. - :vartype log_specifications: list[~azure.mgmt.keyvault.models.LogSpecification] - :ivar metric_specifications: Metric specifications of operation. - :vartype metric_specifications: list[~azure.mgmt.keyvault.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: Any - ) -> None: - """ - :keyword log_specifications: Log specifications of operation. - :paramtype log_specifications: list[~azure.mgmt.keyvault.models.LogSpecification] - :keyword metric_specifications: Metric specifications of operation. - :paramtype metric_specifications: list[~azure.mgmt.keyvault.models.MetricSpecification] - """ - super().__init__(**kwargs) - self.log_specifications = log_specifications - self.metric_specifications = metric_specifications - - -class Sku(_serialization.Model): - """SKU details. - - All required parameters must be populated in order to send to server. - - :ivar family: SKU family name. "A" - :vartype family: str or ~azure.mgmt.keyvault.models.SkuFamily - :ivar name: SKU name to specify whether the key vault is a standard vault or a premium vault. - Required. Known values are: "standard" and "premium". - :vartype name: str or ~azure.mgmt.keyvault.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: Any - ) -> None: - """ - :keyword family: SKU family name. "A" - :paramtype family: str or ~azure.mgmt.keyvault.models.SkuFamily - :keyword name: SKU name to specify whether the key vault is a standard vault or a premium - vault. Required. Known values are: "standard" and "premium". - :paramtype name: str or ~azure.mgmt.keyvault.models.SkuName - """ - super().__init__(**kwargs) - self.family = family - self.name = name - - -class SystemData(_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", and "Key". - :vartype created_by_type: str or ~azure.mgmt.keyvault.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", and "Key". - :vartype last_modified_by_type: str or ~azure.mgmt.keyvault.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: Any - ) -> None: - """ - :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", and "Key". - :paramtype created_by_type: str or ~azure.mgmt.keyvault.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", and "Key". - :paramtype last_modified_by_type: str or ~azure.mgmt.keyvault.models.IdentityType - :keyword last_modified_at: The timestamp of the key vault resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__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(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.time_after_create = time_after_create - self.time_before_expiry = time_before_expiry - - -class UserAssignedIdentity(_serialization.Model): - """User assigned identity properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of the assigned identity. - :vartype principal_id: str - :ivar client_id: The client ID of the assigned identity. - :vartype client_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "client_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id: Optional[str] = None - self.client_id: Optional[str] = None - - -class Vault(_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 server. - - :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: 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.models.SystemData - :ivar properties: Properties of the vault. Required. - :vartype properties: ~azure.mgmt.keyvault.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: Any - ) -> None: - """ - :keyword location: Azure location of the key vault resource. - :paramtype location: str - :keyword tags: Tags assigned to the key vault resource. - :paramtype tags: dict[str, str] - :keyword properties: Properties of the vault. Required. - :paramtype properties: ~azure.mgmt.keyvault.models.VaultProperties - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.location = location - self.tags = tags - self.system_data: Optional["_models.SystemData"] = None - self.properties = properties - - -class VaultAccessPolicyParameters(_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 server. - - :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: Properties of the access policy. Required. - :vartype properties: ~azure.mgmt.keyvault.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: Any) -> None: - """ - :keyword properties: Properties of the access policy. Required. - :paramtype properties: ~azure.mgmt.keyvault.models.VaultAccessPolicyProperties - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.location: Optional[str] = None - self.properties = properties - - -class VaultAccessPolicyProperties(_serialization.Model): - """Properties of the vault access policy. - - All required parameters must be populated in order to send to server. - - :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. Required. - :vartype access_policies: list[~azure.mgmt.keyvault.models.AccessPolicyEntry] - """ - - _validation = { - "access_policies": {"required": True}, - } - - _attribute_map = { - "access_policies": {"key": "accessPolicies", "type": "[AccessPolicyEntry]"}, - } - - def __init__(self, *, access_policies: list["_models.AccessPolicyEntry"], **kwargs: Any) -> None: - """ - :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. Required. - :paramtype access_policies: list[~azure.mgmt.keyvault.models.AccessPolicyEntry] - """ - super().__init__(**kwargs) - self.access_policies = access_policies - - -class VaultCheckNameAvailabilityParameters(_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 server. - - :ivar name: The vault name. Required. - :vartype name: str - :ivar type: The type of resource, Microsoft.KeyVault/vaults. Required. Default value is - "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: Any) -> None: - """ - :keyword name: The vault name. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class VaultCreateOrUpdateParameters(_serialization.Model): - """Parameters for creating or updating a vault. - - All required parameters must be populated in order to send to server. - - :ivar location: The supported Azure location where the key vault should be created. Required. - :vartype location: str - :ivar tags: The tags that will be assigned to the key vault. - :vartype tags: dict[str, str] - :ivar properties: Properties of the vault. Required. - :vartype properties: ~azure.mgmt.keyvault.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: Any - ) -> None: - """ - :keyword location: The supported Azure location where the key vault should be created. - Required. - :paramtype location: str - :keyword tags: The tags that will be assigned to the key vault. - :paramtype tags: dict[str, str] - :keyword properties: Properties of the vault. Required. - :paramtype properties: ~azure.mgmt.keyvault.models.VaultProperties - """ - super().__init__(**kwargs) - self.location = location - self.tags = tags - self.properties = properties - - -class VaultListResult(_serialization.Model): - """List of vaults. - - :ivar value: The list of vaults. - :vartype value: list[~azure.mgmt.keyvault.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: Any - ) -> None: - """ - :keyword value: The list of vaults. - :paramtype value: list[~azure.mgmt.keyvault.models.Vault] - :keyword next_link: The URL to get the next set of vaults. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class VaultPatchParameters(_serialization.Model): - """Parameters for creating or updating a vault. - - :ivar 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.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: Any - ) -> None: - """ - :keyword 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.models.VaultPatchProperties - """ - super().__init__(**kwargs) - self.tags = tags - self.properties = properties - - -class VaultPatchProperties(_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.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.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" and "default". - :vartype create_mode: str or ~azure.mgmt.keyvault.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.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: Any - ) -> None: - """ - :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.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.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" and "default". - :paramtype create_mode: str or ~azure.mgmt.keyvault.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.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().__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(_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 server. - - :ivar tenant_id: The Azure Active Directory tenant ID that should be used for authenticating - requests to the key vault. Required. - :vartype tenant_id: str - :ivar sku: SKU details. Required. - :vartype sku: ~azure.mgmt.keyvault.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.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" and "default". - :vartype create_mode: str or ~azure.mgmt.keyvault.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.models.NetworkRuleSet - :ivar provisioning_state: Provisioning state of the vault. Known values are: "Succeeded" and - "RegisteringDns". - :vartype provisioning_state: str or ~azure.mgmt.keyvault.models.VaultProvisioningState - :ivar private_endpoint_connections: List of private endpoint connections associated with the - key vault. - :vartype private_endpoint_connections: - list[~azure.mgmt.keyvault.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: bool = False, - enabled_for_disk_encryption: bool = False, - enabled_for_template_deployment: bool = False, - enable_soft_delete: bool = True, - soft_delete_retention_in_days: int = 90, - enable_rbac_authorization: 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: str = "enabled", - **kwargs: Any - ) -> None: - """ - :keyword tenant_id: The Azure Active Directory tenant ID that should be used for authenticating - requests to the key vault. Required. - :paramtype tenant_id: str - :keyword sku: SKU details. Required. - :paramtype sku: ~azure.mgmt.keyvault.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.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" and "default". - :paramtype create_mode: str or ~azure.mgmt.keyvault.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.models.NetworkRuleSet - :keyword provisioning_state: Provisioning state of the vault. Known values are: "Succeeded" and - "RegisteringDns". - :paramtype provisioning_state: str or ~azure.mgmt.keyvault.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().__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: Optional[str] = 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: Optional[list["_models.PrivateEndpointConnectionItem"]] = None - self.public_network_access = public_network_access - - -class VirtualNetworkRule(_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 server. - - :ivar id: Full resource id of a vnet subnet, such as - '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. - Required. - :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, # pylint: disable=redefined-builtin - ignore_missing_vnet_service_endpoint: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Full resource id of a vnet subnet, such as - '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. - Required. - :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().__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/models/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_patch.py index 8bcb627aa475..87676c65a8f0 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_patch.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_patch.py @@ -7,9 +7,9 @@ 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 + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/__init__.py index 2c20c64a2fa5..599afc490f41 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -12,34 +12,34 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._keys_operations import KeysOperations # type: ignore -from ._managed_hsm_keys_operations import ManagedHsmKeysOperations # type: ignore -from ._vaults_operations import VaultsOperations # type: ignore -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore -from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore -from ._managed_hsms_operations import ManagedHsmsOperations # type: ignore -from ._mhsm_private_endpoint_connections_operations import MHSMPrivateEndpointConnectionsOperations # type: ignore -from ._mhsm_private_link_resources_operations import MHSMPrivateLinkResourcesOperations # type: ignore -from ._mhsm_regions_operations import MHSMRegionsOperations # type: ignore from ._operations import Operations # type: ignore -from ._secrets_operations import SecretsOperations # type: ignore +from ._operations import VaultsOperations # type: ignore +from ._operations import PrivateEndpointConnectionsOperations # type: ignore +from ._operations import ManagedHsmsOperations # type: ignore +from ._operations import SecretsOperations # type: ignore +from ._operations import KeysOperations # type: ignore +from ._operations import ManagedHsmKeysOperations # type: ignore +from ._operations import PrivateLinkResourcesOperations # type: ignore +from ._operations import MHSMPrivateLinkResourcesOperations # type: ignore +from ._operations import MHSMRegionsOperations # type: ignore +from ._operations import MHSMPrivateEndpointConnectionsOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ - "KeysOperations", - "ManagedHsmKeysOperations", + "Operations", "VaultsOperations", "PrivateEndpointConnectionsOperations", - "PrivateLinkResourcesOperations", "ManagedHsmsOperations", - "MHSMPrivateEndpointConnectionsOperations", + "SecretsOperations", + "KeysOperations", + "ManagedHsmKeysOperations", + "PrivateLinkResourcesOperations", "MHSMPrivateLinkResourcesOperations", "MHSMRegionsOperations", - "Operations", - "SecretsOperations", + "MHSMPrivateEndpointConnectionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_keys_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_keys_operations.py deleted file mode 100644 index 4fb6595096c3..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_keys_operations.py +++ /dev/null @@ -1,662 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import KeyVaultManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_if_not_exist_request( - resource_group_name: str, vault_name: str, key_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}", - ) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, vault_name: str, key_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}", - ) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys", - ) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_version_request( - resource_group_name: str, vault_name: str, key_name: str, key_version: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - 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}", - ) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_versions_request( - resource_group_name: str, vault_name: str, key_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - 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", - ) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class KeysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.keyvault.KeyVaultManagementClient`'s - :attr:`keys` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - def create_if_not_exist( - self, - resource_group_name: str, - vault_name: str, - key_name: str, - parameters: _models.KeyCreateParameters, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param vault_name: The name of the key vault which contains the key to be created. Required. - :type vault_name: str - :param key_name: The name of the key to be created. The value you provide may be copied - globally for the purpose of running the service. The value provided should not include - personally identifiable or sensitive information. Required. - :type key_name: str - :param parameters: The parameters used to create the specified key. Required. - :type parameters: ~azure.mgmt.keyvault.models.KeyCreateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Key or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.Key - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_if_not_exist( - self, - resource_group_name: str, - vault_name: str, - key_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param vault_name: The name of the key vault which contains the key to be created. Required. - :type vault_name: str - :param key_name: The name of the key to be created. The value you provide may be copied - globally for the purpose of running the service. The value provided should not include - personally identifiable or sensitive information. Required. - :type key_name: str - :param parameters: The parameters used to create the specified key. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Key or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.Key - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_if_not_exist( - self, - resource_group_name: str, - vault_name: str, - key_name: str, - parameters: Union[_models.KeyCreateParameters, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param vault_name: The name of the key vault which contains the key to be created. Required. - :type vault_name: str - :param key_name: The name of the key to be created. The value you provide may be copied - globally for the purpose of running the service. The value provided should not include - personally identifiable or sensitive information. Required. - :type key_name: str - :param parameters: The parameters used to create the specified key. Is either a - KeyCreateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.keyvault.models.KeyCreateParameters or IO[bytes] - :return: Key or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.Key - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Key] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "KeyCreateParameters") - - _request = build_create_if_not_exist_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - key_name=key_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Key", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. Required. - :type resource_group_name: str - :param vault_name: The name of the vault which contains the key to be retrieved. Required. - :type vault_name: str - :param key_name: The name of the key to be retrieved. Required. - :type key_name: str - :return: Key or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.Key - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.Key] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - key_name=key_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Key", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> ItemPaged["_models.Key"]: - """Lists the keys in the specified key vault. - - :param resource_group_name: The name of the resource group which contains the specified key - vault. Required. - :type resource_group_name: str - :param vault_name: The name of the vault which contains the keys to be retrieved. Required. - :type vault_name: str - :return: An iterator like instance of either Key or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.models.Key] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.KeyListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("KeyListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get_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. Required. - :type resource_group_name: str - :param vault_name: The name of the vault which contains the key version to be retrieved. - Required. - :type vault_name: str - :param key_name: The name of the key version to be retrieved. Required. - :type key_name: str - :param key_version: The version of the key to be retrieved. Required. - :type key_version: str - :return: Key or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.Key - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.Key] = kwargs.pop("cls", None) - - _request = build_get_version_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - key_name=key_name, - key_version=key_version, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Key", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_versions( - self, resource_group_name: str, vault_name: str, key_name: str, **kwargs: Any - ) -> ItemPaged["_models.Key"]: - """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. Required. - :type resource_group_name: str - :param vault_name: The name of the vault which contains the key versions to be retrieved. - Required. - :type vault_name: str - :param key_name: The name of the key versions to be retrieved. Required. - :type key_name: str - :return: An iterator like instance of either Key or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.models.Key] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.KeyListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_versions_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - key_name=key_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("KeyListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_managed_hsm_keys_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_managed_hsm_keys_operations.py deleted file mode 100644 index b10970805f4a..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_managed_hsm_keys_operations.py +++ /dev/null @@ -1,686 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import KeyVaultManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_if_not_exist_request( - resource_group_name: str, name: str, key_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "name": _SERIALIZER.url( - "name", name, "str", max_length=24, min_length=3, pattern=r"^[A-Za-z]([A-Za-z0-9]|\-[A-Za-z0-9])+$" - ), - "keyName": _SERIALIZER.url("key_name", key_name, "str", pattern=r"^[a-zA-Z0-9-]{1,127}$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, name: str, key_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "name": _SERIALIZER.url( - "name", name, "str", max_length=24, min_length=3, pattern=r"^[A-Za-z]([A-Za-z0-9]|\-[A-Za-z0-9])+$" - ), - "keyName": _SERIALIZER.url("key_name", key_name, "str", pattern=r"^[a-zA-Z0-9-]{1,127}$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "name": _SERIALIZER.url( - "name", name, "str", max_length=24, min_length=3, pattern=r"^[A-Za-z]([A-Za-z0-9]|\-[A-Za-z0-9])+$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_version_request( - resource_group_name: str, name: str, key_name: str, key_version: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}/versions/{keyVersion}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "name": _SERIALIZER.url( - "name", name, "str", max_length=24, min_length=3, pattern=r"^[A-Za-z]([A-Za-z0-9]|\-[A-Za-z0-9])+$" - ), - "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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_versions_request( - resource_group_name: str, name: str, key_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}/versions", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "name": _SERIALIZER.url( - "name", name, "str", max_length=24, min_length=3, pattern=r"^[A-Za-z]([A-Za-z0-9]|\-[A-Za-z0-9])+$" - ), - "keyName": _SERIALIZER.url("key_name", key_name, "str", pattern=r"^[a-zA-Z0-9-]{1,127}$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ManagedHsmKeysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.keyvault.KeyVaultManagementClient`'s - :attr:`managed_hsm_keys` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - def create_if_not_exist( - self, - resource_group_name: str, - name: str, - key_name: str, - parameters: _models.ManagedHsmKeyCreateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ManagedHsmKey: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the Managed HSM Pool within the specified resource group. Required. - :type name: str - :param key_name: The name of the key to be created. The value you provide may be copied - globally for the purpose of running the service. The value provided should not include - personally identifiable or sensitive information. Required. - :type key_name: str - :param parameters: The parameters used to create the specified key. Required. - :type parameters: ~azure.mgmt.keyvault.models.ManagedHsmKeyCreateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ManagedHsmKey or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.ManagedHsmKey - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_if_not_exist( - self, - resource_group_name: str, - name: str, - key_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ManagedHsmKey: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the Managed HSM Pool within the specified resource group. Required. - :type name: str - :param key_name: The name of the key to be created. The value you provide may be copied - globally for the purpose of running the service. The value provided should not include - personally identifiable or sensitive information. Required. - :type key_name: str - :param parameters: The parameters used to create the specified key. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ManagedHsmKey or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.ManagedHsmKey - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_if_not_exist( - self, - resource_group_name: str, - name: str, - key_name: str, - parameters: Union[_models.ManagedHsmKeyCreateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.ManagedHsmKey: - """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. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the Managed HSM Pool within the specified resource group. Required. - :type name: str - :param key_name: The name of the key to be created. The value you provide may be copied - globally for the purpose of running the service. The value provided should not include - personally identifiable or sensitive information. Required. - :type key_name: str - :param parameters: The parameters used to create the specified key. Is either a - ManagedHsmKeyCreateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.keyvault.models.ManagedHsmKeyCreateParameters or IO[bytes] - :return: ManagedHsmKey or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.ManagedHsmKey - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ManagedHsmKey] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ManagedHsmKeyCreateParameters") - - _request = build_create_if_not_exist_request( - resource_group_name=resource_group_name, - name=name, - key_name=key_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ManagedHsmKey", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get(self, resource_group_name: str, name: str, key_name: str, **kwargs: Any) -> _models.ManagedHsmKey: - """Gets the current version of the specified key from the specified managed HSM. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the Managed HSM Pool within the specified resource group. Required. - :type name: str - :param key_name: The name of the key to be created. The value you provide may be copied - globally for the purpose of running the service. The value provided should not include - personally identifiable or sensitive information. Required. - :type key_name: str - :return: ManagedHsmKey or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.ManagedHsmKey - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ManagedHsmKey] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - name=name, - key_name=key_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ManagedHsmKey", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list(self, resource_group_name: str, name: str, **kwargs: Any) -> ItemPaged["_models.ManagedHsmKey"]: - """Lists the keys in the specified managed HSM. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the Managed HSM Pool within the specified resource group. Required. - :type name: str - :return: An iterator like instance of either ManagedHsmKey or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.models.ManagedHsmKey] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ManagedHsmKeyListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ManagedHsmKeyListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get_version( - self, resource_group_name: str, name: str, key_name: str, key_version: str, **kwargs: Any - ) -> _models.ManagedHsmKey: - """Gets the specified version of the specified key in the specified managed HSM. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the Managed HSM Pool within the specified resource group. Required. - :type name: str - :param key_name: The name of the key to be created. The value you provide may be copied - globally for the purpose of running the service. The value provided should not include - personally identifiable or sensitive information. Required. - :type key_name: str - :param key_version: The version of the key to be retrieved. Required. - :type key_version: str - :return: ManagedHsmKey or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.ManagedHsmKey - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ManagedHsmKey] = kwargs.pop("cls", None) - - _request = build_get_version_request( - resource_group_name=resource_group_name, - name=name, - key_name=key_name, - key_version=key_version, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ManagedHsmKey", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_versions( - self, resource_group_name: str, name: str, key_name: str, **kwargs: Any - ) -> ItemPaged["_models.ManagedHsmKey"]: - """Lists the versions of the specified key in the specified managed HSM. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param name: The name of the Managed HSM Pool within the specified resource group. Required. - :type name: str - :param key_name: The name of the key to be created. The value you provide may be copied - globally for the purpose of running the service. The value provided should not include - personally identifiable or sensitive information. Required. - :type key_name: str - :return: An iterator like instance of either ManagedHsmKey or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.models.ManagedHsmKey] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ManagedHsmKeyListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_versions_request( - resource_group_name=resource_group_name, - name=name, - key_name=key_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ManagedHsmKeyListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_managed_hsms_operations.py deleted file mode 100644 index 6c8abddbb30d..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_managed_hsms_operations.py +++ /dev/null @@ -1,1396 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import KeyVaultManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_or_update_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}", - ) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}", - ) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}", - ) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}", - ) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}", - ) - path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), - "location": _SERIALIZER.url("location", location, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_purge_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}/purge", - ) - path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), - "location": _SERIALIZER.url("location", location, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_check_mhsm_name_availability_request( # pylint: disable=name-too-long - subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkMhsmNameAvailability" - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ManagedHsmsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.keyvault.KeyVaultManagementClient`'s - :attr:`managed_hsms` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - def _create_or_update_initial( - self, resource_group_name: str, name: str, parameters: Union[_models.ManagedHsm, IO[bytes]], **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ManagedHsm") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - name: str, - parameters: _models.ManagedHsm, - *, - content_type: str = "application/json", - **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. - Required. - :type resource_group_name: str - :param name: Name of the managed HSM Pool. Required. - :type name: str - :param parameters: Parameters to create or update the managed HSM Pool. Required. - :type parameters: ~azure.mgmt.keyvault.models.ManagedHsm - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ManagedHsm or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.models.ManagedHsm] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. - Required. - :type resource_group_name: str - :param name: Name of the managed HSM Pool. Required. - :type name: str - :param parameters: Parameters to create or update the managed HSM Pool. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ManagedHsm or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.models.ManagedHsm] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, resource_group_name: str, name: str, parameters: Union[_models.ManagedHsm, IO[bytes]], **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. - Required. - :type resource_group_name: str - :param name: Name of the managed HSM Pool. Required. - :type name: str - :param parameters: Parameters to create or update the managed HSM Pool. Is either a ManagedHsm - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.keyvault.models.ManagedHsm or IO[bytes] - :return: An instance of LROPoller that returns either ManagedHsm or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ManagedHsm] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - name=name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ManagedHsm", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ManagedHsm].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ManagedHsm]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, resource_group_name: str, name: str, parameters: Union[_models.ManagedHsm, IO[bytes]], **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ManagedHsm") - - _request = build_update_request( - resource_group_name=resource_group_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - name: str, - parameters: _models.ManagedHsm, - *, - content_type: str = "application/json", - **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. - Required. - :type resource_group_name: str - :param name: Name of the managed HSM Pool. Required. - :type name: str - :param parameters: Parameters to patch the managed HSM Pool. Required. - :type parameters: ~azure.mgmt.keyvault.models.ManagedHsm - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ManagedHsm or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.models.ManagedHsm] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. - Required. - :type resource_group_name: str - :param name: Name of the managed HSM Pool. Required. - :type name: str - :param parameters: Parameters to patch the managed HSM Pool. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ManagedHsm or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.models.ManagedHsm] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, resource_group_name: str, name: str, parameters: Union[_models.ManagedHsm, IO[bytes]], **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. - Required. - :type resource_group_name: str - :param name: Name of the managed HSM Pool. Required. - :type name: str - :param parameters: Parameters to patch the managed HSM Pool. Is either a ManagedHsm type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.keyvault.models.ManagedHsm or IO[bytes] - :return: An instance of LROPoller that returns either ManagedHsm or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ManagedHsm] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - name=name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ManagedHsm", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ManagedHsm].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ManagedHsm]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete(self, resource_group_name: str, 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. - Required. - :type resource_group_name: str - :param name: The name of the managed HSM Pool to delete. Required. - :type name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - name=name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def 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. - Required. - :type resource_group_name: str - :param name: The name of the managed HSM Pool. Required. - :type name: str - :return: ManagedHsm or None or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.ManagedHsm or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.ManagedHsm]] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> ItemPaged["_models.ManagedHsm"]: - """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. - Required. - :type resource_group_name: str - :param top: Maximum number of results to return. Default value is None. - :type top: int - :return: An iterator like instance of either ManagedHsm or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.models.ManagedHsm] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ManagedHsmListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - top=top, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ManagedHsmListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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) - - @distributed_trace - def list_by_subscription(self, top: Optional[int] = None, **kwargs: Any) -> ItemPaged["_models.ManagedHsm"]: - """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 - :return: An iterator like instance of either ManagedHsm or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.models.ManagedHsm] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ManagedHsmListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - top=top, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ManagedHsmListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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) - - @distributed_trace - def list_deleted(self, **kwargs: Any) -> ItemPaged["_models.DeletedManagedHsm"]: - """The List operation gets information about the deleted managed HSMs associated with the - subscription. - - :return: An iterator like instance of either DeletedManagedHsm or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.models.DeletedManagedHsm] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DeletedManagedHsmListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_deleted_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DeletedManagedHsmListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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) - - @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. Required. - :type name: str - :param location: The location of the deleted managed HSM. Required. - :type location: str - :return: DeletedManagedHsm or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.DeletedManagedHsm - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DeletedManagedHsm] = kwargs.pop("cls", None) - - _request = build_get_deleted_request( - name=name, - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DeletedManagedHsm", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_purge_deleted_request( - name=name, - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_purge_deleted(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. Required. - :type name: str - :param location: The location of the soft-deleted managed HSM. Required. - :type location: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._purge_deleted_initial( - name=name, - location=location, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @overload - def check_mhsm_name_availability( - self, - mhsm_name: _models.CheckMhsmNameAvailabilityParameters, - *, - content_type: str = "application/json", - **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. Required. - :type mhsm_name: ~azure.mgmt.keyvault.models.CheckMhsmNameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CheckMhsmNameAvailabilityResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.CheckMhsmNameAvailabilityResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_mhsm_name_availability( - self, mhsm_name: IO[bytes], *, content_type: str = "application/json", **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. Required. - :type mhsm_name: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CheckMhsmNameAvailabilityResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.CheckMhsmNameAvailabilityResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_mhsm_name_availability( - self, mhsm_name: Union[_models.CheckMhsmNameAvailabilityParameters, IO[bytes]], **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. Is either a CheckMhsmNameAvailabilityParameters - type or a IO[bytes] type. Required. - :type mhsm_name: ~azure.mgmt.keyvault.models.CheckMhsmNameAvailabilityParameters or IO[bytes] - :return: CheckMhsmNameAvailabilityResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.CheckMhsmNameAvailabilityResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CheckMhsmNameAvailabilityResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(mhsm_name, (IOBase, bytes)): - _content = mhsm_name - else: - _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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CheckMhsmNameAvailabilityResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_mhsm_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_mhsm_private_endpoint_connections_operations.py deleted file mode 100644 index 9ddbd45d8f8e..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_mhsm_private_endpoint_connections_operations.py +++ /dev/null @@ -1,616 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import KeyVaultManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_resource_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections", - ) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, name: str, private_endpoint_connection_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}", - ) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_put_request( - resource_group_name: str, name: str, private_endpoint_connection_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}", - ) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, name: str, private_endpoint_connection_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}", - ) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class MHSMPrivateEndpointConnectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.keyvault.KeyVaultManagementClient`'s - :attr:`mhsm_private_endpoint_connections` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = 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 - ) -> ItemPaged["_models.MHSMPrivateEndpointConnection"]: - """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. - Required. - :type resource_group_name: str - :param name: Name of the managed HSM Pool. Required. - :type name: str - :return: An iterator like instance of either MHSMPrivateEndpointConnection or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MHSMPrivateEndpointConnectionsListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_request( - resource_group_name=resource_group_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("MHSMPrivateEndpointConnectionsListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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) - - @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. - Required. - :type resource_group_name: str - :param name: Name of the managed HSM Pool. Required. - :type name: str - :param private_endpoint_connection_name: Name of the private endpoint connection associated - with the managed hsm pool. Required. - :type private_endpoint_connection_name: str - :return: MHSMPrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MHSMPrivateEndpointConnection] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - name=name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MHSMPrivateEndpointConnection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def put( - self, - resource_group_name: str, - name: str, - private_endpoint_connection_name: str, - properties: _models.MHSMPrivateEndpointConnection, - *, - content_type: str = "application/json", - **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. - Required. - :type resource_group_name: str - :param name: Name of the managed HSM Pool. Required. - :type name: str - :param private_endpoint_connection_name: Name of the private endpoint connection associated - with the managed hsm pool. Required. - :type private_endpoint_connection_name: str - :param properties: The intended state of private endpoint connection. Required. - :type properties: ~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MHSMPrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put( - self, - resource_group_name: str, - name: str, - private_endpoint_connection_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **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. - Required. - :type resource_group_name: str - :param name: Name of the managed HSM Pool. Required. - :type name: str - :param private_endpoint_connection_name: Name of the private endpoint connection associated - with the managed hsm pool. Required. - :type private_endpoint_connection_name: str - :param properties: The intended state of private endpoint connection. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: MHSMPrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put( - self, - resource_group_name: str, - name: str, - private_endpoint_connection_name: str, - properties: Union[_models.MHSMPrivateEndpointConnection, IO[bytes]], - **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. - Required. - :type resource_group_name: str - :param name: Name of the managed HSM Pool. Required. - :type name: str - :param private_endpoint_connection_name: Name of the private endpoint connection associated - with the managed hsm pool. Required. - :type private_endpoint_connection_name: str - :param properties: The intended state of private endpoint connection. Is either a - MHSMPrivateEndpointConnection type or a IO[bytes] type. Required. - :type properties: ~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection or IO[bytes] - :return: MHSMPrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MHSMPrivateEndpointConnection] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "MHSMPrivateEndpointConnection") - - _request = build_put_request( - resource_group_name=resource_group_name, - name=name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - 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.http_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - def _delete_initial( - self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - name=name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, 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. - Required. - :type resource_group_name: str - :param name: Name of the managed HSM Pool. Required. - :type name: str - :param private_endpoint_connection_name: Name of the private endpoint connection associated - with the managed hsm pool. Required. - :type private_endpoint_connection_name: str - :return: An instance of LROPoller that returns either MHSMPrivateEndpointConnection or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MHSMPrivateEndpointConnection] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - 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 - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MHSMPrivateEndpointConnection", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MHSMPrivateEndpointConnection].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MHSMPrivateEndpointConnection]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_mhsm_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_mhsm_private_link_resources_operations.py deleted file mode 100644 index cbec1503185f..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_mhsm_private_link_resources_operations.py +++ /dev/null @@ -1,144 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import KeyVaultManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_mhsm_resource_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateLinkResources", - ) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class MHSMPrivateLinkResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.keyvault.KeyVaultManagementClient`'s - :attr:`mhsm_private_link_resources` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = 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. - Required. - :type resource_group_name: str - :param name: Name of the managed HSM Pool. Required. - :type name: str - :return: MHSMPrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.MHSMPrivateLinkResourceListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MHSMPrivateLinkResourceListResult] = kwargs.pop("cls", None) - - _request = build_list_by_mhsm_resource_request( - resource_group_name=resource_group_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MHSMPrivateLinkResourceListResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_mhsm_regions_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_mhsm_regions_operations.py deleted file mode 100644 index 68c0ac233d7e..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_mhsm_regions_operations.py +++ /dev/null @@ -1,174 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import KeyVaultManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_resource_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/regions", - ) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class MHSMRegionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.keyvault.KeyVaultManagementClient`'s - :attr:`mhsm_regions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = 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 - ) -> ItemPaged["_models.MHSMGeoReplicatedRegion"]: - """The List operation gets information about the regions associated with the managed HSM Pool. - - :param resource_group_name: Name of the resource group that contains the managed HSM pool. - Required. - :type resource_group_name: str - :param name: Name of the managed HSM Pool. Required. - :type name: str - :return: An iterator like instance of either MHSMGeoReplicatedRegion or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.models.MHSMGeoReplicatedRegion] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MHSMRegionsListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_request( - resource_group_name=resource_group_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("MHSMRegionsListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py index 5e3597b6259c..17d087886574 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py @@ -1,12 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar +from io import IOBase +import json +from typing import Any, Callable, IO, Iterator, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import PipelineClient @@ -16,28 +19,34 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._configuration import KeyVaultManagementClientConfiguration +from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request(**kwargs: Any) -> HttpRequest: +def build_operations_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -45,7 +54,1344 @@ def build_list_request(**kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.KeyVault/operations") + _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) + + +def build_vaults_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}" + 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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_vaults_create_or_update_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}" + 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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_vaults_update_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}" + 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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_vaults_delete_request( + resource_group_name: str, vault_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}" + 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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_vaults_list_by_resource_group_request( # pylint: disable=name-too-long + 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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_vaults_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, *, top: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_vaults_update_access_policy_request( # pylint: disable=name-too-long + resource_group_name: str, + vault_name: str, + operation_kind: Union[str, _models.AccessPolicyUpdateKind], + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}" + 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"), + "operationKind": _SERIALIZER.url("operation_kind", operation_kind, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_vaults_get_deleted_request(vault_name: str, location: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}" + path_format_arguments = { + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_vaults_purge_deleted_request(vault_name: str, location: str, **kwargs: Any) -> HttpRequest: + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge" + path_format_arguments = { + "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + return HttpRequest(method="POST", url=_url, **kwargs) + + +def build_vaults_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_vaults_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: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop("filter") + api_version: Literal["2015-11-01"] = kwargs.pop("api_version") + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resources" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _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_vaults_check_name_availability_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_private_endpoint_connections_get_request( # pylint: disable=name-too-long + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}" + 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"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_private_endpoint_connections_put_request( # pylint: disable=name-too-long + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}" + 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"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_private_endpoint_connections_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}" + 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"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_private_endpoint_connections_list_by_resource_request( # pylint: disable=name-too-long + 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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections" + 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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_managed_hsms_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}" + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_managed_hsms_create_or_update_request( # pylint: disable=name-too-long + 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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}" + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_managed_hsms_update_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}" + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_managed_hsms_delete_request( + resource_group_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}" + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_managed_hsms_list_by_resource_group_request( # pylint: disable=name-too-long + 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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_managed_hsms_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, *, top: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/managedHSMs" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_managed_hsms_get_deleted_request(name: str, location: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_managed_hsms_purge_deleted_request(name: str, location: str, **kwargs: Any) -> HttpRequest: + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}/purge" + path_format_arguments = { + "name": _SERIALIZER.url("name", name, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + return HttpRequest(method="POST", url=_url, **kwargs) + + +def build_managed_hsms_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedManagedHSMs" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_managed_hsms_check_mhsm_name_availability_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkMhsmNameAvailability" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_secrets_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}" + 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"), + "secretName": _SERIALIZER.url("secret_name", secret_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_secrets_create_or_update_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}" + 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"), + "secretName": _SERIALIZER.url("secret_name", secret_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_secrets_update_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}" + 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"), + "secretName": _SERIALIZER.url("secret_name", secret_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_secrets_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets" + 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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_keys_get_request( + resource_group_name: str, vault_name: str, key_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}" + 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"), + "keyName": _SERIALIZER.url("key_name", key_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_keys_create_if_not_exist_request( + resource_group_name: str, vault_name: str, key_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}" + 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"), + "keyName": _SERIALIZER.url("key_name", key_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_keys_list_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys" + 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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_keys_get_version_request( + resource_group_name: str, vault_name: str, key_name: str, key_version: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions/{keyVersion}" + 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"), + "keyName": _SERIALIZER.url("key_name", key_name, "str"), + "keyVersion": _SERIALIZER.url("key_version", key_version, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_keys_list_versions_request( + resource_group_name: str, vault_name: str, key_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions" + 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"), + "keyName": _SERIALIZER.url("key_name", key_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_managed_hsm_keys_get_request( + resource_group_name: str, name: str, key_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}" + 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"), + "keyName": _SERIALIZER.url("key_name", key_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_managed_hsm_keys_create_if_not_exist_request( # pylint: disable=name-too-long + resource_group_name: str, name: str, key_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}" + 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"), + "keyName": _SERIALIZER.url("key_name", key_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_managed_hsm_keys_list_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys" + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_managed_hsm_keys_get_version_request( # pylint: disable=name-too-long + resource_group_name: str, name: str, key_name: str, key_version: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}/versions/{keyVersion}" + 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"), + "keyName": _SERIALIZER.url("key_name", key_name, "str"), + "keyVersion": _SERIALIZER.url("key_version", key_version, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_managed_hsm_keys_list_versions_request( # pylint: disable=name-too-long + resource_group_name: str, name: str, key_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}/versions" + 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"), + "keyName": _SERIALIZER.url("key_name", key_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_private_link_resources_list_by_vault_request( # pylint: disable=name-too-long + 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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources" + 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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_mhsm_private_link_resources_list_by_mhsm_resource_request( # pylint: disable=name-too-long + 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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateLinkResources" + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_mhsm_regions_list_by_resource_request( # pylint: disable=name-too-long + 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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/regions" + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_mhsm_private_endpoint_connections_get_request( # pylint: disable=name-too-long + resource_group_name: str, name: str, private_endpoint_connection_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}" + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_mhsm_private_endpoint_connections_put_request( # pylint: disable=name-too-long + resource_group_name: str, name: str, private_endpoint_connection_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}" + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_mhsm_private_endpoint_connections_delete_request( # pylint: disable=name-too-long + resource_group_name: str, name: str, private_endpoint_connection_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}" + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_mhsm_private_endpoint_connections_list_by_resource_request( # pylint: disable=name-too-long + 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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections" + 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: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -63,10 +1409,4943 @@ class Operations: Instead, you should access the following operations through :class:`~azure.mgmt.keyvault.KeyVaultManagementClient`'s - :attr:`operations` attribute. + :attr:`operations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.Operation"]: + """List the operations for the provider. + + :return: An iterator like instance of Operation + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Operation], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class VaultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.KeyVaultManagementClient`'s + :attr:`vaults` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :return: Vault. The Vault is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Vault + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Vault] = kwargs.pop("cls", None) + + _request = build_vaults_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Vault, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + vault_name: str, + parameters: Union[_models.VaultCreateOrUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_vaults_create_or_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vault_name: str, + parameters: _models.VaultCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param parameters: Parameters to create or update the vault. Required. + :type parameters: ~azure.mgmt.keyvault.models.VaultCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Vault. The Vault is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.models.Vault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vault_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param parameters: Parameters to create or update the vault. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Vault. The Vault is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.models.Vault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + vault_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param parameters: Parameters to create or update the vault. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Vault. The Vault is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.models.Vault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + vault_name: str, + parameters: Union[_models.VaultCreateOrUpdateParameters, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param parameters: Parameters to create or update the vault. Is one of the following types: + VaultCreateOrUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.keyvault.models.VaultCreateOrUpdateParameters or JSON or + IO[bytes] + :return: An instance of LROPoller that returns Vault. The Vault is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.models.Vault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Vault] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Vault, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Vault].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Vault]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + def update( + self, + resource_group_name: str, + vault_name: str, + parameters: _models.VaultPatchParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Vault: + """Update a key vault in the specified subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param parameters: Parameters to patch the vault. Required. + :type parameters: ~azure.mgmt.keyvault.models.VaultPatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Vault. The Vault is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Vault + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + vault_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Vault: + """Update a key vault in the specified subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param parameters: Parameters to patch the vault. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Vault. The Vault is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Vault + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + vault_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Vault: + """Update a key vault in the specified subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param parameters: Parameters to patch the vault. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Vault. The Vault is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Vault + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + vault_name: str, + parameters: Union[_models.VaultPatchParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Vault: + """Update a key vault in the specified subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param parameters: Parameters to patch the vault. Is one of the following types: + VaultPatchParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.keyvault.models.VaultPatchParameters or JSON or IO[bytes] + :return: Vault. The Vault is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Vault + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Vault] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_vaults_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Vault, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_vaults_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, *, top: Optional[int] = None, **kwargs: Any + ) -> ItemPaged["_models.Vault"]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword top: Maximum number of results to return. Default value is None. + :paramtype top: int + :return: An iterator like instance of Vault + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.models.Vault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Vault]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_vaults_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Vault], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription(self, *, top: Optional[int] = None, **kwargs: Any) -> ItemPaged["_models.Vault"]: + """The List operation gets information about the vaults associated with the subscription. + + :keyword top: Maximum number of results to return. Default value is None. + :paramtype top: int + :return: An iterator like instance of Vault + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.models.Vault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Vault]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_vaults_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Vault], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @overload + def update_access_policy( + self, + resource_group_name: str, + vault_name: str, + operation_kind: Union[str, _models.AccessPolicyUpdateKind], + parameters: _models.VaultAccessPolicyParameters, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: Name of the vault. Required. + :type vault_name: str + :param operation_kind: Name of the operation. Known values are: "add", "replace", and "remove". + Required. + :type operation_kind: str or ~azure.mgmt.keyvault.models.AccessPolicyUpdateKind + :param parameters: Access policy to merge into the vault. Required. + :type parameters: ~azure.mgmt.keyvault.models.VaultAccessPolicyParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: VaultAccessPolicyParameters. The VaultAccessPolicyParameters is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.VaultAccessPolicyParameters + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_access_policy( + self, + resource_group_name: str, + vault_name: str, + operation_kind: Union[str, _models.AccessPolicyUpdateKind], + parameters: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: Name of the vault. Required. + :type vault_name: str + :param operation_kind: Name of the operation. Known values are: "add", "replace", and "remove". + Required. + :type operation_kind: str or ~azure.mgmt.keyvault.models.AccessPolicyUpdateKind + :param parameters: Access policy to merge into the vault. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: VaultAccessPolicyParameters. The VaultAccessPolicyParameters is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.VaultAccessPolicyParameters + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_access_policy( + self, + resource_group_name: str, + vault_name: str, + operation_kind: Union[str, _models.AccessPolicyUpdateKind], + parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: Name of the vault. Required. + :type vault_name: str + :param operation_kind: Name of the operation. Known values are: "add", "replace", and "remove". + Required. + :type operation_kind: str or ~azure.mgmt.keyvault.models.AccessPolicyUpdateKind + :param parameters: Access policy to merge into the vault. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: VaultAccessPolicyParameters. The VaultAccessPolicyParameters is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.VaultAccessPolicyParameters + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_access_policy( + self, + resource_group_name: str, + vault_name: str, + operation_kind: Union[str, _models.AccessPolicyUpdateKind], + parameters: Union[_models.VaultAccessPolicyParameters, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: Name of the vault. Required. + :type vault_name: str + :param operation_kind: Name of the operation. Known values are: "add", "replace", and "remove". + Required. + :type operation_kind: str or ~azure.mgmt.keyvault.models.AccessPolicyUpdateKind + :param parameters: Access policy to merge into the vault. Is one of the following types: + VaultAccessPolicyParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.keyvault.models.VaultAccessPolicyParameters or JSON or IO[bytes] + :return: VaultAccessPolicyParameters. The VaultAccessPolicyParameters is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.VaultAccessPolicyParameters + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VaultAccessPolicyParameters] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_vaults_update_access_policy_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + operation_kind=operation_kind, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.VaultAccessPolicyParameters, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. Required. + :type vault_name: str + :param location: The name of the Azure region. Required. + :type location: str + :return: DeletedVault. The DeletedVault is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.DeletedVault + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DeletedVault] = kwargs.pop("cls", None) + + _request = build_vaults_get_deleted_request( + vault_name=vault_name, + location=location, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DeletedVault, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _purge_deleted_initial(self, vault_name: str, location: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_vaults_purge_deleted_request( + vault_name=vault_name, + location=location, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_purge_deleted(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 vault. Required. + :type vault_name: str + :param location: The name of the Azure region. Required. + :type location: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._purge_deleted_initial( + vault_name=vault_name, + location=location, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_deleted(self, **kwargs: Any) -> ItemPaged["_models.DeletedVault"]: + """Gets information about the deleted vaults in a subscription. + + :return: An iterator like instance of DeletedVault + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.models.DeletedVault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DeletedVault]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_vaults_list_deleted_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DeletedVault], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, *, top: Optional[int] = None, **kwargs: Any) -> ItemPaged["_models.TrackedResource"]: + """The List operation gets information about the vaults associated with the subscription. + + :keyword top: Maximum number of results to return. Default value is None. + :paramtype top: int + :return: An iterator like instance of TrackedResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.models.TrackedResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop("filter") + api_version: Literal["2015-11-01"] = kwargs.pop("api_version") + cls: ClsType[List[_models.TrackedResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_vaults_list_request( + subscription_id=self._config.subscription_id, + top=top, + filter=filter, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.TrackedResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @overload + def check_name_availability( + self, + vault_name: _models.VaultCheckNameAvailabilityParameters, + *, + content_type: str = "application/json", + **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. Required. + :type vault_name: ~azure.mgmt.keyvault.models.VaultCheckNameAvailabilityParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityResult. The CheckNameAvailabilityResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, vault_name: JSON, *, content_type: str = "application/json", **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. Required. + :type vault_name: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityResult. The CheckNameAvailabilityResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, vault_name: IO[bytes], *, content_type: str = "application/json", **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. Required. + :type vault_name: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityResult. The CheckNameAvailabilityResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_name_availability( + self, vault_name: Union[_models.VaultCheckNameAvailabilityParameters, JSON, IO[bytes]], **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. Is one of the following types: + VaultCheckNameAvailabilityParameters, JSON, IO[bytes] Required. + :type vault_name: ~azure.mgmt.keyvault.models.VaultCheckNameAvailabilityParameters or JSON or + IO[bytes] + :return: CheckNameAvailabilityResult. The CheckNameAvailabilityResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.CheckNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(vault_name, (IOBase, bytes)): + _content = vault_name + else: + _content = json.dumps(vault_name, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_vaults_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CheckNameAvailabilityResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.KeyVaultManagementClient`'s + :attr:`private_endpoint_connections` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = 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: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection or None. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.PrivateEndpointConnection or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def put( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + properties: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates the specified private endpoint connection associated with the key vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. Required. + :type private_endpoint_connection_name: str + :param properties: The intended state of private endpoint connection. Required. + :type properties: ~azure.mgmt.keyvault.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def put( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates the specified private endpoint connection associated with the key vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. Required. + :type private_endpoint_connection_name: str + :param properties: The intended state of private endpoint connection. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def put( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates the specified private endpoint connection associated with the key vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. Required. + :type private_endpoint_connection_name: str + :param properties: The intended state of private endpoint connection. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def put( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + properties: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates the specified private endpoint connection associated with the key vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. Required. + :type private_endpoint_connection_name: str + :param properties: The intended state of private endpoint connection. Is one of the following + types: PrivateEndpointConnection, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.keyvault.models.PrivateEndpointConnection or JSON or IO[bytes] + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_private_endpoint_connections_put_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, 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") + ) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, resource_group_name: str, vault_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, 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: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. Required. + :type private_endpoint_connection_name: str + :return: An instance of LROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.PrivateEndpointConnection].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_resource( + self, resource_group_name: str, vault_name: str, **kwargs: Any + ) -> ItemPaged["_models.PrivateEndpointConnection"]: + """The List operation gets information about the private endpoint connections associated with the + vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :return: An iterator like instance of PrivateEndpointConnection + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_private_endpoint_connections_list_by_resource_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.PrivateEndpointConnection], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ManagedHsmsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.KeyVaultManagementClient`'s + :attr:`managed_hsms` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :return: ManagedHsm or None. The ManagedHsm is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.ManagedHsm or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Optional[_models.ManagedHsm]] = kwargs.pop("cls", None) + + _request = build_managed_hsms_get_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ManagedHsm, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, resource_group_name: str, name: str, parameters: Union[_models.ManagedHsm, JSON, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_managed_hsms_create_or_update_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + name: str, + parameters: _models.ManagedHsm, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedHsm]: + """Create or update a managed HSM Pool in the specified subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :param parameters: Parameters to create or update the managed HSM Pool. Required. + :type parameters: ~azure.mgmt.keyvault.models.ManagedHsm + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns ManagedHsm. The ManagedHsm is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.models.ManagedHsm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedHsm]: + """Create or update a managed HSM Pool in the specified subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :param parameters: Parameters to create or update the managed HSM Pool. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns ManagedHsm. The ManagedHsm is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.models.ManagedHsm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedHsm]: + """Create or update a managed HSM Pool in the specified subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :param parameters: Parameters to create or update the managed HSM Pool. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns ManagedHsm. The ManagedHsm is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.models.ManagedHsm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, name: str, parameters: Union[_models.ManagedHsm, JSON, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.ManagedHsm]: + """Create or update a managed HSM Pool in the specified subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :param parameters: Parameters to create or update the managed HSM Pool. Is one of the following + types: ManagedHsm, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.keyvault.models.ManagedHsm or JSON or IO[bytes] + :return: An instance of LROPoller that returns ManagedHsm. The ManagedHsm is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.models.ManagedHsm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ManagedHsm] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + name=name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ManagedHsm, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ManagedHsm].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ManagedHsm]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, resource_group_name: str, name: str, parameters: Union[_models.ManagedHsm, JSON, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_managed_hsms_update_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + name: str, + parameters: _models.ManagedHsm, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedHsm]: + """Update a managed HSM Pool in the specified subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :param parameters: Parameters to patch the managed HSM Pool. Required. + :type parameters: ~azure.mgmt.keyvault.models.ManagedHsm + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns ManagedHsm. The ManagedHsm is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.models.ManagedHsm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedHsm]: + """Update a managed HSM Pool in the specified subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :param parameters: Parameters to patch the managed HSM Pool. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns ManagedHsm. The ManagedHsm is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.models.ManagedHsm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedHsm]: + """Update a managed HSM Pool in the specified subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :param parameters: Parameters to patch the managed HSM Pool. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns ManagedHsm. The ManagedHsm is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.models.ManagedHsm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, resource_group_name: str, name: str, parameters: Union[_models.ManagedHsm, JSON, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.ManagedHsm]: + """Update a managed HSM Pool in the specified subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :param parameters: Parameters to patch the managed HSM Pool. Is one of the following types: + ManagedHsm, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.keyvault.models.ManagedHsm or JSON or IO[bytes] + :return: An instance of LROPoller that returns ManagedHsm. The ManagedHsm is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.models.ManagedHsm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ManagedHsm] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + name=name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ManagedHsm, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ManagedHsm].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ManagedHsm]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_managed_hsms_delete_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the specified managed HSM Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + name=name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, *, top: Optional[int] = None, **kwargs: Any + ) -> ItemPaged["_models.ManagedHsm"]: + """The List operation gets information about the managed HSM Pools associated with the + subscription and within the specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword top: Maximum number of results to return. Default value is None. + :paramtype top: int + :return: An iterator like instance of ManagedHsm + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.models.ManagedHsm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ManagedHsm]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_managed_hsms_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ManagedHsm], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription(self, *, top: Optional[int] = None, **kwargs: Any) -> ItemPaged["_models.ManagedHsm"]: + """The List operation gets information about the managed HSM Pools associated with the + subscription. + + :keyword top: Maximum number of results to return. Default value is None. + :paramtype top: int + :return: An iterator like instance of ManagedHsm + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.models.ManagedHsm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ManagedHsm]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_managed_hsms_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ManagedHsm], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @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. Required. + :type name: str + :param location: The name of the Azure region. Required. + :type location: str + :return: DeletedManagedHsm. The DeletedManagedHsm is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.DeletedManagedHsm + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DeletedManagedHsm] = kwargs.pop("cls", None) + + _request = build_managed_hsms_get_deleted_request( + name=name, + location=location, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.DeletedManagedHsm, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_managed_hsms_purge_deleted_request( + name=name, + location=location, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_purge_deleted(self, name: str, location: str, **kwargs: Any) -> LROPoller[None]: + """Permanently deletes the specified managed HSM. + + :param name: The name of the deleted managed HSM. Required. + :type name: str + :param location: The name of the Azure region. Required. + :type location: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._purge_deleted_initial( + name=name, location=location, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_deleted(self, **kwargs: Any) -> ItemPaged["_models.DeletedManagedHsm"]: + """The List operation gets information about the deleted managed HSMs associated with the + subscription. + + :return: An iterator like instance of DeletedManagedHsm + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.models.DeletedManagedHsm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DeletedManagedHsm]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_managed_hsms_list_deleted_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.DeletedManagedHsm], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @overload + def check_mhsm_name_availability( + self, + mhsm_name: _models.CheckMhsmNameAvailabilityParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckMhsmNameAvailabilityResult: + """Checks that the managed hsm name is valid and is not already in use. + + :param mhsm_name: The request body. Required. + :type mhsm_name: ~azure.mgmt.keyvault.models.CheckMhsmNameAvailabilityParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckMhsmNameAvailabilityResult. The CheckMhsmNameAvailabilityResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.CheckMhsmNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_mhsm_name_availability( + self, mhsm_name: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckMhsmNameAvailabilityResult: + """Checks that the managed hsm name is valid and is not already in use. + + :param mhsm_name: The request body. Required. + :type mhsm_name: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckMhsmNameAvailabilityResult. The CheckMhsmNameAvailabilityResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.CheckMhsmNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_mhsm_name_availability( + self, mhsm_name: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckMhsmNameAvailabilityResult: + """Checks that the managed hsm name is valid and is not already in use. + + :param mhsm_name: The request body. Required. + :type mhsm_name: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckMhsmNameAvailabilityResult. The CheckMhsmNameAvailabilityResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.CheckMhsmNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_mhsm_name_availability( + self, mhsm_name: Union[_models.CheckMhsmNameAvailabilityParameters, JSON, IO[bytes]], **kwargs: Any + ) -> _models.CheckMhsmNameAvailabilityResult: + """Checks that the managed hsm name is valid and is not already in use. + + :param mhsm_name: The request body. Is one of the following types: + CheckMhsmNameAvailabilityParameters, JSON, IO[bytes] Required. + :type mhsm_name: ~azure.mgmt.keyvault.models.CheckMhsmNameAvailabilityParameters or JSON or + IO[bytes] + :return: CheckMhsmNameAvailabilityResult. The CheckMhsmNameAvailabilityResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.CheckMhsmNameAvailabilityResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckMhsmNameAvailabilityResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(mhsm_name, (IOBase, bytes)): + _content = mhsm_name + else: + _content = json.dumps(mhsm_name, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_managed_hsms_check_mhsm_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CheckMhsmNameAvailabilityResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class SecretsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.KeyVaultManagementClient`'s + :attr:`secrets` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :return: Secret. The Secret is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Secret + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Secret] = kwargs.pop("cls", None) + + _request = build_secrets_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + secret_name=secret_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Secret, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + vault_name: str, + secret_name: str, + parameters: _models.SecretCreateOrUpdateParameters, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: Parameters to create or update the secret. Required. + :type parameters: ~azure.mgmt.keyvault.models.SecretCreateOrUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Secret. The Secret is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Secret + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + vault_name: str, + secret_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: Parameters to create or update the secret. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Secret. The Secret is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Secret + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + vault_name: str, + secret_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: Parameters to create or update the secret. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Secret. The Secret is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Secret + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + vault_name: str, + secret_name: str, + parameters: Union[_models.SecretCreateOrUpdateParameters, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: Parameters to create or update the secret. Is one of the following types: + SecretCreateOrUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.keyvault.models.SecretCreateOrUpdateParameters or JSON or + IO[bytes] + :return: Secret. The Secret is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Secret + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Secret] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_secrets_create_or_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + secret_name=secret_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Secret, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + vault_name: str, + secret_name: str, + parameters: _models.SecretPatchParameters, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: Parameters to patch the secret. Required. + :type parameters: ~azure.mgmt.keyvault.models.SecretPatchParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Secret. The Secret is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Secret + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + vault_name: str, + secret_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: Parameters to patch the secret. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Secret. The Secret is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Secret + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + vault_name: str, + secret_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: Parameters to patch the secret. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Secret. The Secret is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Secret + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + vault_name: str, + secret_name: str, + parameters: Union[_models.SecretPatchParameters, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :param secret_name: The name of the secret. Required. + :type secret_name: str + :param parameters: Parameters to patch the secret. Is one of the following types: + SecretPatchParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.keyvault.models.SecretPatchParameters or JSON or IO[bytes] + :return: Secret. The Secret is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Secret + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Secret] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_secrets_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + secret_name=secret_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Secret, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, vault_name: str, *, top: Optional[int] = None, **kwargs: Any + ) -> ItemPaged["_models.Secret"]: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :keyword top: Maximum number of results to return. Default value is None. + :paramtype top: int + :return: An iterator like instance of Secret + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.models.Secret] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Secret]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_secrets_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + top=top, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Secret], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class KeysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.KeyVaultManagementClient`'s + :attr:`keys` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key to be retrieved. Required. + :type vault_name: str + :param key_name: The name of the key to be retrieved. Required. + :type key_name: str + :return: Key. The Key is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Key + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Key] = kwargs.pop("cls", None) + + _request = build_keys_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Key, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_if_not_exist( + self, + resource_group_name: str, + vault_name: str, + key_name: str, + parameters: _models.KeyCreateParameters, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key to be retrieved. Required. + :type vault_name: str + :param key_name: The name of the key to be retrieved. Required. + :type key_name: str + :param parameters: The parameters used to create the specified key. Required. + :type parameters: ~azure.mgmt.keyvault.models.KeyCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Key. The Key is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Key + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_if_not_exist( + self, + resource_group_name: str, + vault_name: str, + key_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key to be retrieved. Required. + :type vault_name: str + :param key_name: The name of the key to be retrieved. Required. + :type key_name: str + :param parameters: The parameters used to create the specified key. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Key. The Key is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Key + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_if_not_exist( + self, + resource_group_name: str, + vault_name: str, + key_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key to be retrieved. Required. + :type vault_name: str + :param key_name: The name of the key to be retrieved. Required. + :type key_name: str + :param parameters: The parameters used to create the specified key. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Key. The Key is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Key + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_if_not_exist( + self, + resource_group_name: str, + vault_name: str, + key_name: str, + parameters: Union[_models.KeyCreateParameters, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key to be retrieved. Required. + :type vault_name: str + :param key_name: The name of the key to be retrieved. Required. + :type key_name: str + :param parameters: The parameters used to create the specified key. Is one of the following + types: KeyCreateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.keyvault.models.KeyCreateParameters or JSON or IO[bytes] + :return: Key. The Key is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Key + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Key] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_keys_create_if_not_exist_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Key, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> ItemPaged["_models.Key"]: + """Lists the keys in the specified key vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key to be retrieved. Required. + :type vault_name: str + :return: An iterator like instance of Key + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.models.Key] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Key]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_keys_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Key], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key version to be retrieved. + Required. + :type vault_name: str + :param key_name: The name of the key version to be retrieved. Required. + :type key_name: str + :param key_version: The version of the key to be retrieved. Required. + :type key_version: str + :return: Key. The Key is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.Key + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Key] = kwargs.pop("cls", None) + + _request = build_keys_get_version_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + key_version=key_version, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Key, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_versions( + self, resource_group_name: str, vault_name: str, key_name: str, **kwargs: Any + ) -> ItemPaged["_models.Key"]: + """Lists the keys in the specified key vault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key version to be retrieved. + Required. + :type vault_name: str + :param key_name: The name of the key version to be retrieved. Required. + :type key_name: str + :return: An iterator like instance of Key + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.models.Key] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Key]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_keys_list_versions_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Key], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ManagedHsmKeysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.KeyVaultManagementClient`'s + :attr:`managed_hsm_keys` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_group_name: str, name: str, key_name: str, **kwargs: Any) -> _models.ManagedHsmKey: + """Gets the current version of the specified key from the specified managed HSM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the Managed HSM Pool within the specified resource group. Required. + :type name: str + :param key_name: The name of the key to be created. The value you provide may be copied + globally for the purpose of running the service. The value provided should not include + personally identifiable or sensitive information. Required. + :type key_name: str + :return: ManagedHsmKey. The ManagedHsmKey is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.ManagedHsmKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ManagedHsmKey] = kwargs.pop("cls", None) + + _request = build_managed_hsm_keys_get_request( + resource_group_name=resource_group_name, + name=name, + key_name=key_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ManagedHsmKey, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_if_not_exist( + self, + resource_group_name: str, + name: str, + key_name: str, + parameters: _models.ManagedHsmKeyCreateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedHsmKey: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the Managed HSM Pool within the specified resource group. Required. + :type name: str + :param key_name: The name of the key to be created. The value you provide may be copied + globally for the purpose of running the service. The value provided should not include + personally identifiable or sensitive information. Required. + :type key_name: str + :param parameters: The parameters used to create the specified key. Required. + :type parameters: ~azure.mgmt.keyvault.models.ManagedHsmKeyCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ManagedHsmKey. The ManagedHsmKey is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.ManagedHsmKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_if_not_exist( + self, + resource_group_name: str, + name: str, + key_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedHsmKey: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the Managed HSM Pool within the specified resource group. Required. + :type name: str + :param key_name: The name of the key to be created. The value you provide may be copied + globally for the purpose of running the service. The value provided should not include + personally identifiable or sensitive information. Required. + :type key_name: str + :param parameters: The parameters used to create the specified key. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ManagedHsmKey. The ManagedHsmKey is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.ManagedHsmKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_if_not_exist( + self, + resource_group_name: str, + name: str, + key_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedHsmKey: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the Managed HSM Pool within the specified resource group. Required. + :type name: str + :param key_name: The name of the key to be created. The value you provide may be copied + globally for the purpose of running the service. The value provided should not include + personally identifiable or sensitive information. Required. + :type key_name: str + :param parameters: The parameters used to create the specified key. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ManagedHsmKey. The ManagedHsmKey is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.ManagedHsmKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_if_not_exist( + self, + resource_group_name: str, + name: str, + key_name: str, + parameters: Union[_models.ManagedHsmKeyCreateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ManagedHsmKey: + """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. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the Managed HSM Pool within the specified resource group. Required. + :type name: str + :param key_name: The name of the key to be created. The value you provide may be copied + globally for the purpose of running the service. The value provided should not include + personally identifiable or sensitive information. Required. + :type key_name: str + :param parameters: The parameters used to create the specified key. Is one of the following + types: ManagedHsmKeyCreateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.keyvault.models.ManagedHsmKeyCreateParameters or JSON or + IO[bytes] + :return: ManagedHsmKey. The ManagedHsmKey is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.ManagedHsmKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ManagedHsmKey] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_managed_hsm_keys_create_if_not_exist_request( + resource_group_name=resource_group_name, + name=name, + key_name=key_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ManagedHsmKey, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, name: str, **kwargs: Any) -> ItemPaged["_models.ManagedHsmKey"]: + """Lists the keys in the specified managed HSM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the Managed HSM Pool within the specified resource group. Required. + :type name: str + :return: An iterator like instance of ManagedHsmKey + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.models.ManagedHsmKey] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ManagedHsmKey]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_managed_hsm_keys_list_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ManagedHsmKey], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_version( + self, resource_group_name: str, name: str, key_name: str, key_version: str, **kwargs: Any + ) -> _models.ManagedHsmKey: + """Gets the specified version of the specified key in the specified managed HSM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the Managed HSM Pool within the specified resource group. Required. + :type name: str + :param key_name: The name of the key to be created. The value you provide may be copied + globally for the purpose of running the service. The value provided should not include + personally identifiable or sensitive information. Required. + :type key_name: str + :param key_version: The version of the key to be retrieved. Required. + :type key_version: str + :return: ManagedHsmKey. The ManagedHsmKey is compatible with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.ManagedHsmKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ManagedHsmKey] = kwargs.pop("cls", None) + + _request = build_managed_hsm_keys_get_version_request( + resource_group_name=resource_group_name, + name=name, + key_name=key_name, + key_version=key_version, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ManagedHsmKey, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_versions( + self, resource_group_name: str, name: str, key_name: str, **kwargs: Any + ) -> ItemPaged["_models.ManagedHsmKey"]: + """Lists the keys in the specified managed HSM. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the Managed HSM Pool within the specified resource group. Required. + :type name: str + :param key_name: The name of the key to be created. The value you provide may be copied + globally for the purpose of running the service. The value provided should not include + personally identifiable or sensitive information. Required. + :type key_name: str + :return: An iterator like instance of ManagedHsmKey + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.models.ManagedHsmKey] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ManagedHsmKey]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_managed_hsm_keys_list_versions_request( + resource_group_name=resource_group_name, + name=name, + key_name=key_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ManagedHsmKey], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.KeyVaultManagementClient`'s + :attr:`private_link_resources` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = 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: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param vault_name: The name of the vault. Required. + :type vault_name: str + :return: PrivateLinkResourceListResult. The PrivateLinkResourceListResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.PrivateLinkResourceListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) + + _request = build_private_link_resources_list_by_vault_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PrivateLinkResourceListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class MHSMPrivateLinkResourcesOperations: """ + .. warning:: + **DO NOT** instantiate this class directly. - models = _models + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.KeyVaultManagementClient`'s + :attr:`mhsm_private_link_resources` attribute. + """ def __init__(self, *args, **kwargs) -> None: input_args = list(args) @@ -76,18 +6355,111 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.Operation"]: - """Lists all of the available Key Vault Rest API operations. + 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. - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.models.Operation] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :return: MHSMPrivateLinkResourceListResult. The MHSMPrivateLinkResourceListResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.keyvault.models.MHSMPrivateLinkResourceListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.MHSMPrivateLinkResourceListResult] = kwargs.pop("cls", None) + + _request = build_mhsm_private_link_resources_list_by_mhsm_resource_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.MHSMPrivateLinkResourceListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class MHSMRegionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.KeyVaultManagementClient`'s + :attr:`mhsm_regions` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = 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 + ) -> ItemPaged["_models.MHSMGeoReplicatedRegion"]: + """The List operation gets information about the regions associated with the managed HSM Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :return: An iterator like instance of MHSMGeoReplicatedRegion + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.models.MHSMGeoReplicatedRegion] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + cls: ClsType[List[_models.MHSMGeoReplicatedRegion]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -100,12 +6472,527 @@ def list(self, **kwargs: Any) -> ItemPaged["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - _request = build_list_request( - api_version=api_version, + _request = build_mhsm_regions_list_by_resource_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.MHSMGeoReplicatedRegion], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class MHSMPrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.KeyVaultManagementClient`'s + :attr:`mhsm_private_endpoint_connections` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the managed hsm pool. Required. + :type private_endpoint_connection_name: str + :return: MHSMPrivateEndpointConnection. The MHSMPrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.MHSMPrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_mhsm_private_endpoint_connections_get_request( + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.MHSMPrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def put( + self, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + properties: _models.MHSMPrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MHSMPrivateEndpointConnection: + """Updates the specified private endpoint connection associated with the managed hsm pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the managed hsm pool. Required. + :type private_endpoint_connection_name: str + :param properties: The intended state of private endpoint connection. Required. + :type properties: ~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: MHSMPrivateEndpointConnection. The MHSMPrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def put( + self, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MHSMPrivateEndpointConnection: + """Updates the specified private endpoint connection associated with the managed hsm pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the managed hsm pool. Required. + :type private_endpoint_connection_name: str + :param properties: The intended state of private endpoint connection. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: MHSMPrivateEndpointConnection. The MHSMPrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def put( + self, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MHSMPrivateEndpointConnection: + """Updates the specified private endpoint connection associated with the managed hsm pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the managed hsm pool. Required. + :type private_endpoint_connection_name: str + :param properties: The intended state of private endpoint connection. Required. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: MHSMPrivateEndpointConnection. The MHSMPrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def put( + self, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + properties: Union[_models.MHSMPrivateEndpointConnection, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.MHSMPrivateEndpointConnection: + """Updates the specified private endpoint connection associated with the managed hsm pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the managed hsm pool. Required. + :type private_endpoint_connection_name: str + :param properties: The intended state of private endpoint connection. Is one of the following + types: MHSMPrivateEndpointConnection, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection or JSON or + IO[bytes] + :return: MHSMPrivateEndpointConnection. The MHSMPrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MHSMPrivateEndpointConnection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_mhsm_private_endpoint_connections_put_request( + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, 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") + ) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.MHSMPrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, resource_group_name: str, name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_mhsm_private_endpoint_connections_delete_request( + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.CloudError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, 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: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the managed hsm pool. Required. + :type private_endpoint_connection_name: str + :return: An instance of LROPoller that returns MHSMPrivateEndpointConnection. The + MHSMPrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.MHSMPrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.MHSMPrivateEndpointConnection, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.MHSMPrivateEndpointConnection].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.MHSMPrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_resource( + self, resource_group_name: str, name: str, **kwargs: Any + ) -> ItemPaged["_models.MHSMPrivateEndpointConnection"]: + """The List operation gets information about the private endpoint connections associated with the + managed HSM Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. Required. + :type name: str + :return: An iterator like instance of MHSMPrivateEndpointConnection + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.models.MHSMPrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.MHSMPrivateEndpointConnection]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_mhsm_private_endpoint_connections_list_by_resource_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -120,16 +7007,21 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.MHSMPrivateEndpointConnection], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) + return deserialized.get("nextLink") or None, iter(list_of_elem) def get_next(next_link=None): _request = prepare_request(next_link) @@ -142,7 +7034,8 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = _failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_patch.py index 9bf5cc465316..87676c65a8f0 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_patch.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_patch.py @@ -1,118 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import Any, List, Optional, Literal -import urllib.parse -from collections.abc import MutableMapping -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.rest import HttpRequest -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.mgmt.core.exceptions import ARMErrorFormat -from ._vaults_operations import VaultsOperations as _VaultsOperations, ClsType, build_list_request -from .. import models as _models - - -class VaultsOperations(_VaultsOperations): - @distributed_trace - def list(self, top: Optional[int] = None, **kwargs: Any) -> ItemPaged["_models.Resource"]: - """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 - :return: An iterator like instance of either Resource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2024_11_01.models.Resource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop( - "filter", _params.pop("$filter", "resourceType eq 'Microsoft.KeyVault/vaults'") - ) - api_version: Literal["2015-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-11-01")) - cls: ClsType[_models.ResourceListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - top=top, - filter=filter, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - -__all__: List[str] = ["VaultsOperations"] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_private_endpoint_connections_operations.py deleted file mode 100644 index b204b2f9b9cd..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_private_endpoint_connections_operations.py +++ /dev/null @@ -1,622 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import KeyVaultManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, - vault_name: str, - private_endpoint_connection_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_put_request( - resource_group_name: str, - vault_name: str, - private_endpoint_connection_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - vault_name: str, - private_endpoint_connection_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections", - ) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class PrivateEndpointConnectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.keyvault.KeyVaultManagementClient`'s - :attr:`private_endpoint_connections` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = 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. Required. - :type resource_group_name: str - :param vault_name: The name of the key vault. Required. - :type vault_name: str - :param private_endpoint_connection_name: Name of the private endpoint connection associated - with the key vault. Required. - :type private_endpoint_connection_name: str - :return: PrivateEndpointConnection or None or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.PrivateEndpointConnection or None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def put( - self, - resource_group_name: str, - vault_name: str, - private_endpoint_connection_name: str, - properties: _models.PrivateEndpointConnection, - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param vault_name: The name of the key vault. Required. - :type vault_name: str - :param private_endpoint_connection_name: Name of the private endpoint connection associated - with the key vault. Required. - :type private_endpoint_connection_name: str - :param properties: The intended state of private endpoint connection. Required. - :type properties: ~azure.mgmt.keyvault.models.PrivateEndpointConnection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put( - self, - resource_group_name: str, - vault_name: str, - private_endpoint_connection_name: str, - properties: IO[bytes], - *, - content_type: str = "application/json", - **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. Required. - :type resource_group_name: str - :param vault_name: The name of the key vault. Required. - :type vault_name: str - :param private_endpoint_connection_name: Name of the private endpoint connection associated - with the key vault. Required. - :type private_endpoint_connection_name: str - :param properties: The intended state of private endpoint connection. Required. - :type properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put( - self, - resource_group_name: str, - vault_name: str, - private_endpoint_connection_name: str, - properties: Union[_models.PrivateEndpointConnection, IO[bytes]], - **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. Required. - :type resource_group_name: str - :param vault_name: The name of the key vault. Required. - :type vault_name: str - :param private_endpoint_connection_name: Name of the private endpoint connection associated - with the key vault. Required. - :type private_endpoint_connection_name: str - :param properties: The intended state of private endpoint connection. Is either a - PrivateEndpointConnection type or a IO[bytes] type. Required. - :type properties: ~azure.mgmt.keyvault.models.PrivateEndpointConnection or IO[bytes] - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "PrivateEndpointConnection") - - _request = build_put_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - 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.http_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - def _delete_initial( - self, resource_group_name: str, vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - 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")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, 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. Required. - :type resource_group_name: str - :param vault_name: The name of the key vault. Required. - :type vault_name: str - :param private_endpoint_connection_name: Name of the private endpoint connection associated - with the key vault. Required. - :type private_endpoint_connection_name: str - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - 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 - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.PrivateEndpointConnection].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.PrivateEndpointConnection]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_by_resource( - self, resource_group_name: str, vault_name: str, **kwargs: Any - ) -> ItemPaged["_models.PrivateEndpointConnection"]: - """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. Required. - :type resource_group_name: str - :param vault_name: The name of the key vault. Required. - :type vault_name: str - :return: An iterator like instance of either PrivateEndpointConnection or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_private_link_resources_operations.py deleted file mode 100644 index 05c487889953..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_private_link_resources_operations.py +++ /dev/null @@ -1,143 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import KeyVaultManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_vault_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources", - ) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class PrivateLinkResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.keyvault.KeyVaultManagementClient`'s - :attr:`private_link_resources` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = 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. Required. - :type resource_group_name: str - :param vault_name: The name of the key vault. Required. - :type vault_name: str - :return: PrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.PrivateLinkResourceListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - - _request = build_list_by_vault_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_secrets_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_secrets_operations.py deleted file mode 100644 index 5ec5d99951ba..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_secrets_operations.py +++ /dev/null @@ -1,639 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import KeyVaultManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_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, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}", - ) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}", - ) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}", - ) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets", - ) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SecretsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.keyvault.KeyVaultManagementClient`'s - :attr:`secrets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - def create_or_update( - self, - resource_group_name: str, - vault_name: str, - secret_name: str, - parameters: _models.SecretCreateOrUpdateParameters, - *, - content_type: str = "application/json", - **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. - Required. - :type resource_group_name: str - :param vault_name: Name of the vault. Required. - :type vault_name: str - :param secret_name: Name of the secret. The value you provide may be copied globally for the - purpose of running the service. The value provided should not include personally identifiable - or sensitive information. Required. - :type secret_name: str - :param parameters: Parameters to create or update the secret. Required. - :type parameters: ~azure.mgmt.keyvault.models.SecretCreateOrUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - vault_name: str, - secret_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. - Required. - :type resource_group_name: str - :param vault_name: Name of the vault. Required. - :type vault_name: str - :param secret_name: Name of the secret. The value you provide may be copied globally for the - purpose of running the service. The value provided should not include personally identifiable - or sensitive information. Required. - :type secret_name: str - :param parameters: Parameters to create or update the secret. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - vault_name: str, - secret_name: str, - parameters: Union[_models.SecretCreateOrUpdateParameters, IO[bytes]], - **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. - Required. - :type resource_group_name: str - :param vault_name: Name of the vault. Required. - :type vault_name: str - :param secret_name: Name of the secret. The value you provide may be copied globally for the - purpose of running the service. The value provided should not include personally identifiable - or sensitive information. Required. - :type secret_name: str - :param parameters: Parameters to create or update the secret. Is either a - SecretCreateOrUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.keyvault.models.SecretCreateOrUpdateParameters or IO[bytes] - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Secret] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Secret", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - resource_group_name: str, - vault_name: str, - secret_name: str, - parameters: _models.SecretPatchParameters, - *, - content_type: str = "application/json", - **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. - Required. - :type resource_group_name: str - :param vault_name: Name of the vault. Required. - :type vault_name: str - :param secret_name: Name of the secret. Required. - :type secret_name: str - :param parameters: Parameters to patch the secret. Required. - :type parameters: ~azure.mgmt.keyvault.models.SecretPatchParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - vault_name: str, - secret_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. - Required. - :type resource_group_name: str - :param vault_name: Name of the vault. Required. - :type vault_name: str - :param secret_name: Name of the secret. Required. - :type secret_name: str - :param parameters: Parameters to patch the secret. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - vault_name: str, - secret_name: str, - parameters: Union[_models.SecretPatchParameters, IO[bytes]], - **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. - Required. - :type resource_group_name: str - :param vault_name: Name of the vault. Required. - :type vault_name: str - :param secret_name: Name of the secret. Required. - :type secret_name: str - :param parameters: Parameters to patch the secret. Is either a SecretPatchParameters type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.keyvault.models.SecretPatchParameters or IO[bytes] - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Secret] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Secret", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. - Required. - :type resource_group_name: str - :param vault_name: The name of the vault. Required. - :type vault_name: str - :param secret_name: The name of the secret. Required. - :type secret_name: str - :return: Secret or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.Secret - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.Secret] = kwargs.pop("cls", None) - - _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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Secret", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, vault_name: str, top: Optional[int] = None, **kwargs: Any - ) -> ItemPaged["_models.Secret"]: - """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. - Required. - :type resource_group_name: str - :param vault_name: The name of the vault. Required. - :type vault_name: str - :param top: Maximum number of results to return. Default value is None. - :type top: int - :return: An iterator like instance of either Secret or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.models.Secret] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SecretListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - top=top, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("SecretListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_vaults_operations.py deleted file mode 100644 index 8ce68074f54f..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_vaults_operations.py +++ /dev/null @@ -1,1568 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Literal, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import KeyVaultManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_or_update_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}", - ) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}", - ) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}", - ) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}", - ) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_access_policy_request( - resource_group_name: str, - vault_name: str, - operation_kind: Union[str, _models.AccessPolicyUpdateKind], - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}", - ) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}", - ) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_purge_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: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge", - ) - 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_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: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop( - "filter", _params.pop("$filter", "resourceType eq 'Microsoft.KeyVault/vaults'") - ) - api_version: Literal["2015-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-11-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resources") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _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, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability" - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class VaultsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.keyvault.KeyVaultManagementClient`'s - :attr:`vaults` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: KeyVaultManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = 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: Union[_models.VaultCreateOrUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "VaultCreateOrUpdateParameters") - - _request = build_create_or_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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - vault_name: str, - parameters: _models.VaultCreateOrUpdateParameters, - *, - content_type: str = "application/json", - **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. - Required. - :type resource_group_name: str - :param vault_name: Name of the vault. Required. - :type vault_name: str - :param parameters: Parameters to create or update the vault. Required. - :type parameters: ~azure.mgmt.keyvault.models.VaultCreateOrUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Vault or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.models.Vault] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - vault_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. - Required. - :type resource_group_name: str - :param vault_name: Name of the vault. Required. - :type vault_name: str - :param parameters: Parameters to create or update the vault. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Vault or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.models.Vault] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - vault_name: str, - parameters: Union[_models.VaultCreateOrUpdateParameters, IO[bytes]], - **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. - Required. - :type resource_group_name: str - :param vault_name: Name of the vault. Required. - :type vault_name: str - :param parameters: Parameters to create or update the vault. Is either a - VaultCreateOrUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.keyvault.models.VaultCreateOrUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns either Vault or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Vault] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - 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 - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Vault", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Vault].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Vault]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def update( - self, - resource_group_name: str, - vault_name: str, - parameters: _models.VaultPatchParameters, - *, - content_type: str = "application/json", - **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. - Required. - :type resource_group_name: str - :param vault_name: Name of the vault. Required. - :type vault_name: str - :param parameters: Parameters to patch the vault. Required. - :type parameters: ~azure.mgmt.keyvault.models.VaultPatchParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Vault or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.Vault - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - vault_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. - Required. - :type resource_group_name: str - :param vault_name: Name of the vault. Required. - :type vault_name: str - :param parameters: Parameters to patch the vault. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Vault or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.Vault - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - vault_name: str, - parameters: Union[_models.VaultPatchParameters, IO[bytes]], - **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. - Required. - :type resource_group_name: str - :param vault_name: Name of the vault. Required. - :type vault_name: str - :param parameters: Parameters to patch the vault. Is either a VaultPatchParameters type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.keyvault.models.VaultPatchParameters or IO[bytes] - :return: Vault or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.Vault - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Vault] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Vault", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. - Required. - :type resource_group_name: str - :param vault_name: The name of the vault to delete. Required. - :type vault_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", 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, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def 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. - Required. - :type resource_group_name: str - :param vault_name: The name of the vault. Required. - :type vault_name: str - :return: Vault or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.Vault - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.Vault] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Vault", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update_access_policy( - self, - resource_group_name: str, - vault_name: str, - operation_kind: Union[str, _models.AccessPolicyUpdateKind], - parameters: _models.VaultAccessPolicyParameters, - *, - content_type: str = "application/json", - **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. - Required. - :type resource_group_name: str - :param vault_name: Name of the vault. Required. - :type vault_name: str - :param operation_kind: Name of the operation. Known values are: "add", "replace", and "remove". - Required. - :type operation_kind: str or ~azure.mgmt.keyvault.models.AccessPolicyUpdateKind - :param parameters: Access policy to merge into the vault. Required. - :type parameters: ~azure.mgmt.keyvault.models.VaultAccessPolicyParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: VaultAccessPolicyParameters or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.VaultAccessPolicyParameters - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update_access_policy( - self, - resource_group_name: str, - vault_name: str, - operation_kind: Union[str, _models.AccessPolicyUpdateKind], - parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. - Required. - :type resource_group_name: str - :param vault_name: Name of the vault. Required. - :type vault_name: str - :param operation_kind: Name of the operation. Known values are: "add", "replace", and "remove". - Required. - :type operation_kind: str or ~azure.mgmt.keyvault.models.AccessPolicyUpdateKind - :param parameters: Access policy to merge into the vault. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: VaultAccessPolicyParameters or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.VaultAccessPolicyParameters - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update_access_policy( - self, - resource_group_name: str, - vault_name: str, - operation_kind: Union[str, _models.AccessPolicyUpdateKind], - parameters: Union[_models.VaultAccessPolicyParameters, IO[bytes]], - **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. - Required. - :type resource_group_name: str - :param vault_name: Name of the vault. Required. - :type vault_name: str - :param operation_kind: Name of the operation. Known values are: "add", "replace", and "remove". - Required. - :type operation_kind: str or ~azure.mgmt.keyvault.models.AccessPolicyUpdateKind - :param parameters: Access policy to merge into the vault. Is either a - VaultAccessPolicyParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.keyvault.models.VaultAccessPolicyParameters or IO[bytes] - :return: VaultAccessPolicyParameters or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.VaultAccessPolicyParameters - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VaultAccessPolicyParameters] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VaultAccessPolicyParameters", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> ItemPaged["_models.Vault"]: - """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. - Required. - :type resource_group_name: str - :param top: Maximum number of results to return. Default value is None. - :type top: int - :return: An iterator like instance of either Vault or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.models.Vault] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.VaultListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - top=top, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("VaultListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_subscription(self, top: Optional[int] = None, **kwargs: Any) -> ItemPaged["_models.Vault"]: - """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 - :return: An iterator like instance of either Vault or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.models.Vault] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.VaultListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - top=top, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("VaultListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_deleted(self, **kwargs: Any) -> ItemPaged["_models.DeletedVault"]: - """Gets information about the deleted vaults in a subscription. - - :return: An iterator like instance of either DeletedVault or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.models.DeletedVault] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DeletedVaultListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_deleted_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DeletedVaultListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get_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. Required. - :type vault_name: str - :param location: The location of the deleted vault. Required. - :type location: str - :return: DeletedVault or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.DeletedVault - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DeletedVault] = kwargs.pop("cls", None) - - _request = build_get_deleted_request( - vault_name=vault_name, - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DeletedVault", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _purge_deleted_initial(self, vault_name: str, location: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_purge_deleted_request( - vault_name=vault_name, - location=location, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_purge_deleted(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. Required. - :type vault_name: str - :param location: The location of the soft-deleted vault. Required. - :type location: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._purge_deleted_initial( - vault_name=vault_name, - location=location, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list(self, top: Optional[int] = None, **kwargs: Any) -> ItemPaged["_models.Resource"]: - """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 - :return: An iterator like instance of either Resource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.models.Resource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop( - "filter", _params.pop("$filter", "resourceType eq 'Microsoft.KeyVault/vaults'") - ) - api_version: Literal["2015-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-11-01")) - cls: ClsType[_models.ResourceListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - top=top, - filter=filter, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @overload - def check_name_availability( - self, - vault_name: _models.VaultCheckNameAvailabilityParameters, - *, - content_type: str = "application/json", - **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. Required. - :type vault_name: ~azure.mgmt.keyvault.models.VaultCheckNameAvailabilityParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CheckNameAvailabilityResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.CheckNameAvailabilityResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_name_availability( - self, vault_name: IO[bytes], *, content_type: str = "application/json", **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. Required. - :type vault_name: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CheckNameAvailabilityResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.CheckNameAvailabilityResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_name_availability( - self, vault_name: Union[_models.VaultCheckNameAvailabilityParameters, IO[bytes]], **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. Is either a VaultCheckNameAvailabilityParameters type - or a IO[bytes] type. Required. - :type vault_name: ~azure.mgmt.keyvault.models.VaultCheckNameAvailabilityParameters or IO[bytes] - :return: CheckNameAvailabilityResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.models.CheckNameAvailabilityResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CheckNameAvailabilityResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(vault_name, (IOBase, bytes)): - _content = vault_name - else: - _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, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/check_vault_name_availability.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/check_vault_name_availability.py index 2fb4fcb81ec5..ccf51fe920ad 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/check_vault_name_availability.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/check_vault_name_availability.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.vaults.check_name_availability( @@ -37,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/checkVaultNameAvailability.json +# x-ms-original-file: 2025-05-01/checkVaultNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/create_key.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/create_key.py index b26c4df5669a..6894818ce3d5 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/create_key.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/create_key.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.keys.create_if_not_exist( @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/createKey.json +# x-ms-original-file: 2025-05-01/createKey.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/create_secret.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/create_secret.py index 14af53cd154d..802a8a807cb2 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/create_secret.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/create_secret.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.secrets.create_or_update( @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/createSecret.json +# x-ms-original-file: 2025-05-01/createSecret.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/create_vault.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/create_vault.py index 69976ee5505e..801f1049efda 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/create_vault.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/create_vault.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.vaults.begin_create_or_update( @@ -92,6 +91,6 @@ def main(): print(response) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/createVault.json +# x-ms-original-file: 2025-05-01/createVault.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/create_vault_with_network_acls.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/create_vault_with_network_acls.py index 8bea06fd66a5..b5d866b4551b 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/create_vault_with_network_acls.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/create_vault_with_network_acls.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.vaults.begin_create_or_update( @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/createVaultWithNetworkAcls.json +# x-ms-original-file: 2025-05-01/createVaultWithNetworkAcls.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/delete_private_endpoint_connection.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/delete_private_endpoint_connection.py index db37d7f4e6a2..8f5d2f66f809 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/delete_private_endpoint_connection.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/delete_private_endpoint_connection.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_endpoint_connections.begin_delete( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/deletePrivateEndpointConnection.json +# x-ms-original-file: 2025-05-01/deletePrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/delete_vault.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/delete_vault.py index 378949c2ee7c..67ac8768baa3 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/delete_vault.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/delete_vault.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.vaults.delete( @@ -37,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/deleteVault.json +# x-ms-original-file: 2025-05-01/deleteVault.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/deleted_managed_hsm_get.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/deleted_managed_hsm_get.py index 32b69d604ffb..b784591a5ff4 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/deleted_managed_hsm_get.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/deleted_managed_hsm_get.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.managed_hsms.get_deleted( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/DeletedManagedHsm_Get.json +# x-ms-original-file: 2025-05-01/DeletedManagedHsm_Get.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/deleted_managed_hsm_list.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/deleted_managed_hsm_list.py index 8c1fb22c7e1a..8009eec9dd70 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/deleted_managed_hsm_list.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/deleted_managed_hsm_list.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.managed_hsms.list_deleted() @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/DeletedManagedHsm_List.json +# x-ms-original-file: 2025-05-01/DeletedManagedHsm_List.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/deleted_managed_hsm_purge.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/deleted_managed_hsm_purge.py index ce5bf549164c..286795339e6a 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/deleted_managed_hsm_purge.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/deleted_managed_hsm_purge.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.managed_hsms.begin_purge_deleted( @@ -37,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/DeletedManagedHsm_Purge.json +# x-ms-original-file: 2025-05-01/DeletedManagedHsm_Purge.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/get_deleted_vault.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/get_deleted_vault.py index 17f41aaf9461..efd912712fc0 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/get_deleted_vault.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/get_deleted_vault.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.vaults.get_deleted( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/getDeletedVault.json +# x-ms-original-file: 2025-05-01/getDeletedVault.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/get_key.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/get_key.py index 994750cb1f71..1386d0fad34a 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/get_key.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/get_key.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.keys.get( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/getKey.json +# x-ms-original-file: 2025-05-01/getKey.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/get_key_version.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/get_key_version.py index c92869f1beed..1d29a96bdccc 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/get_key_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/get_key_version.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.keys.get_version( @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/getKeyVersion.json +# x-ms-original-file: 2025-05-01/getKeyVersion.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/get_private_endpoint_connection.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/get_private_endpoint_connection.py index f4338aa09fdf..892344f162ad 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/get_private_endpoint_connection.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/get_private_endpoint_connection.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_endpoint_connections.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/getPrivateEndpointConnection.json +# x-ms-original-file: 2025-05-01/getPrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/get_secret.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/get_secret.py index b30eb66b9cbe..5113cc9dd1c1 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/get_secret.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/get_secret.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.secrets.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/getSecret.json +# x-ms-original-file: 2025-05-01/getSecret.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/get_vault.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/get_vault.py index a8ce83de3350..3bae8cba95b4 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/get_vault.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/get_vault.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.vaults.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/getVault.json +# x-ms-original-file: 2025-05-01/getVault.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_deleted_vaults.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_deleted_vaults.py index dd309de17de2..b4d59fcec5a7 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_deleted_vaults.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_deleted_vaults.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.vaults.list_deleted() @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/listDeletedVaults.json +# x-ms-original-file: 2025-05-01/listDeletedVaults.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_key_versions.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_key_versions.py index 72b3aa1ab9ab..60a6edfa39e4 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_key_versions.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_key_versions.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.keys.list_versions( @@ -40,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/listKeyVersions.json +# x-ms-original-file: 2025-05-01/listKeyVersions.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_keys.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_keys.py index 59256be71fa1..d734c94fb0ce 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_keys.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_keys.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.keys.list( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/listKeys.json +# x-ms-original-file: 2025-05-01/listKeys.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_operations.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_operations.py index 848bafa2aec6..293031a36840 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_operations.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/listOperations.json +# x-ms-original-file: 2025-05-01/listOperations.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_private_endpoint_connection.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_private_endpoint_connection.py index 752e9f13bcb2..02b54d00b8ea 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_private_endpoint_connection.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_private_endpoint_connection.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_endpoint_connections.list_by_resource( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/listPrivateEndpointConnection.json +# x-ms-original-file: 2025-05-01/listPrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_private_link_resources.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_private_link_resources.py index 53aade441f2e..c6b9160a00d1 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_private_link_resources.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_private_link_resources.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_link_resources.list_by_vault( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/listPrivateLinkResources.json +# x-ms-original-file: 2025-05-01/listPrivateLinkResources.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_secrets.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_secrets.py index 086357be2d99..8e320c192728 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_secrets.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_secrets.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.secrets.list( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/listSecrets.json +# x-ms-original-file: 2025-05-01/listSecrets.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_vault.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_vault.py index 9cc7bc7bb1c8..345456a1534a 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_vault.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_vault.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.vaults.list() @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/listVault.json +# x-ms-original-file: 2025-05-01/listVault.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_vault_by_resource_group.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_vault_by_resource_group.py index d67f172bf3c9..00cfe4d46aae 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_vault_by_resource_group.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_vault_by_resource_group.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.vaults.list_by_resource_group( @@ -38,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/listVaultByResourceGroup.json +# x-ms-original-file: 2025-05-01/listVaultByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_vault_by_subscription.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_vault_by_subscription.py index 9c1e4bb956e0..a04cf28a81c8 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_vault_by_subscription.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/list_vault_by_subscription.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.vaults.list_by_subscription() @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/listVaultBySubscription.json +# x-ms-original-file: 2025-05-01/listVaultBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_check_mhsm_name_availability.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_check_mhsm_name_availability.py index 3e4ebd3f5c4e..257cbca68c95 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_check_mhsm_name_availability.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_check_mhsm_name_availability.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.managed_hsms.check_mhsm_name_availability( @@ -37,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/ManagedHsm_checkMhsmNameAvailability.json +# x-ms-original-file: 2025-05-01/ManagedHsm_checkMhsmNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_create_key.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_create_key.py index ef6572624890..0d2425f0f03a 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_create_key.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_create_key.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.managed_hsm_keys.create_if_not_exist( @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/managedHsmCreateKey.json +# x-ms-original-file: 2025-05-01/managedHsmCreateKey.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_create_or_update.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_create_or_update.py index 748f846d361b..1e6544dd59fc 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_create_or_update.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_create_or_update.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.managed_hsms.begin_create_or_update( @@ -50,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/ManagedHsm_CreateOrUpdate.json +# x-ms-original-file: 2025-05-01/ManagedHsm_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_delete.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_delete.py index 743fcd607d75..f766a3d8244f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_delete.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_delete.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.managed_hsms.begin_delete( @@ -37,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/ManagedHsm_Delete.json +# x-ms-original-file: 2025-05-01/ManagedHsm_Delete.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_delete_private_endpoint_connection.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_delete_private_endpoint_connection.py index 5d51475a360d..d9cd3055d7aa 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_delete_private_endpoint_connection.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_delete_private_endpoint_connection.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.mhsm_private_endpoint_connections.begin_delete( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/ManagedHsm_deletePrivateEndpointConnection.json +# x-ms-original-file: 2025-05-01/ManagedHsm_deletePrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_get.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_get.py index 59d99621bc3e..9658c5225550 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_get.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_get.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.managed_hsms.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/ManagedHsm_Get.json +# x-ms-original-file: 2025-05-01/ManagedHsm_Get.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_get_key.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_get_key.py index c07a56acd4cd..b5e6f725ff15 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_get_key.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_get_key.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.managed_hsm_keys.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/managedHsmGetKey.json +# x-ms-original-file: 2025-05-01/managedHsmGetKey.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_get_key_version.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_get_key_version.py index 84a8ad294878..2af079d747bb 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_get_key_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_get_key_version.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.managed_hsm_keys.get_version( @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/managedHsmGetKeyVersion.json +# x-ms-original-file: 2025-05-01/managedHsmGetKeyVersion.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_get_private_endpoint_connection.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_get_private_endpoint_connection.py index 82c1395bcfba..3383d75af164 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_get_private_endpoint_connection.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_get_private_endpoint_connection.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.mhsm_private_endpoint_connections.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/ManagedHsm_getPrivateEndpointConnection.json +# x-ms-original-file: 2025-05-01/ManagedHsm_getPrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_list_by_resource_group.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_list_by_resource_group.py index 91f3f7e44722..91b318b25cda 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_list_by_resource_group.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_list_by_resource_group.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.managed_hsms.list_by_resource_group( @@ -38,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/ManagedHsm_ListByResourceGroup.json +# x-ms-original-file: 2025-05-01/ManagedHsm_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_list_by_subscription.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_list_by_subscription.py index 9d930644eebc..9785286b2b5f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_list_by_subscription.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_list_by_subscription.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.managed_hsms.list_by_subscription() @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/ManagedHsm_ListBySubscription.json +# x-ms-original-file: 2025-05-01/ManagedHsm_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_list_key_versions.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_list_key_versions.py index e0eca8631d11..f7e52b5e1662 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_list_key_versions.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_list_key_versions.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.managed_hsm_keys.list_versions( @@ -40,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/managedHsmListKeyVersions.json +# x-ms-original-file: 2025-05-01/managedHsmListKeyVersions.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_list_keys.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_list_keys.py index 6db3f07e8065..b84282b4eb1d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_list_keys.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_list_keys.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.managed_hsm_keys.list( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/managedHsmListKeys.json +# x-ms-original-file: 2025-05-01/managedHsmListKeys.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_list_private_endpoint_connections_by_resource.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_list_private_endpoint_connections_by_resource.py index c91c1c4787a1..6038dade842f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_list_private_endpoint_connections_by_resource.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_list_private_endpoint_connections_by_resource.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.mhsm_private_endpoint_connections.list_by_resource( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/ManagedHsm_ListPrivateEndpointConnectionsByResource.json +# x-ms-original-file: 2025-05-01/ManagedHsm_ListPrivateEndpointConnectionsByResource.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_list_private_link_resources.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_list_private_link_resources.py index 49f2c1b4dc06..fe031c16a1b0 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_list_private_link_resources.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_list_private_link_resources.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.mhsm_private_link_resources.list_by_mhsm_resource( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/ManagedHsm_listPrivateLinkResources.json +# x-ms-original-file: 2025-05-01/ManagedHsm_listPrivateLinkResources.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_list_regions_by_resource.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_list_regions_by_resource.py index e1311ab7e2a9..90468041c126 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_list_regions_by_resource.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_list_regions_by_resource.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.mhsm_regions.list_by_resource( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/ManagedHsm_ListRegionsByResource.json +# x-ms-original-file: 2025-05-01/ManagedHsm_ListRegionsByResource.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_put_private_endpoint_connection.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_put_private_endpoint_connection.py index 139cf7a878f7..23ea08d072e4 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_put_private_endpoint_connection.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_put_private_endpoint_connection.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.mhsm_private_endpoint_connections.put( @@ -47,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/ManagedHsm_putPrivateEndpointConnection.json +# x-ms-original-file: 2025-05-01/ManagedHsm_putPrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_update.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_update.py index 9d05fecc6655..2b8531933174 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_update.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/managed_hsm_update.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.managed_hsms.begin_update( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/ManagedHsm_Update.json +# x-ms-original-file: 2025-05-01/ManagedHsm_Update.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/purge_deleted_vault.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/purge_deleted_vault.py index 70b54c80f468..0bd986cf3a21 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/purge_deleted_vault.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/purge_deleted_vault.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.vaults.begin_purge_deleted( @@ -37,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/purgeDeletedVault.json +# x-ms-original-file: 2025-05-01/purgeDeletedVault.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/put_private_endpoint_connection.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/put_private_endpoint_connection.py index 2cbb0f50eaee..d826d6677e9b 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/put_private_endpoint_connection.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/put_private_endpoint_connection.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_endpoint_connections.put( @@ -48,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/putPrivateEndpointConnection.json +# x-ms-original-file: 2025-05-01/putPrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/update_access_policies_add.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/update_access_policies_add.py index bb4ef7496b8b..28a27a33e661 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/update_access_policies_add.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/update_access_policies_add.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.vaults.update_access_policy( @@ -50,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/updateAccessPoliciesAdd.json +# x-ms-original-file: 2025-05-01/updateAccessPoliciesAdd.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/update_secret.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/update_secret.py index 7cf30d9a7206..575af3b9db53 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/update_secret.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/update_secret.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.secrets.update( @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/updateSecret.json +# x-ms-original-file: 2025-05-01/updateSecret.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/update_vault.py b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/update_vault.py index babdc7c95645..984afd34bc0e 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_samples/update_vault.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_samples/update_vault.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = KeyVaultManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.vaults.update( @@ -91,6 +90,6 @@ def main(): print(response) -# x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2025-05-01/examples/updateVault.json +# x-ms-original-file: 2025-05-01/updateVault.json if __name__ == "__main__": main() diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/conftest.py b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/conftest.py index 924599a32089..fe9899369c6e 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/conftest.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/conftest.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import os diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_keys_operations.py b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_keys_operations.py index 843dfb88555f..406f6731bf2f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_keys_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_keys_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -18,6 +18,18 @@ class TestKeyVaultManagementKeysOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(KeyVaultManagementClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_keys_get(self, resource_group): + response = self.client.keys.get( + resource_group_name=resource_group.name, + vault_name="str", + key_name="str", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_keys_create_if_not_exist(self, resource_group): @@ -31,7 +43,7 @@ def test_keys_create_if_not_exist(self, resource_group): "created": 0, "enabled": bool, "exp": 0, - "exportable": False, + "exportable": bool, "nbf": 0, "recoveryLevel": "str", "updated": 0, @@ -42,10 +54,7 @@ def test_keys_create_if_not_exist(self, resource_group): "keyUri": "str", "keyUriWithVersion": "str", "kty": "str", - "release_policy": { - "contentType": "application/json; charset=utf-8", - "data": bytes("bytes", encoding="utf-8"), - }, + "release_policy": {"contentType": "str", "data": bytes("bytes", encoding="utf-8")}, "rotationPolicy": { "attributes": {"created": 0, "expiryTime": "str", "updated": 0}, "lifetimeActions": [ @@ -58,20 +67,6 @@ def test_keys_create_if_not_exist(self, resource_group): }, "tags": {"str": "str"}, }, - api_version="2025-05-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_keys_get(self, resource_group): - response = self.client.keys.get( - resource_group_name=resource_group.name, - vault_name="str", - key_name="str", - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -83,7 +78,6 @@ def test_keys_list(self, resource_group): response = self.client.keys.list( resource_group_name=resource_group.name, vault_name="str", - api_version="2025-05-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -97,7 +91,6 @@ def test_keys_get_version(self, resource_group): vault_name="str", key_name="str", key_version="str", - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -110,7 +103,6 @@ def test_keys_list_versions(self, resource_group): resource_group_name=resource_group.name, vault_name="str", key_name="str", - api_version="2025-05-01", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_keys_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_keys_operations_async.py index 124771f84a87..ebaa4ac63f99 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_keys_operations_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_keys_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -19,6 +19,18 @@ class TestKeyVaultManagementKeysOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(KeyVaultManagementClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_keys_get(self, resource_group): + response = await self.client.keys.get( + resource_group_name=resource_group.name, + vault_name="str", + key_name="str", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_keys_create_if_not_exist(self, resource_group): @@ -32,7 +44,7 @@ async def test_keys_create_if_not_exist(self, resource_group): "created": 0, "enabled": bool, "exp": 0, - "exportable": False, + "exportable": bool, "nbf": 0, "recoveryLevel": "str", "updated": 0, @@ -43,10 +55,7 @@ async def test_keys_create_if_not_exist(self, resource_group): "keyUri": "str", "keyUriWithVersion": "str", "kty": "str", - "release_policy": { - "contentType": "application/json; charset=utf-8", - "data": bytes("bytes", encoding="utf-8"), - }, + "release_policy": {"contentType": "str", "data": bytes("bytes", encoding="utf-8")}, "rotationPolicy": { "attributes": {"created": 0, "expiryTime": "str", "updated": 0}, "lifetimeActions": [ @@ -59,20 +68,6 @@ async def test_keys_create_if_not_exist(self, resource_group): }, "tags": {"str": "str"}, }, - api_version="2025-05-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_keys_get(self, resource_group): - response = await self.client.keys.get( - resource_group_name=resource_group.name, - vault_name="str", - key_name="str", - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -84,7 +79,6 @@ async def test_keys_list(self, resource_group): response = self.client.keys.list( resource_group_name=resource_group.name, vault_name="str", - api_version="2025-05-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -98,7 +92,6 @@ async def test_keys_get_version(self, resource_group): vault_name="str", key_name="str", key_version="str", - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -111,7 +104,6 @@ async def test_keys_list_versions(self, resource_group): resource_group_name=resource_group.name, vault_name="str", key_name="str", - api_version="2025-05-01", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_managed_hsm_keys_operations.py b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_managed_hsm_keys_operations.py index f10b7c5f5592..ade9859a68d0 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_managed_hsm_keys_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_managed_hsm_keys_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -18,6 +18,18 @@ class TestKeyVaultManagementManagedHsmKeysOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(KeyVaultManagementClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_managed_hsm_keys_get(self, resource_group): + response = self.client.managed_hsm_keys.get( + resource_group_name=resource_group.name, + name="str", + key_name="str", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_managed_hsm_keys_create_if_not_exist(self, resource_group): @@ -42,10 +54,7 @@ def test_managed_hsm_keys_create_if_not_exist(self, resource_group): "keyUri": "str", "keyUriWithVersion": "str", "kty": "str", - "release_policy": { - "contentType": "application/json; charset=utf-8", - "data": bytes("bytes", encoding="utf-8"), - }, + "release_policy": {"contentType": "str", "data": bytes("bytes", encoding="utf-8")}, "rotationPolicy": { "attributes": {"created": 0, "expiryTime": "str", "updated": 0}, "lifetimeActions": [ @@ -58,20 +67,6 @@ def test_managed_hsm_keys_create_if_not_exist(self, resource_group): }, "tags": {"str": "str"}, }, - api_version="2025-05-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_managed_hsm_keys_get(self, resource_group): - response = self.client.managed_hsm_keys.get( - resource_group_name=resource_group.name, - name="str", - key_name="str", - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -83,7 +78,6 @@ def test_managed_hsm_keys_list(self, resource_group): response = self.client.managed_hsm_keys.list( resource_group_name=resource_group.name, name="str", - api_version="2025-05-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -97,7 +91,6 @@ def test_managed_hsm_keys_get_version(self, resource_group): name="str", key_name="str", key_version="str", - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -110,7 +103,6 @@ def test_managed_hsm_keys_list_versions(self, resource_group): resource_group_name=resource_group.name, name="str", key_name="str", - api_version="2025-05-01", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_managed_hsm_keys_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_managed_hsm_keys_operations_async.py index 4baa50468d13..3b23ed4e6dd3 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_managed_hsm_keys_operations_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_managed_hsm_keys_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -19,6 +19,18 @@ class TestKeyVaultManagementManagedHsmKeysOperationsAsync(AzureMgmtRecordedTestC def setup_method(self, method): self.client = self.create_mgmt_client(KeyVaultManagementClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_managed_hsm_keys_get(self, resource_group): + response = await self.client.managed_hsm_keys.get( + resource_group_name=resource_group.name, + name="str", + key_name="str", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_managed_hsm_keys_create_if_not_exist(self, resource_group): @@ -43,10 +55,7 @@ async def test_managed_hsm_keys_create_if_not_exist(self, resource_group): "keyUri": "str", "keyUriWithVersion": "str", "kty": "str", - "release_policy": { - "contentType": "application/json; charset=utf-8", - "data": bytes("bytes", encoding="utf-8"), - }, + "release_policy": {"contentType": "str", "data": bytes("bytes", encoding="utf-8")}, "rotationPolicy": { "attributes": {"created": 0, "expiryTime": "str", "updated": 0}, "lifetimeActions": [ @@ -59,20 +68,6 @@ async def test_managed_hsm_keys_create_if_not_exist(self, resource_group): }, "tags": {"str": "str"}, }, - api_version="2025-05-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_managed_hsm_keys_get(self, resource_group): - response = await self.client.managed_hsm_keys.get( - resource_group_name=resource_group.name, - name="str", - key_name="str", - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -84,7 +79,6 @@ async def test_managed_hsm_keys_list(self, resource_group): response = self.client.managed_hsm_keys.list( resource_group_name=resource_group.name, name="str", - api_version="2025-05-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -98,7 +92,6 @@ async def test_managed_hsm_keys_get_version(self, resource_group): name="str", key_name="str", key_version="str", - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -111,7 +104,6 @@ async def test_managed_hsm_keys_list_versions(self, resource_group): resource_group_name=resource_group.name, name="str", key_name="str", - api_version="2025-05-01", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_managed_hsms_operations.py index 4499b606fc9a..aa3f6525fb9d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_managed_hsms_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_managed_hsms_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -18,6 +18,17 @@ class TestKeyVaultManagementManagedHsmsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(KeyVaultManagementClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_managed_hsms_get(self, resource_group): + response = self.client.managed_hsms.get( + resource_group_name=resource_group.name, + name="str", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_managed_hsms_begin_create_or_update(self, resource_group): @@ -36,8 +47,8 @@ def test_managed_hsms_begin_create_or_update(self, resource_group): "name": "str", "properties": { "createMode": "str", - "enablePurgeProtection": True, - "enableSoftDelete": True, + "enablePurgeProtection": bool, + "enableSoftDelete": bool, "hsmUri": "str", "initialAdminObjectIds": ["str"], "networkAcls": { @@ -51,25 +62,27 @@ def test_managed_hsms_begin_create_or_update(self, resource_group): { "etag": "str", "id": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": { - "actionsRequired": "str", - "description": "str", - "status": "str", + "properties": { + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", }, - "provisioningState": "str", } ], "provisioningState": "str", - "publicNetworkAccess": "Enabled", + "publicNetworkAccess": "str", "regions": [{"isPrimary": bool, "name": "str", "provisioningState": "str"}], "scheduledPurgeDate": "2020-02-20 00:00:00", "securityDomainProperties": {"activationStatus": "str", "activationStatusMessage": "str"}, - "softDeleteRetentionInDays": 90, + "softDeleteRetentionInDays": 0, "statusMessage": "str", "tenantId": "str", }, - "sku": {"family": "B", "name": "str"}, + "sku": {"family": "str", "name": "str"}, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -81,7 +94,6 @@ def test_managed_hsms_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2025-05-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -105,8 +117,8 @@ def test_managed_hsms_begin_update(self, resource_group): "name": "str", "properties": { "createMode": "str", - "enablePurgeProtection": True, - "enableSoftDelete": True, + "enablePurgeProtection": bool, + "enableSoftDelete": bool, "hsmUri": "str", "initialAdminObjectIds": ["str"], "networkAcls": { @@ -120,25 +132,27 @@ def test_managed_hsms_begin_update(self, resource_group): { "etag": "str", "id": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": { - "actionsRequired": "str", - "description": "str", - "status": "str", + "properties": { + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", }, - "provisioningState": "str", } ], "provisioningState": "str", - "publicNetworkAccess": "Enabled", + "publicNetworkAccess": "str", "regions": [{"isPrimary": bool, "name": "str", "provisioningState": "str"}], "scheduledPurgeDate": "2020-02-20 00:00:00", "securityDomainProperties": {"activationStatus": "str", "activationStatusMessage": "str"}, - "softDeleteRetentionInDays": 90, + "softDeleteRetentionInDays": 0, "statusMessage": "str", "tenantId": "str", }, - "sku": {"family": "B", "name": "str"}, + "sku": {"family": "str", "name": "str"}, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -150,7 +164,6 @@ def test_managed_hsms_begin_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2025-05-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -162,30 +175,16 @@ def test_managed_hsms_begin_delete(self, resource_group): response = self.client.managed_hsms.begin_delete( resource_group_name=resource_group.name, name="str", - api_version="2025-05-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_managed_hsms_get(self, resource_group): - response = self.client.managed_hsms.get( - resource_group_name=resource_group.name, - name="str", - api_version="2025-05-01", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_managed_hsms_list_by_resource_group(self, resource_group): response = self.client.managed_hsms.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2025-05-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -194,19 +193,7 @@ def test_managed_hsms_list_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_managed_hsms_list_by_subscription(self, resource_group): - response = self.client.managed_hsms.list_by_subscription( - api_version="2025-05-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_managed_hsms_list_deleted(self, resource_group): - response = self.client.managed_hsms.list_deleted( - api_version="2025-05-01", - ) + response = self.client.managed_hsms.list_by_subscription() result = [r for r in response] # please add some check logic here by yourself # ... @@ -217,7 +204,6 @@ def test_managed_hsms_get_deleted(self, resource_group): response = self.client.managed_hsms.get_deleted( name="str", location="str", - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -229,18 +215,24 @@ def test_managed_hsms_begin_purge_deleted(self, resource_group): response = self.client.managed_hsms.begin_purge_deleted( name="str", location="str", - api_version="2025-05-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_managed_hsms_list_deleted(self, resource_group): + response = self.client.managed_hsms.list_deleted() + result = [r for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_managed_hsms_check_mhsm_name_availability(self, resource_group): response = self.client.managed_hsms.check_mhsm_name_availability( mhsm_name={"name": "str"}, - api_version="2025-05-01", ) # please add some check logic here by yourself diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_managed_hsms_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_managed_hsms_operations_async.py index 806a4e1da9ca..2ea90eca4af9 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_managed_hsms_operations_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_managed_hsms_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -19,6 +19,17 @@ class TestKeyVaultManagementManagedHsmsOperationsAsync(AzureMgmtRecordedTestCase def setup_method(self, method): self.client = self.create_mgmt_client(KeyVaultManagementClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_managed_hsms_get(self, resource_group): + response = await self.client.managed_hsms.get( + resource_group_name=resource_group.name, + name="str", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_managed_hsms_begin_create_or_update(self, resource_group): @@ -38,8 +49,8 @@ async def test_managed_hsms_begin_create_or_update(self, resource_group): "name": "str", "properties": { "createMode": "str", - "enablePurgeProtection": True, - "enableSoftDelete": True, + "enablePurgeProtection": bool, + "enableSoftDelete": bool, "hsmUri": "str", "initialAdminObjectIds": ["str"], "networkAcls": { @@ -53,25 +64,27 @@ async def test_managed_hsms_begin_create_or_update(self, resource_group): { "etag": "str", "id": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": { - "actionsRequired": "str", - "description": "str", - "status": "str", + "properties": { + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", }, - "provisioningState": "str", } ], "provisioningState": "str", - "publicNetworkAccess": "Enabled", + "publicNetworkAccess": "str", "regions": [{"isPrimary": bool, "name": "str", "provisioningState": "str"}], "scheduledPurgeDate": "2020-02-20 00:00:00", "securityDomainProperties": {"activationStatus": "str", "activationStatusMessage": "str"}, - "softDeleteRetentionInDays": 90, + "softDeleteRetentionInDays": 0, "statusMessage": "str", "tenantId": "str", }, - "sku": {"family": "B", "name": "str"}, + "sku": {"family": "str", "name": "str"}, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -83,7 +96,6 @@ async def test_managed_hsms_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2025-05-01", ) ).result() # call '.result()' to poll until service return final result @@ -109,8 +121,8 @@ async def test_managed_hsms_begin_update(self, resource_group): "name": "str", "properties": { "createMode": "str", - "enablePurgeProtection": True, - "enableSoftDelete": True, + "enablePurgeProtection": bool, + "enableSoftDelete": bool, "hsmUri": "str", "initialAdminObjectIds": ["str"], "networkAcls": { @@ -124,25 +136,27 @@ async def test_managed_hsms_begin_update(self, resource_group): { "etag": "str", "id": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": { - "actionsRequired": "str", - "description": "str", - "status": "str", + "properties": { + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", }, - "provisioningState": "str", } ], "provisioningState": "str", - "publicNetworkAccess": "Enabled", + "publicNetworkAccess": "str", "regions": [{"isPrimary": bool, "name": "str", "provisioningState": "str"}], "scheduledPurgeDate": "2020-02-20 00:00:00", "securityDomainProperties": {"activationStatus": "str", "activationStatusMessage": "str"}, - "softDeleteRetentionInDays": 90, + "softDeleteRetentionInDays": 0, "statusMessage": "str", "tenantId": "str", }, - "sku": {"family": "B", "name": "str"}, + "sku": {"family": "str", "name": "str"}, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -154,7 +168,6 @@ async def test_managed_hsms_begin_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2025-05-01", ) ).result() # call '.result()' to poll until service return final result @@ -168,31 +181,17 @@ async def test_managed_hsms_begin_delete(self, resource_group): await self.client.managed_hsms.begin_delete( resource_group_name=resource_group.name, name="str", - api_version="2025-05-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_managed_hsms_get(self, resource_group): - response = await self.client.managed_hsms.get( - resource_group_name=resource_group.name, - name="str", - api_version="2025-05-01", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_managed_hsms_list_by_resource_group(self, resource_group): response = self.client.managed_hsms.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2025-05-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -201,19 +200,7 @@ async def test_managed_hsms_list_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_managed_hsms_list_by_subscription(self, resource_group): - response = self.client.managed_hsms.list_by_subscription( - api_version="2025-05-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_managed_hsms_list_deleted(self, resource_group): - response = self.client.managed_hsms.list_deleted( - api_version="2025-05-01", - ) + response = self.client.managed_hsms.list_by_subscription() result = [r async for r in response] # please add some check logic here by yourself # ... @@ -224,7 +211,6 @@ async def test_managed_hsms_get_deleted(self, resource_group): response = await self.client.managed_hsms.get_deleted( name="str", location="str", - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -237,19 +223,25 @@ async def test_managed_hsms_begin_purge_deleted(self, resource_group): await self.client.managed_hsms.begin_purge_deleted( name="str", location="str", - api_version="2025-05-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_managed_hsms_list_deleted(self, resource_group): + response = self.client.managed_hsms.list_deleted() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_managed_hsms_check_mhsm_name_availability(self, resource_group): response = await self.client.managed_hsms.check_mhsm_name_availability( mhsm_name={"name": "str"}, - api_version="2025-05-01", ) # please add some check logic here by yourself diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_mhsm_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_mhsm_private_endpoint_connections_operations.py index 311b1790fc8a..42b7a8aa6399 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_mhsm_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_mhsm_private_endpoint_connections_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -18,18 +18,6 @@ class TestKeyVaultManagementMHSMPrivateEndpointConnectionsOperations(AzureMgmtRe def setup_method(self, method): self.client = self.create_mgmt_client(KeyVaultManagementClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_mhsm_private_endpoint_connections_list_by_resource(self, resource_group): - response = self.client.mhsm_private_endpoint_connections.list_by_resource( - resource_group_name=resource_group.name, - name="str", - api_version="2025-05-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_mhsm_private_endpoint_connections_get(self, resource_group): @@ -37,7 +25,6 @@ def test_mhsm_private_endpoint_connections_get(self, resource_group): resource_group_name=resource_group.name, name="str", private_endpoint_connection_name="str", - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -61,10 +48,16 @@ def test_mhsm_private_endpoint_connections_put(self, resource_group): }, "location": "str", "name": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": {"actionsRequired": "str", "description": "str", "status": "str"}, - "provisioningState": "str", - "sku": {"family": "B", "name": "str"}, + "properties": { + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + }, + "sku": {"family": "str", "name": "str"}, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -76,7 +69,6 @@ def test_mhsm_private_endpoint_connections_put(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -89,8 +81,18 @@ def test_mhsm_private_endpoint_connections_begin_delete(self, resource_group): resource_group_name=resource_group.name, name="str", private_endpoint_connection_name="str", - api_version="2025-05-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_mhsm_private_endpoint_connections_list_by_resource(self, resource_group): + response = self.client.mhsm_private_endpoint_connections.list_by_resource( + resource_group_name=resource_group.name, + name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_mhsm_private_endpoint_connections_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_mhsm_private_endpoint_connections_operations_async.py index 9d2548be2aa6..f570c99b6fd6 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_mhsm_private_endpoint_connections_operations_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_mhsm_private_endpoint_connections_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -19,18 +19,6 @@ class TestKeyVaultManagementMHSMPrivateEndpointConnectionsOperationsAsync(AzureM def setup_method(self, method): self.client = self.create_mgmt_client(KeyVaultManagementClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_mhsm_private_endpoint_connections_list_by_resource(self, resource_group): - response = self.client.mhsm_private_endpoint_connections.list_by_resource( - resource_group_name=resource_group.name, - name="str", - api_version="2025-05-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_mhsm_private_endpoint_connections_get(self, resource_group): @@ -38,7 +26,6 @@ async def test_mhsm_private_endpoint_connections_get(self, resource_group): resource_group_name=resource_group.name, name="str", private_endpoint_connection_name="str", - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -62,10 +49,16 @@ async def test_mhsm_private_endpoint_connections_put(self, resource_group): }, "location": "str", "name": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": {"actionsRequired": "str", "description": "str", "status": "str"}, - "provisioningState": "str", - "sku": {"family": "B", "name": "str"}, + "properties": { + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + }, + "sku": {"family": "str", "name": "str"}, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -77,7 +70,6 @@ async def test_mhsm_private_endpoint_connections_put(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -91,9 +83,19 @@ async def test_mhsm_private_endpoint_connections_begin_delete(self, resource_gro resource_group_name=resource_group.name, name="str", private_endpoint_connection_name="str", - api_version="2025-05-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_mhsm_private_endpoint_connections_list_by_resource(self, resource_group): + response = self.client.mhsm_private_endpoint_connections.list_by_resource( + resource_group_name=resource_group.name, + name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_mhsm_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_mhsm_private_link_resources_operations.py index e21728724d9f..ce82306a840f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_mhsm_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_mhsm_private_link_resources_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -24,7 +24,6 @@ def test_mhsm_private_link_resources_list_by_mhsm_resource(self, resource_group) response = self.client.mhsm_private_link_resources.list_by_mhsm_resource( resource_group_name=resource_group.name, name="str", - api_version="2025-05-01", ) # please add some check logic here by yourself diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_mhsm_private_link_resources_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_mhsm_private_link_resources_operations_async.py index b8067e7f9b1e..39701b7dad62 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_mhsm_private_link_resources_operations_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_mhsm_private_link_resources_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -25,7 +25,6 @@ async def test_mhsm_private_link_resources_list_by_mhsm_resource(self, resource_ response = await self.client.mhsm_private_link_resources.list_by_mhsm_resource( resource_group_name=resource_group.name, name="str", - api_version="2025-05-01", ) # please add some check logic here by yourself diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_mhsm_regions_operations.py b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_mhsm_regions_operations.py index 49e6d1101826..5068c5e1c592 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_mhsm_regions_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_mhsm_regions_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -24,7 +24,6 @@ def test_mhsm_regions_list_by_resource(self, resource_group): response = self.client.mhsm_regions.list_by_resource( resource_group_name=resource_group.name, name="str", - api_version="2025-05-01", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_mhsm_regions_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_mhsm_regions_operations_async.py index 79c1adee6b4b..a81233856c85 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_mhsm_regions_operations_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_mhsm_regions_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -25,7 +25,6 @@ async def test_mhsm_regions_list_by_resource(self, resource_group): response = self.client.mhsm_regions.list_by_resource( resource_group_name=resource_group.name, name="str", - api_version="2025-05-01", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_operations.py b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_operations.py index 5decaadda93e..a606e05f3e59 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -21,9 +21,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_operations_list(self, resource_group): - response = self.client.operations.list( - api_version="2025-05-01", - ) + response = self.client.operations.list() result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_operations_async.py index 2c77a0610d5a..66dfea1e9385 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_operations_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -22,9 +22,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_operations_list(self, resource_group): - response = self.client.operations.list( - api_version="2025-05-01", - ) + response = self.client.operations.list() result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_private_endpoint_connections_operations.py index 89c57d543e47..689c19afc291 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_private_endpoint_connections_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -25,7 +25,6 @@ def test_private_endpoint_connections_get(self, resource_group): resource_group_name=resource_group.name, vault_name="str", private_endpoint_connection_name="str", - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -43,13 +42,26 @@ def test_private_endpoint_connections_put(self, resource_group): "id": "str", "location": "str", "name": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": {"actionsRequired": "str", "description": "str", "status": "str"}, - "provisioningState": "str", + "properties": { + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, "tags": {"str": "str"}, "type": "str", }, - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -62,7 +74,6 @@ def test_private_endpoint_connections_begin_delete(self, resource_group): resource_group_name=resource_group.name, vault_name="str", private_endpoint_connection_name="str", - api_version="2025-05-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -74,7 +85,6 @@ def test_private_endpoint_connections_list_by_resource(self, resource_group): response = self.client.private_endpoint_connections.list_by_resource( resource_group_name=resource_group.name, vault_name="str", - api_version="2025-05-01", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_private_endpoint_connections_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_private_endpoint_connections_operations_async.py index be2726e085f7..dc77fc741ce5 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_private_endpoint_connections_operations_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_private_endpoint_connections_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -26,7 +26,6 @@ async def test_private_endpoint_connections_get(self, resource_group): resource_group_name=resource_group.name, vault_name="str", private_endpoint_connection_name="str", - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -44,13 +43,26 @@ async def test_private_endpoint_connections_put(self, resource_group): "id": "str", "location": "str", "name": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": {"actionsRequired": "str", "description": "str", "status": "str"}, - "provisioningState": "str", + "properties": { + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, "tags": {"str": "str"}, "type": "str", }, - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -64,7 +76,6 @@ async def test_private_endpoint_connections_begin_delete(self, resource_group): resource_group_name=resource_group.name, vault_name="str", private_endpoint_connection_name="str", - api_version="2025-05-01", ) ).result() # call '.result()' to poll until service return final result @@ -77,7 +88,6 @@ async def test_private_endpoint_connections_list_by_resource(self, resource_grou response = self.client.private_endpoint_connections.list_by_resource( resource_group_name=resource_group.name, vault_name="str", - api_version="2025-05-01", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_private_link_resources_operations.py index ca77a57bcf30..8a0d0f919d85 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_private_link_resources_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -24,7 +24,6 @@ def test_private_link_resources_list_by_vault(self, resource_group): response = self.client.private_link_resources.list_by_vault( resource_group_name=resource_group.name, vault_name="str", - api_version="2025-05-01", ) # please add some check logic here by yourself diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_private_link_resources_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_private_link_resources_operations_async.py index 101add7c2a2f..0ed3e445cf0b 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_private_link_resources_operations_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_private_link_resources_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -25,7 +25,6 @@ async def test_private_link_resources_list_by_vault(self, resource_group): response = await self.client.private_link_resources.list_by_vault( resource_group_name=resource_group.name, vault_name="str", - api_version="2025-05-01", ) # please add some check logic here by yourself diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_secrets_operations.py b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_secrets_operations.py index 672974e1d13d..76bf7223e328 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_secrets_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_secrets_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -18,6 +18,18 @@ class TestKeyVaultManagementSecretsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(KeyVaultManagementClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_secrets_get(self, resource_group): + response = self.client.secrets.get( + resource_group_name=resource_group.name, + vault_name="str", + secret_name="str", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_secrets_create_or_update(self, resource_group): @@ -41,7 +53,6 @@ def test_secrets_create_or_update(self, resource_group): }, "tags": {"str": "str"}, }, - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -68,20 +79,6 @@ def test_secrets_update(self, resource_group): }, "tags": {"str": "str"}, }, - api_version="2025-05-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_secrets_get(self, resource_group): - response = self.client.secrets.get( - resource_group_name=resource_group.name, - vault_name="str", - secret_name="str", - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -93,7 +90,6 @@ def test_secrets_list(self, resource_group): response = self.client.secrets.list( resource_group_name=resource_group.name, vault_name="str", - api_version="2025-05-01", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_secrets_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_secrets_operations_async.py index b56870b3174c..53acabf58ae7 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_secrets_operations_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_secrets_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -19,6 +19,18 @@ class TestKeyVaultManagementSecretsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(KeyVaultManagementClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_secrets_get(self, resource_group): + response = await self.client.secrets.get( + resource_group_name=resource_group.name, + vault_name="str", + secret_name="str", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_secrets_create_or_update(self, resource_group): @@ -42,7 +54,6 @@ async def test_secrets_create_or_update(self, resource_group): }, "tags": {"str": "str"}, }, - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -69,20 +80,6 @@ async def test_secrets_update(self, resource_group): }, "tags": {"str": "str"}, }, - api_version="2025-05-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_secrets_get(self, resource_group): - response = await self.client.secrets.get( - resource_group_name=resource_group.name, - vault_name="str", - secret_name="str", - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -94,7 +91,6 @@ async def test_secrets_list(self, resource_group): response = self.client.secrets.list( resource_group_name=resource_group.name, vault_name="str", - api_version="2025-05-01", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_vaults_operations.py index cb6da6d8c1c5..ee0fc69fa4b7 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_vaults_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -18,6 +18,17 @@ class TestKeyVaultManagementVaultsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(KeyVaultManagementClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_vaults_get(self, resource_group): + response = self.client.vaults.get( + resource_group_name=resource_group.name, + vault_name="str", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_vaults_begin_create_or_update(self, resource_group): @@ -27,7 +38,7 @@ def test_vaults_begin_create_or_update(self, resource_group): parameters={ "location": "str", "properties": { - "sku": {"family": "A", "name": "str"}, + "sku": {"family": "str", "name": "str"}, "tenantId": "str", "accessPolicies": [ { @@ -44,11 +55,11 @@ def test_vaults_begin_create_or_update(self, resource_group): ], "createMode": "str", "enablePurgeProtection": bool, - "enableRbacAuthorization": False, - "enableSoftDelete": True, - "enabledForDeployment": False, - "enabledForDiskEncryption": False, - "enabledForTemplateDeployment": False, + "enableRbacAuthorization": bool, + "enableSoftDelete": bool, + "enabledForDeployment": bool, + "enabledForDiskEncryption": bool, + "enabledForTemplateDeployment": bool, "hsmPoolResourceId": "str", "networkAcls": { "bypass": "str", @@ -60,23 +71,24 @@ def test_vaults_begin_create_or_update(self, resource_group): { "etag": "str", "id": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": { - "actionsRequired": "str", - "description": "str", - "status": "str", + "properties": { + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", }, - "provisioningState": "str", } ], "provisioningState": "str", - "publicNetworkAccess": "enabled", - "softDeleteRetentionInDays": 90, + "publicNetworkAccess": "str", + "softDeleteRetentionInDays": 0, "vaultUri": "str", }, "tags": {"str": "str"}, }, - api_version="2025-05-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -117,13 +129,12 @@ def test_vaults_update(self, resource_group): "virtualNetworkRules": [{"id": "str", "ignoreMissingVnetServiceEndpoint": bool}], }, "publicNetworkAccess": "str", - "sku": {"family": "A", "name": "str"}, + "sku": {"family": "str", "name": "str"}, "softDeleteRetentionInDays": 0, "tenantId": "str", }, "tags": {"str": "str"}, }, - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -135,7 +146,6 @@ def test_vaults_delete(self, resource_group): response = self.client.vaults.delete( resource_group_name=resource_group.name, vault_name="str", - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -143,13 +153,19 @@ def test_vaults_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_vaults_get(self, resource_group): - response = self.client.vaults.get( + def test_vaults_list_by_resource_group(self, resource_group): + response = self.client.vaults.list_by_resource_group( resource_group_name=resource_group.name, - vault_name="str", - api_version="2025-05-01", ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_vaults_list_by_subscription(self, resource_group): + response = self.client.vaults.list_by_subscription() + result = [r for r in response] # please add some check logic here by yourself # ... @@ -181,50 +197,17 @@ def test_vaults_update_access_policy(self, resource_group): "name": "str", "type": "str", }, - api_version="2025-05-01", ) # please add some check logic here by yourself # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_vaults_list_by_resource_group(self, resource_group): - response = self.client.vaults.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-05-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_vaults_list_by_subscription(self, resource_group): - response = self.client.vaults.list_by_subscription( - api_version="2025-05-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_vaults_list_deleted(self, resource_group): - response = self.client.vaults.list_deleted( - api_version="2025-05-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_vaults_get_deleted(self, resource_group): response = self.client.vaults.get_deleted( vault_name="str", location="str", - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -236,12 +219,19 @@ def test_vaults_begin_purge_deleted(self, resource_group): response = self.client.vaults.begin_purge_deleted( vault_name="str", location="str", - api_version="2025-05-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_vaults_list_deleted(self, resource_group): + response = self.client.vaults.list_deleted() + result = [r for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_vaults_list(self, resource_group): @@ -258,7 +248,6 @@ def test_vaults_list(self, resource_group): def test_vaults_check_name_availability(self, resource_group): response = self.client.vaults.check_name_availability( vault_name={"name": "str", "type": "Microsoft.KeyVault/vaults"}, - api_version="2025-05-01", ) # please add some check logic here by yourself diff --git a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_vaults_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_vaults_operations_async.py index a156da32ec74..e7345489349d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_vaults_operations_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/generated_tests/test_key_vault_management_vaults_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -19,6 +19,17 @@ class TestKeyVaultManagementVaultsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(KeyVaultManagementClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_vaults_get(self, resource_group): + response = await self.client.vaults.get( + resource_group_name=resource_group.name, + vault_name="str", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_vaults_begin_create_or_update(self, resource_group): @@ -29,7 +40,7 @@ async def test_vaults_begin_create_or_update(self, resource_group): parameters={ "location": "str", "properties": { - "sku": {"family": "A", "name": "str"}, + "sku": {"family": "str", "name": "str"}, "tenantId": "str", "accessPolicies": [ { @@ -46,11 +57,11 @@ async def test_vaults_begin_create_or_update(self, resource_group): ], "createMode": "str", "enablePurgeProtection": bool, - "enableRbacAuthorization": False, - "enableSoftDelete": True, - "enabledForDeployment": False, - "enabledForDiskEncryption": False, - "enabledForTemplateDeployment": False, + "enableRbacAuthorization": bool, + "enableSoftDelete": bool, + "enabledForDeployment": bool, + "enabledForDiskEncryption": bool, + "enabledForTemplateDeployment": bool, "hsmPoolResourceId": "str", "networkAcls": { "bypass": "str", @@ -62,23 +73,24 @@ async def test_vaults_begin_create_or_update(self, resource_group): { "etag": "str", "id": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": { - "actionsRequired": "str", - "description": "str", - "status": "str", + "properties": { + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", }, - "provisioningState": "str", } ], "provisioningState": "str", - "publicNetworkAccess": "enabled", - "softDeleteRetentionInDays": 90, + "publicNetworkAccess": "str", + "softDeleteRetentionInDays": 0, "vaultUri": "str", }, "tags": {"str": "str"}, }, - api_version="2025-05-01", ) ).result() # call '.result()' to poll until service return final result @@ -120,13 +132,12 @@ async def test_vaults_update(self, resource_group): "virtualNetworkRules": [{"id": "str", "ignoreMissingVnetServiceEndpoint": bool}], }, "publicNetworkAccess": "str", - "sku": {"family": "A", "name": "str"}, + "sku": {"family": "str", "name": "str"}, "softDeleteRetentionInDays": 0, "tenantId": "str", }, "tags": {"str": "str"}, }, - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -138,7 +149,6 @@ async def test_vaults_delete(self, resource_group): response = await self.client.vaults.delete( resource_group_name=resource_group.name, vault_name="str", - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -146,13 +156,19 @@ async def test_vaults_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_vaults_get(self, resource_group): - response = await self.client.vaults.get( + async def test_vaults_list_by_resource_group(self, resource_group): + response = self.client.vaults.list_by_resource_group( resource_group_name=resource_group.name, - vault_name="str", - api_version="2025-05-01", ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_vaults_list_by_subscription(self, resource_group): + response = self.client.vaults.list_by_subscription() + result = [r async for r in response] # please add some check logic here by yourself # ... @@ -184,40 +200,8 @@ async def test_vaults_update_access_policy(self, resource_group): "name": "str", "type": "str", }, - api_version="2025-05-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_vaults_list_by_resource_group(self, resource_group): - response = self.client.vaults.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-05-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_vaults_list_by_subscription(self, resource_group): - response = self.client.vaults.list_by_subscription( - api_version="2025-05-01", ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_vaults_list_deleted(self, resource_group): - response = self.client.vaults.list_deleted( - api_version="2025-05-01", - ) - result = [r async for r in response] # please add some check logic here by yourself # ... @@ -227,7 +211,6 @@ async def test_vaults_get_deleted(self, resource_group): response = await self.client.vaults.get_deleted( vault_name="str", location="str", - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -240,13 +223,20 @@ async def test_vaults_begin_purge_deleted(self, resource_group): await self.client.vaults.begin_purge_deleted( vault_name="str", location="str", - api_version="2025-05-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_vaults_list_deleted(self, resource_group): + response = self.client.vaults.list_deleted() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_vaults_list(self, resource_group): @@ -263,7 +253,6 @@ async def test_vaults_list(self, resource_group): async def test_vaults_check_name_availability(self, resource_group): response = await self.client.vaults.check_name_availability( vault_name={"name": "str", "type": "Microsoft.KeyVault/vaults"}, - api_version="2025-05-01", ) # please add some check logic here by yourself diff --git a/sdk/keyvault/azure-mgmt-keyvault/pyproject.toml b/sdk/keyvault/azure-mgmt-keyvault/pyproject.toml index c1591da672f0..53df278bd915 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/pyproject.toml +++ b/sdk/keyvault/azure-mgmt-keyvault/pyproject.toml @@ -29,7 +29,7 @@ keywords = [ "azure sdk", ] dependencies = [ - "msrest>=0.7.1", + "isodate>=0.6.1", "azure-mgmt-core>=1.6.0", "typing-extensions>=4.6.0", ] @@ -54,8 +54,8 @@ content-type = "text/markdown" [tool.setuptools.packages.find] exclude = [ "tests*", - "samples*", "generated_tests*", + "samples*", "generated_samples*", "doc*", "azure", diff --git a/sdk/keyvault/azure-mgmt-keyvault/tests/disable_test_cli_mgmt_keyvault_async.py b/sdk/keyvault/azure-mgmt-keyvault/tests/disable_test_cli_mgmt_keyvault_async.py index 6df9ec1af5ad..265ce615e9b8 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/tests/disable_test_cli_mgmt_keyvault_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/tests/disable_test_cli_mgmt_keyvault_async.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding: utf-8 # ------------------------------------------------------------------------- diff --git a/sdk/keyvault/azure-mgmt-keyvault/tsp-location.yaml b/sdk/keyvault/azure-mgmt-keyvault/tsp-location.yaml new file mode 100644 index 000000000000..6c9972e5468f --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/keyvault/KeyVault.Management +commit: 0476e10d463909ce48ba4a8365d971586ede7f98 +repo: Azure/azure-rest-api-specs +additionalDirectories: From a9998881cb3a08b62edbc56866074da5f27eb135 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Tue, 21 Oct 2025 17:10:36 +0800 Subject: [PATCH 02/34] update changelog --- sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md | 32 ++++--------------- 1 file changed, 6 insertions(+), 26 deletions(-) diff --git a/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md b/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md index c2a2c0818ff6..3ce48037e434 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md +++ b/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md @@ -28,32 +28,12 @@ ### Breaking Changes - - Model `Key` deleted or renamed its instance variable `attributes` - - Model `Key` deleted or renamed its instance variable `kty` - - Model `Key` deleted or renamed its instance variable `key_ops` - - Model `Key` deleted or renamed its instance variable `key_size` - - Model `Key` deleted or renamed its instance variable `curve_name` - - Model `Key` deleted or renamed its instance variable `key_uri` - - Model `Key` deleted or renamed its instance variable `key_uri_with_version` - - Model `Key` deleted or renamed its instance variable `rotation_policy` - - Model `Key` deleted or renamed its instance variable `release_policy` - - Model `MHSMPrivateEndpointConnectionItem` deleted or renamed its instance variable `private_endpoint` - - Model `MHSMPrivateEndpointConnectionItem` deleted or renamed its instance variable `private_link_service_connection_state` - - Model `MHSMPrivateEndpointConnectionItem` deleted or renamed its instance variable `provisioning_state` - - Model `ManagedHsmKey` deleted or renamed its instance variable `attributes` - - Model `ManagedHsmKey` deleted or renamed its instance variable `kty` - - Model `ManagedHsmKey` deleted or renamed its instance variable `key_ops` - - Model `ManagedHsmKey` deleted or renamed its instance variable `key_size` - - Model `ManagedHsmKey` deleted or renamed its instance variable `curve_name` - - Model `ManagedHsmKey` deleted or renamed its instance variable `key_uri` - - Model `ManagedHsmKey` deleted or renamed its instance variable `key_uri_with_version` - - Model `ManagedHsmKey` deleted or renamed its instance variable `rotation_policy` - - Model `ManagedHsmKey` deleted or renamed its instance variable `release_policy` - - Model `Operation` deleted or renamed its instance variable `service_specification` - - Model `Permissions` deleted or renamed its instance variable `keys` - - Model `PrivateEndpointConnectionItem` deleted or renamed its instance variable `private_endpoint` - - Model `PrivateEndpointConnectionItem` deleted or renamed its instance variable `private_link_service_connection_state` - - Model `PrivateEndpointConnectionItem` deleted or renamed its instance variable `provisioning_state` + - Model `Key` instance variables `attributes`, `kty`, `key_ops`, `key_size`, `curve_name`, `key_uri`, `key_uri_with_version`, `rotation_policy`, and `release_policy` have been moved under property `properties` + - Model `MHSMPrivateEndpointConnectionItem` instance variables `private_endpoint`, `private_link_service_connection_state`, and `provisioning_state` have been moved under property `properties` + - Model `ManagedHsmKey` instance variables `attributes`, `kty`, `key_ops`, `key_size`, `curve_name`, `key_uri`, `key_uri_with_version`, `rotation_policy`, and `release_policy` have been moved under property `properties` + - Model `Operation` instance variable `service_specification` has been moved under property `operation_properties` + - Model `Permissions` instance variable `keys` has been moved under property `keys_property` + - Model `PrivateEndpointConnectionItem` instance variables `private_endpoint`, `private_link_service_connection_state`, and `provisioning_state` have been moved under property `properties` - Deleted or renamed model `IdentityType` - Deleted or renamed model `ProxyResourceWithoutSystemData` - Deleted or renamed model `Resource` From 310b2b519cbedaedca36ebbafa74ef5029d3bbf7 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Tue, 21 Oct 2025 17:15:41 +0800 Subject: [PATCH 03/34] update changelog --- sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md b/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md index 3ce48037e434..004cb6998d05 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md +++ b/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md @@ -13,7 +13,6 @@ - Model `ManagedHsmKey` added property `properties` - Model `ManagedHsmKey` added property `system_data` - Model `Operation` added property `operation_properties` - - Model `Permissions` added property `keys_property` - Model `PrivateEndpointConnection` added property `system_data` - Model `PrivateEndpointConnectionItem` added property `properties` - Model `PrivateLinkResource` added property `system_data` @@ -32,7 +31,7 @@ - Model `MHSMPrivateEndpointConnectionItem` instance variables `private_endpoint`, `private_link_service_connection_state`, and `provisioning_state` have been moved under property `properties` - Model `ManagedHsmKey` instance variables `attributes`, `kty`, `key_ops`, `key_size`, `curve_name`, `key_uri`, `key_uri_with_version`, `rotation_policy`, and `release_policy` have been moved under property `properties` - Model `Operation` instance variable `service_specification` has been moved under property `operation_properties` - - Model `Permissions` instance variable `keys` has been moved under property `keys_property` + - Model `Permissions` renamed instance variable `keys` to `keys_property` - Model `PrivateEndpointConnectionItem` instance variables `private_endpoint`, `private_link_service_connection_state`, and `provisioning_state` have been moved under property `properties` - Deleted or renamed model `IdentityType` - Deleted or renamed model `ProxyResourceWithoutSystemData` From 12227ee946ba98e9070b96d503e72bdbe2cb8c44 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Tue, 21 Oct 2025 17:36:30 +0800 Subject: [PATCH 04/34] add customized code with easy way --- .../azure/mgmt/keyvault/aio/operations/_operations.py | 4 ++-- .../azure/mgmt/keyvault/operations/_operations.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py index 8285d0c15174..951ca22e5b09 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py @@ -1367,7 +1367,7 @@ def list(self, *, top: Optional[int] = None, **kwargs: Any) -> AsyncItemPaged["_ _params = kwargs.pop("params", {}) or {} filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop("filter") - api_version: Literal["2015-11-01"] = kwargs.pop("api_version") + api_version: Literal["2015-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-11-01")) cls: ClsType[List[_models.TrackedResource]] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -1405,7 +1405,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._config.api_version + _next_request_params["api-version"] = api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py index 17d087886574..b978e1b88159 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py @@ -2677,7 +2677,7 @@ def list(self, *, top: Optional[int] = None, **kwargs: Any) -> ItemPaged["_model _params = kwargs.pop("params", {}) or {} filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop("filter") - api_version: Literal["2015-11-01"] = kwargs.pop("api_version") + api_version: Literal["2015-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-11-01")) cls: ClsType[List[_models.TrackedResource]] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -2715,7 +2715,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._config.api_version + _next_request_params["api-version"] = api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) From 5c5aed62e060f454c286645fb1998307a9af0679 Mon Sep 17 00:00:00 2001 From: ChenxiJiang333 Date: Tue, 21 Oct 2025 17:50:33 +0800 Subject: [PATCH 05/34] update testcases --- .../tests/test_key_vault_management_operations_async_test.py | 4 +--- .../tests/test_key_vault_management_operations_test.py | 4 +--- .../test_key_vault_management_vaults_operations_async_test.py | 1 - .../tests/test_key_vault_management_vaults_operations_test.py | 2 -- 4 files changed, 2 insertions(+), 9 deletions(-) diff --git a/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_operations_async_test.py b/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_operations_async_test.py index 53fc4097db51..7885b81ed2cd 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_operations_async_test.py +++ b/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_operations_async_test.py @@ -22,8 +22,6 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_list(self, resource_group): - response = self.client.operations.list( - api_version="2023-07-01", - ) + response = self.client.operations.list() result = [r async for r in response] assert result diff --git a/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_operations_test.py b/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_operations_test.py index 28526690f762..80303642c5a7 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_operations_test.py +++ b/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_operations_test.py @@ -21,8 +21,6 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_list(self, resource_group): - response = self.client.operations.list( - api_version="2023-07-01", - ) + response = self.client.operations.list() result = [r for r in response] assert result diff --git a/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_async_test.py b/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_async_test.py index 14f7cc1c579e..23efedd9a007 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_async_test.py +++ b/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_async_test.py @@ -24,7 +24,6 @@ def setup_method(self, method): async def test_list_by_resource_group(self, resource_group): response = self.client.vaults.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2023-07-01", ) result = [r async for r in response] assert result == [] diff --git a/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_test.py b/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_test.py index e7c2904b9bcf..232087960580 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_test.py +++ b/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_test.py @@ -23,7 +23,6 @@ def setup_method(self, method): def test_list_by_resource_group(self, resource_group): response = self.client.vaults.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2023-07-01", ) result = [r for r in response] assert result == [] @@ -32,7 +31,6 @@ def test_list_by_resource_group(self, resource_group): def test_list(self): response = self.client.vaults.list( filter="resourceType eq 'Microsoft.KeyVault/vaults'", - api_version="2015-11-01", ) result = [r for r in response] assert result From d9bc043cbd917fa32e99a16d0cbf75058dea73b6 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Wed, 22 Oct 2025 11:20:34 +0800 Subject: [PATCH 06/34] update --- .../azure/mgmt/keyvault/aio/operations/_operations.py | 6 ++++-- .../azure/mgmt/keyvault/operations/_operations.py | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py index 951ca22e5b09..257c4e18a698 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py @@ -1366,7 +1366,9 @@ def list(self, *, top: Optional[int] = None, **kwargs: Any) -> AsyncItemPaged["_ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop("filter") + filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop( + "filter", _params.pop("$filter", "resourceType eq 'Microsoft.KeyVault/vaults'") + ) api_version: Literal["2015-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-11-01")) cls: ClsType[List[_models.TrackedResource]] = kwargs.pop("cls", None) @@ -1405,7 +1407,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py index b978e1b88159..8efb0d5dccf0 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py @@ -2676,7 +2676,9 @@ def list(self, *, top: Optional[int] = None, **kwargs: Any) -> ItemPaged["_model _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop("filter") + filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop( + "filter", _params.pop("$filter", "resourceType eq 'Microsoft.KeyVault/vaults'") + ) api_version: Literal["2015-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-11-01")) cls: ClsType[List[_models.TrackedResource]] = kwargs.pop("cls", None) @@ -2715,7 +2717,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) From 6e09d1d513da26c55c7960442f0f20f5e59e149a Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Wed, 22 Oct 2025 11:21:05 +0800 Subject: [PATCH 07/34] customize --- .../azure/mgmt/keyvault/aio/operations/_operations.py | 2 +- .../azure/mgmt/keyvault/operations/_operations.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py index 257c4e18a698..bec1c3d07251 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py @@ -1407,7 +1407,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._config.api_version + _next_request_params["api-version"] = api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py index 8efb0d5dccf0..4565f5ab373d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py @@ -2717,7 +2717,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._config.api_version + _next_request_params["api-version"] = api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) From 7d059159fedf60dbef393de6197fcf414a2d26b2 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Wed, 22 Oct 2025 12:55:26 +0800 Subject: [PATCH 08/34] update test case for customization --- ...management_vaults_operations_async_test.py | 43 +++++++++++++++++++ ...vault_management_vaults_operations_test.py | 35 +++++++++++++++ 2 files changed, 78 insertions(+) diff --git a/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_async_test.py b/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_async_test.py index 23efedd9a007..9afd687b86b2 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_async_test.py +++ b/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_async_test.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest +import json from azure.mgmt.keyvault.aio import KeyVaultManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer @@ -27,3 +28,45 @@ async def test_list_by_resource_group(self, resource_group): ) result = [r async for r in response] assert result == [] + + @recorded_by_proxy_async + async def test_list(self): + response = self.client.vaults.list( + filter="resourceType eq 'Microsoft.KeyVault/vaults'", + ) + result = [r async for r in response] + assert result + + @recorded_by_proxy_async + async def test_list_customized_api_version(self): + # This API is legacy paging API that api-version of init request and next link must be "2015-11-01". + # Although this API violates ARM guidelines, we have to support it for backward compatibility. + # So After SDK generation, you need to customize 2 lines like https://github.com/Azure/azure-sdk-for-python/pull/43559/commits/6e09d1d513da26c55c7960442f0f20f5e59e149a. + # And the test is to verify the customization works. + call_count = 0 + inject_next_link = True + + def raw_request_hook(request): + # api-version in next link must be "2015-11-01" + assert ( + request.http_request.url.count("api-version=2015-11-01") == 1 + ), "api-version query parameter is missing or duplicated" + nonlocal call_count + call_count += 1 + + def raw_response_hook(response): + nonlocal inject_next_link + if inject_next_link: + content = response.http_response._content.decode("utf-8") + data = json.loads(content) + if "nextLink" not in data: + # make sure there is nextLink for testing + data["nextLink"] = response.http_request.url.replace("&api-version=2015-11-01", "") + new_content = json.dumps(data).encode("utf-8") + response.http_response._content = new_content + inject_next_link = False # only inject nextLink once + + response = self.client.vaults.list(raw_request_hook=raw_request_hook, raw_response_hook=raw_response_hook) + result = [r async for r in response] + assert result + assert call_count >= 2 # make sure paging happened diff --git a/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_test.py b/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_test.py index 232087960580..5d32b11c1246 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_test.py +++ b/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_test.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest +import json from azure.mgmt.keyvault import KeyVaultManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -34,3 +35,37 @@ def test_list(self): ) result = [r for r in response] assert result + + @recorded_by_proxy + def test_list_customized_api_version(self): + # This API is legacy paging API that api-version of init request and next link must be "2015-11-01". + # Although this API violates ARM guidelines, we have to support it for backward compatibility. + # So After SDK generation, you need to customize 2 lines like https://github.com/Azure/azure-sdk-for-python/pull/43559/commits/6e09d1d513da26c55c7960442f0f20f5e59e149a. + # And the test is to verify the customization works. + call_count = 0 + inject_next_link = True + + def raw_request_hook(request): + # api-version in next link must be "2015-11-01" + assert ( + request.http_request.url.count("api-version=2015-11-01") == 1 + ), "api-version query parameter is missing or duplicated" + nonlocal call_count + call_count += 1 + + def raw_response_hook(response): + nonlocal inject_next_link + if inject_next_link: + content = response.http_response._content.decode("utf-8") + data = json.loads(content) + if "nextLink" not in data: + # make sure there is nextLink for testing + data["nextLink"] = response.http_request.url.replace("&api-version=2015-11-01", "") + new_content = json.dumps(data).encode("utf-8") + response.http_response._content = new_content + inject_next_link = False # only inject nextLink once + + response = self.client.vaults.list(raw_request_hook=raw_request_hook, raw_response_hook=raw_response_hook) + result = [r for r in response] + assert result + assert call_count >= 2 # make sure paging happened From ea6b48d59751eb24fed9194e667d1dff742f0592 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Wed, 22 Oct 2025 13:00:03 +0800 Subject: [PATCH 09/34] remove outdated test --- ...management_vaults_operations_async_test.py | 1 + .../azure-mgmt-keyvault/tests/test_patch.py | 30 ---------------- .../tests/test_patch_async.py | 34 ------------------- 3 files changed, 1 insertion(+), 64 deletions(-) delete mode 100644 sdk/keyvault/azure-mgmt-keyvault/tests/test_patch.py delete mode 100644 sdk/keyvault/azure-mgmt-keyvault/tests/test_patch_async.py diff --git a/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_async_test.py b/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_async_test.py index 9afd687b86b2..306890ba15df 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_async_test.py +++ b/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_async_test.py @@ -38,6 +38,7 @@ async def test_list(self): assert result @recorded_by_proxy_async + @pytest.mark.asyncio async def test_list_customized_api_version(self): # This API is legacy paging API that api-version of init request and next link must be "2015-11-01". # Although this API violates ARM guidelines, we have to support it for backward compatibility. diff --git a/sdk/keyvault/azure-mgmt-keyvault/tests/test_patch.py b/sdk/keyvault/azure-mgmt-keyvault/tests/test_patch.py deleted file mode 100644 index 31c1a17f57c8..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/tests/test_patch.py +++ /dev/null @@ -1,30 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for 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.mgmt.keyvault import KeyVaultManagementClient -from devtools_testutils import AzureMgmtRecordedTestCase, recorded_by_proxy -from utils import all_api_versions -import pytest - - -@pytest.mark.live_test_only -class TestKeyVaultManagementPatch(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(KeyVaultManagementClient) - - @recorded_by_proxy - def test_list(self): - api_versions = all_api_versions() - assert api_versions - for api_version in api_versions: - # make sure the client uses api_version we set - self.client._get_api_version = lambda x: api_version - response = self.client.vaults.list( - filter="resourceType eq 'Microsoft.KeyVault/vaults'", - ) - result = [r for r in response] - assert result diff --git a/sdk/keyvault/azure-mgmt-keyvault/tests/test_patch_async.py b/sdk/keyvault/azure-mgmt-keyvault/tests/test_patch_async.py deleted file mode 100644 index c67bd984c6b0..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/tests/test_patch_async.py +++ /dev/null @@ -1,34 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for 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 pytest -from azure.mgmt.keyvault.aio import KeyVaultManagementClient -from devtools_testutils.aio import recorded_by_proxy_async -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from utils import all_api_versions - -AZURE_LOCATION = "eastus" - - -@pytest.mark.live_test_only -class TestKeyVaultManagementVaultsPatchAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(KeyVaultManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_list(self): - api_versions = all_api_versions() - assert api_versions - for api_version in api_versions: - # make sure the client uses api_version we set - self.client._get_api_version = lambda x: api_version - response = self.client.vaults.list( - filter="resourceType eq 'Microsoft.KeyVault/vaults'", - ) - result = [r async for r in response] - assert result From b485b1615ce98974ae8f820a5a381a95c1c0e6aa Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Wed, 22 Oct 2025 13:09:07 +0800 Subject: [PATCH 10/34] update test case for customization --- .../test_key_vault_management_vaults_operations_async_test.py | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_async_test.py b/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_async_test.py index 306890ba15df..9afd687b86b2 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_async_test.py +++ b/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_async_test.py @@ -38,7 +38,6 @@ async def test_list(self): assert result @recorded_by_proxy_async - @pytest.mark.asyncio async def test_list_customized_api_version(self): # This API is legacy paging API that api-version of init request and next link must be "2015-11-01". # Although this API violates ARM guidelines, we have to support it for backward compatibility. From b19e5fa456e4945a11fe6b82e76e0c7e1373a46b Mon Sep 17 00:00:00 2001 From: ChenxiJiang333 Date: Wed, 22 Oct 2025 14:16:10 +0800 Subject: [PATCH 11/34] update testcases --- .../test_key_vault_management_vaults_operations_async_test.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_async_test.py b/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_async_test.py index 9afd687b86b2..e5970132e70a 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_async_test.py +++ b/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_async_test.py @@ -29,6 +29,7 @@ async def test_list_by_resource_group(self, resource_group): result = [r async for r in response] assert result == [] + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_list(self): response = self.client.vaults.list( @@ -37,6 +38,7 @@ async def test_list(self): result = [r async for r in response] assert result + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_list_customized_api_version(self): # This API is legacy paging API that api-version of init request and next link must be "2015-11-01". From 0c5090a6b7caca347d75accf8169f6fe6a6b6d0e Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Wed, 29 Oct 2025 07:58:06 +0000 Subject: [PATCH 12/34] Configurations: 'specification/keyvault/KeyVault.Management/tspconfig.yaml', API Version: 2025-05-01, SDK Release Type: stable, and CommitSHA: '08a510e768ebd24b415dd642416cf955b70c4069' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5511433 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md | 58 ++++ .../azure-mgmt-keyvault/_metadata.json | 4 +- .../keyvault/aio/operations/_operations.py | 246 ++++++++++++--- .../mgmt/keyvault/operations/_operations.py | 282 ++++++++++++++---- ...management_vaults_operations_async_test.py | 1 + ...vault_management_vaults_operations_test.py | 1 + .../azure-mgmt-keyvault/tsp-location.yaml | 2 +- 7 files changed, 487 insertions(+), 107 deletions(-) diff --git a/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md b/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md index 004cb6998d05..461d72194d90 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md +++ b/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md @@ -1,5 +1,63 @@ # Release History +## 13.0.0 (2025-10-29) + +### Features Added + + - Client `KeyVaultManagementClient` added method `send_request` + - Model `DeletedManagedHsm` added property `system_data` + - Model `DeletedVault` added property `system_data` + - Model `Key` added property `properties` + - Model `Key` added property `system_data` + - Model `MHSMPrivateEndpointConnectionItem` added property `properties` + - Model `ManagedHsmKey` added property `properties` + - Model `ManagedHsmKey` added property `system_data` + - Model `Operation` added property `operation_properties` + - Model `Permissions` added property `keys_property` + - Model `PrivateEndpointConnection` added property `system_data` + - Model `PrivateEndpointConnectionItem` added property `properties` + - Model `PrivateLinkResource` added property `system_data` + - Model `Secret` added property `system_data` + - Model `VaultCheckNameAvailabilityParameters` added property `type` + - Added model `ArmResource` + - Added model `CloudError` + - Added enum `CreatedByType` + - Added model `OperationProperties` + - Added model `ProxyResource` + - Added model `TrackedResource` + +### Breaking Changes + + - Model `Key` deleted or renamed its instance variable `attributes` + - Model `Key` deleted or renamed its instance variable `kty` + - Model `Key` deleted or renamed its instance variable `key_ops` + - Model `Key` deleted or renamed its instance variable `key_size` + - Model `Key` deleted or renamed its instance variable `curve_name` + - Model `Key` deleted or renamed its instance variable `key_uri` + - Model `Key` deleted or renamed its instance variable `key_uri_with_version` + - Model `Key` deleted or renamed its instance variable `rotation_policy` + - Model `Key` deleted or renamed its instance variable `release_policy` + - Model `MHSMPrivateEndpointConnectionItem` deleted or renamed its instance variable `private_endpoint` + - Model `MHSMPrivateEndpointConnectionItem` deleted or renamed its instance variable `private_link_service_connection_state` + - Model `MHSMPrivateEndpointConnectionItem` deleted or renamed its instance variable `provisioning_state` + - Model `ManagedHsmKey` deleted or renamed its instance variable `attributes` + - Model `ManagedHsmKey` deleted or renamed its instance variable `kty` + - Model `ManagedHsmKey` deleted or renamed its instance variable `key_ops` + - Model `ManagedHsmKey` deleted or renamed its instance variable `key_size` + - Model `ManagedHsmKey` deleted or renamed its instance variable `curve_name` + - Model `ManagedHsmKey` deleted or renamed its instance variable `key_uri` + - Model `ManagedHsmKey` deleted or renamed its instance variable `key_uri_with_version` + - Model `ManagedHsmKey` deleted or renamed its instance variable `rotation_policy` + - Model `ManagedHsmKey` deleted or renamed its instance variable `release_policy` + - Model `Operation` deleted or renamed its instance variable `service_specification` + - Model `Permissions` deleted or renamed its instance variable `keys` + - Model `PrivateEndpointConnectionItem` deleted or renamed its instance variable `private_endpoint` + - Model `PrivateEndpointConnectionItem` deleted or renamed its instance variable `private_link_service_connection_state` + - Model `PrivateEndpointConnectionItem` deleted or renamed its instance variable `provisioning_state` + - Deleted or renamed model `IdentityType` + - Deleted or renamed model `ProxyResourceWithoutSystemData` + - Deleted or renamed model `Resource` + ## 13.0.0 (2025-10-21) ### Features Added diff --git a/sdk/keyvault/azure-mgmt-keyvault/_metadata.json b/sdk/keyvault/azure-mgmt-keyvault/_metadata.json index e9576815df8c..0421cd9bfb33 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/_metadata.json +++ b/sdk/keyvault/azure-mgmt-keyvault/_metadata.json @@ -1,7 +1,7 @@ { "apiVersion": "2025-05-01", - "commit": "0476e10d463909ce48ba4a8365d971586ede7f98", + "commit": "08a510e768ebd24b415dd642416cf955b70c4069", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "typespec_src": "specification/keyvault/KeyVault.Management", - "emitterVersion": "0.52.1" + "emitterVersion": "0.52.2" } \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py index bec1c3d07251..583fd65a5277 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py @@ -187,7 +187,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -265,7 +268,10 @@ async def get(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -334,7 +340,10 @@ async def _create_or_update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -662,7 +671,10 @@ async def update( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -723,7 +735,10 @@ async def delete(self, resource_group_name: str, vault_name: str, **kwargs: Any) if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -816,7 +831,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -903,7 +921,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1084,7 +1105,10 @@ async def update_access_policy( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -1125,6 +1149,7 @@ async def get_deleted(self, vault_name: str, location: str, **kwargs: Any) -> _m _request = build_vaults_get_deleted_request( vault_name=vault_name, location=location, + api_version=self._config.api_version, headers=_headers, params=_params, ) @@ -1147,7 +1172,10 @@ async def get_deleted(self, vault_name: str, location: str, **kwargs: Any) -> _m except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -1177,6 +1205,7 @@ async def _purge_deleted_initial(self, vault_name: str, location: str, **kwargs: _request = build_vaults_purge_deleted_request( vault_name=vault_name, location=location, + api_version=self._config.api_version, headers=_headers, params=_params, ) @@ -1198,7 +1227,10 @@ async def _purge_deleted_initial(self, vault_name: str, location: str, **kwargs: except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1346,7 +1378,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1407,7 +1442,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) @@ -1438,7 +1473,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1563,7 +1601,10 @@ async def check_name_availability( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -1654,7 +1695,10 @@ async def get( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -1843,7 +1887,10 @@ async def put( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1905,7 +1952,10 @@ async def _delete_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -2078,7 +2128,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -2156,7 +2209,10 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optio except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ManagedHsmError, response) + error = _failsafe_deserialize( + _models.ManagedHsmError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -2223,7 +2279,10 @@ async def _create_or_update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ManagedHsmError, response) + error = _failsafe_deserialize( + _models.ManagedHsmError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -2445,7 +2504,10 @@ async def _update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ManagedHsmError, response) + error = _failsafe_deserialize( + _models.ManagedHsmError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -2655,7 +2717,10 @@ async def _delete_initial(self, resource_group_name: str, name: str, **kwargs: A except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ManagedHsmError, response) + error = _failsafe_deserialize( + _models.ManagedHsmError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -2814,7 +2879,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ManagedHsmError, response) + error = _failsafe_deserialize( + _models.ManagedHsmError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -2902,7 +2970,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ManagedHsmError, response) + error = _failsafe_deserialize( + _models.ManagedHsmError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -2937,6 +3008,7 @@ async def get_deleted(self, name: str, location: str, **kwargs: Any) -> _models. _request = build_managed_hsms_get_deleted_request( name=name, location=location, + api_version=self._config.api_version, headers=_headers, params=_params, ) @@ -2959,7 +3031,10 @@ async def get_deleted(self, name: str, location: str, **kwargs: Any) -> _models. except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ManagedHsmError, response) + error = _failsafe_deserialize( + _models.ManagedHsmError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -2989,6 +3064,7 @@ async def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) _request = build_managed_hsms_purge_deleted_request( name=name, location=location, + api_version=self._config.api_version, headers=_headers, params=_params, ) @@ -3010,7 +3086,10 @@ async def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ManagedHsmError, response) + error = _failsafe_deserialize( + _models.ManagedHsmError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -3153,7 +3232,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ManagedHsmError, response) + error = _failsafe_deserialize( + _models.ManagedHsmError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -3278,7 +3360,10 @@ async def check_mhsm_name_availability( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -3366,7 +3451,10 @@ async def get(self, resource_group_name: str, vault_name: str, secret_name: str, except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -3554,7 +3642,10 @@ async def create_or_update( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -3745,7 +3836,10 @@ async def update( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -3849,7 +3943,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -3930,7 +4027,10 @@ async def get(self, resource_group_name: str, vault_name: str, key_name: str, ** except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -4117,7 +4217,10 @@ async def create_if_not_exist( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -4214,7 +4317,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -4283,7 +4389,10 @@ async def get_version( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -4386,7 +4495,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -4469,7 +4581,10 @@ async def get(self, resource_group_name: str, name: str, key_name: str, **kwargs except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -4665,7 +4780,10 @@ async def create_if_not_exist( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -4762,7 +4880,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -4832,7 +4953,10 @@ async def get_version( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -4936,7 +5060,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -5017,7 +5144,10 @@ async def list_by_vault( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -5104,7 +5234,10 @@ async def list_by_mhsm_resource( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -5222,7 +5355,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ManagedHsmError, response) + error = _failsafe_deserialize( + _models.ManagedHsmError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -5307,7 +5443,10 @@ async def get( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ManagedHsmError, response) + error = _failsafe_deserialize( + _models.ManagedHsmError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -5495,7 +5634,10 @@ async def put( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -5557,7 +5699,10 @@ async def _delete_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -5730,7 +5875,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ManagedHsmError, response) + error = _failsafe_deserialize( + _models.ManagedHsmError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py index 4565f5ab373d..8b26405fc2b2 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py @@ -272,7 +272,9 @@ def build_vaults_update_access_policy_request( # pylint: disable=name-too-long def build_vaults_get_deleted_request(vault_name: str, location: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -284,13 +286,19 @@ def build_vaults_get_deleted_request(vault_name: str, location: str, **kwargs: A _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_vaults_purge_deleted_request(vault_name: str, location: str, **kwargs: Any) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) # Construct URL _url = "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge" path_format_arguments = { @@ -300,7 +308,10 @@ def build_vaults_purge_deleted_request(vault_name: str, location: str, **kwargs: _url: str = _url.format(**path_format_arguments) # type: ignore - return HttpRequest(method="POST", url=_url, **kwargs) + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) def build_vaults_list_deleted_request(subscription_id: str, **kwargs: Any) -> HttpRequest: @@ -331,8 +342,10 @@ def build_vaults_list_request(subscription_id: str, *, top: Optional[int] = None _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop("filter") - api_version: Literal["2015-11-01"] = kwargs.pop("api_version") + filter: Literal["resourceType eq 'Microsoft.KeyVault/vaults'"] = kwargs.pop( + "filter", _params.pop("$filter", "resourceType eq 'Microsoft.KeyVault/vaults'") + ) + api_version: Literal["2015-11-01"] = kwargs.pop("api_version", _params.pop("api-version", "2015-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -691,7 +704,9 @@ def build_managed_hsms_list_by_subscription_request( # pylint: disable=name-too def build_managed_hsms_get_deleted_request(name: str, location: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -703,13 +718,19 @@ def build_managed_hsms_get_deleted_request(name: str, location: str, **kwargs: A _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_managed_hsms_purge_deleted_request(name: str, location: str, **kwargs: Any) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) # Construct URL _url = "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}/purge" path_format_arguments = { @@ -719,7 +740,10 @@ def build_managed_hsms_purge_deleted_request(name: str, location: str, **kwargs: _url: str = _url.format(**path_format_arguments) # type: ignore - return HttpRequest(method="POST", url=_url, **kwargs) + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) def build_managed_hsms_list_deleted_request(subscription_id: str, **kwargs: Any) -> HttpRequest: @@ -1495,7 +1519,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1573,7 +1600,10 @@ def get(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> _mode except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -1642,7 +1672,10 @@ def _create_or_update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1970,7 +2003,10 @@ def update( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -2033,7 +2069,10 @@ def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -2126,7 +2165,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -2213,7 +2255,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -2394,7 +2439,10 @@ def update_access_policy( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -2435,6 +2483,7 @@ def get_deleted(self, vault_name: str, location: str, **kwargs: Any) -> _models. _request = build_vaults_get_deleted_request( vault_name=vault_name, location=location, + api_version=self._config.api_version, headers=_headers, params=_params, ) @@ -2457,7 +2506,10 @@ def get_deleted(self, vault_name: str, location: str, **kwargs: Any) -> _models. except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -2487,6 +2539,7 @@ def _purge_deleted_initial(self, vault_name: str, location: str, **kwargs: Any) _request = build_vaults_purge_deleted_request( vault_name=vault_name, location=location, + api_version=self._config.api_version, headers=_headers, params=_params, ) @@ -2508,7 +2561,10 @@ def _purge_deleted_initial(self, vault_name: str, location: str, **kwargs: Any) except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -2656,7 +2712,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -2717,7 +2776,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) @@ -2748,7 +2807,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -2873,7 +2935,10 @@ def check_name_availability( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -2964,7 +3029,10 @@ def get( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -3153,7 +3221,10 @@ def put( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -3215,7 +3286,10 @@ def _delete_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -3386,7 +3460,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -3464,7 +3541,10 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> Optional[_m except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ManagedHsmError, response) + error = _failsafe_deserialize( + _models.ManagedHsmError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -3531,7 +3611,10 @@ def _create_or_update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ManagedHsmError, response) + error = _failsafe_deserialize( + _models.ManagedHsmError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -3753,7 +3836,10 @@ def _update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ManagedHsmError, response) + error = _failsafe_deserialize( + _models.ManagedHsmError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -3963,7 +4049,10 @@ def _delete_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ManagedHsmError, response) + error = _failsafe_deserialize( + _models.ManagedHsmError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -4122,7 +4211,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ManagedHsmError, response) + error = _failsafe_deserialize( + _models.ManagedHsmError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -4210,7 +4302,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ManagedHsmError, response) + error = _failsafe_deserialize( + _models.ManagedHsmError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -4245,6 +4340,7 @@ def get_deleted(self, name: str, location: str, **kwargs: Any) -> _models.Delete _request = build_managed_hsms_get_deleted_request( name=name, location=location, + api_version=self._config.api_version, headers=_headers, params=_params, ) @@ -4267,7 +4363,10 @@ def get_deleted(self, name: str, location: str, **kwargs: Any) -> _models.Delete except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ManagedHsmError, response) + error = _failsafe_deserialize( + _models.ManagedHsmError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -4297,6 +4396,7 @@ def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) -> Ite _request = build_managed_hsms_purge_deleted_request( name=name, location=location, + api_version=self._config.api_version, headers=_headers, params=_params, ) @@ -4318,7 +4418,10 @@ def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) -> Ite except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ManagedHsmError, response) + error = _failsafe_deserialize( + _models.ManagedHsmError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -4461,7 +4564,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ManagedHsmError, response) + error = _failsafe_deserialize( + _models.ManagedHsmError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -4586,7 +4692,10 @@ def check_mhsm_name_availability( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -4674,7 +4783,10 @@ def get(self, resource_group_name: str, vault_name: str, secret_name: str, **kwa except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -4862,7 +4974,10 @@ def create_or_update( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -5053,7 +5168,10 @@ def update( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -5157,7 +5275,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -5238,7 +5359,10 @@ def get(self, resource_group_name: str, vault_name: str, key_name: str, **kwargs except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -5425,7 +5549,10 @@ def create_if_not_exist( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -5522,7 +5649,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -5591,7 +5721,10 @@ def get_version( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -5694,7 +5827,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -5777,7 +5913,10 @@ def get(self, resource_group_name: str, name: str, key_name: str, **kwargs: Any) except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -5973,7 +6112,10 @@ def create_if_not_exist( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -6070,7 +6212,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -6140,7 +6285,10 @@ def get_version( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -6244,7 +6392,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -6325,7 +6476,10 @@ def list_by_vault( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -6412,7 +6566,10 @@ def list_by_mhsm_resource( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -6529,7 +6686,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ManagedHsmError, response) + error = _failsafe_deserialize( + _models.ManagedHsmError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -6614,7 +6774,10 @@ def get( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ManagedHsmError, response) + error = _failsafe_deserialize( + _models.ManagedHsmError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -6802,7 +6965,10 @@ def put( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -6864,7 +7030,10 @@ def _delete_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.CloudError, response) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -7036,7 +7205,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ManagedHsmError, response) + error = _failsafe_deserialize( + _models.ManagedHsmError, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_async_test.py b/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_async_test.py index e5970132e70a..cafaac22a35b 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_async_test.py +++ b/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_async_test.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_test.py b/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_test.py index 5d32b11c1246..1be04185f326 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_test.py +++ b/sdk/keyvault/azure-mgmt-keyvault/tests/test_key_vault_management_vaults_operations_test.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/keyvault/azure-mgmt-keyvault/tsp-location.yaml b/sdk/keyvault/azure-mgmt-keyvault/tsp-location.yaml index 6c9972e5468f..c528e8d3103f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/tsp-location.yaml +++ b/sdk/keyvault/azure-mgmt-keyvault/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/keyvault/KeyVault.Management -commit: 0476e10d463909ce48ba4a8365d971586ede7f98 +commit: 08a510e768ebd24b415dd642416cf955b70c4069 repo: Azure/azure-rest-api-specs additionalDirectories: From b577be0e534def32448cd946c26e9901000b5d94 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Wed, 29 Oct 2025 16:05:25 +0800 Subject: [PATCH 13/34] add customized code back after regeneration --- sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md | 58 ------------------- .../keyvault/aio/operations/_operations.py | 2 +- .../mgmt/keyvault/operations/_operations.py | 2 +- 3 files changed, 2 insertions(+), 60 deletions(-) diff --git a/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md b/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md index 461d72194d90..004cb6998d05 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md +++ b/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md @@ -1,63 +1,5 @@ # Release History -## 13.0.0 (2025-10-29) - -### Features Added - - - Client `KeyVaultManagementClient` added method `send_request` - - Model `DeletedManagedHsm` added property `system_data` - - Model `DeletedVault` added property `system_data` - - Model `Key` added property `properties` - - Model `Key` added property `system_data` - - Model `MHSMPrivateEndpointConnectionItem` added property `properties` - - Model `ManagedHsmKey` added property `properties` - - Model `ManagedHsmKey` added property `system_data` - - Model `Operation` added property `operation_properties` - - Model `Permissions` added property `keys_property` - - Model `PrivateEndpointConnection` added property `system_data` - - Model `PrivateEndpointConnectionItem` added property `properties` - - Model `PrivateLinkResource` added property `system_data` - - Model `Secret` added property `system_data` - - Model `VaultCheckNameAvailabilityParameters` added property `type` - - Added model `ArmResource` - - Added model `CloudError` - - Added enum `CreatedByType` - - Added model `OperationProperties` - - Added model `ProxyResource` - - Added model `TrackedResource` - -### Breaking Changes - - - Model `Key` deleted or renamed its instance variable `attributes` - - Model `Key` deleted or renamed its instance variable `kty` - - Model `Key` deleted or renamed its instance variable `key_ops` - - Model `Key` deleted or renamed its instance variable `key_size` - - Model `Key` deleted or renamed its instance variable `curve_name` - - Model `Key` deleted or renamed its instance variable `key_uri` - - Model `Key` deleted or renamed its instance variable `key_uri_with_version` - - Model `Key` deleted or renamed its instance variable `rotation_policy` - - Model `Key` deleted or renamed its instance variable `release_policy` - - Model `MHSMPrivateEndpointConnectionItem` deleted or renamed its instance variable `private_endpoint` - - Model `MHSMPrivateEndpointConnectionItem` deleted or renamed its instance variable `private_link_service_connection_state` - - Model `MHSMPrivateEndpointConnectionItem` deleted or renamed its instance variable `provisioning_state` - - Model `ManagedHsmKey` deleted or renamed its instance variable `attributes` - - Model `ManagedHsmKey` deleted or renamed its instance variable `kty` - - Model `ManagedHsmKey` deleted or renamed its instance variable `key_ops` - - Model `ManagedHsmKey` deleted or renamed its instance variable `key_size` - - Model `ManagedHsmKey` deleted or renamed its instance variable `curve_name` - - Model `ManagedHsmKey` deleted or renamed its instance variable `key_uri` - - Model `ManagedHsmKey` deleted or renamed its instance variable `key_uri_with_version` - - Model `ManagedHsmKey` deleted or renamed its instance variable `rotation_policy` - - Model `ManagedHsmKey` deleted or renamed its instance variable `release_policy` - - Model `Operation` deleted or renamed its instance variable `service_specification` - - Model `Permissions` deleted or renamed its instance variable `keys` - - Model `PrivateEndpointConnectionItem` deleted or renamed its instance variable `private_endpoint` - - Model `PrivateEndpointConnectionItem` deleted or renamed its instance variable `private_link_service_connection_state` - - Model `PrivateEndpointConnectionItem` deleted or renamed its instance variable `provisioning_state` - - Deleted or renamed model `IdentityType` - - Deleted or renamed model `ProxyResourceWithoutSystemData` - - Deleted or renamed model `Resource` - ## 13.0.0 (2025-10-21) ### Features Added diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py index 583fd65a5277..c2bce556aa59 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py @@ -1442,7 +1442,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._config.api_version + _next_request_params["api-version"] = api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py index 8b26405fc2b2..4aa33382cbd9 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py @@ -2776,7 +2776,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._config.api_version + _next_request_params["api-version"] = api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) From 17315e4cb6e99bad63725e9aa37fef75eafacedf Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Tue, 11 Nov 2025 13:22:44 +0800 Subject: [PATCH 14/34] Update CHANGELOG.md --- sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md b/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md index 004cb6998d05..037b97b2987f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md +++ b/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md @@ -33,7 +33,6 @@ - Model `Operation` instance variable `service_specification` has been moved under property `operation_properties` - Model `Permissions` renamed instance variable `keys` to `keys_property` - Model `PrivateEndpointConnectionItem` instance variables `private_endpoint`, `private_link_service_connection_state`, and `provisioning_state` have been moved under property `properties` - - Deleted or renamed model `IdentityType` - Deleted or renamed model `ProxyResourceWithoutSystemData` - Deleted or renamed model `Resource` From 79b61c55bf429b21ca9b7161d4d0ad96152ed048 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Thu, 13 Nov 2025 17:41:30 +0800 Subject: [PATCH 15/34] regeneration --- .../azure-mgmt-keyvault/_metadata.json | 6 +-- .../keyvault/aio/operations/_operations.py | 6 ++- .../azure/mgmt/keyvault/models/_models.py | 2 +- .../mgmt/keyvault/operations/_operations.py | 26 +++++++++--- .../azure-mgmt-keyvault/pyproject.toml | 41 ++++++++----------- 5 files changed, 45 insertions(+), 36 deletions(-) diff --git a/sdk/keyvault/azure-mgmt-keyvault/_metadata.json b/sdk/keyvault/azure-mgmt-keyvault/_metadata.json index 0421cd9bfb33..62fce0541477 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/_metadata.json +++ b/sdk/keyvault/azure-mgmt-keyvault/_metadata.json @@ -1,7 +1,3 @@ { - "apiVersion": "2025-05-01", - "commit": "08a510e768ebd24b415dd642416cf955b70c4069", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "typespec_src": "specification/keyvault/KeyVault.Management", - "emitterVersion": "0.52.2" + "apiVersion": "2025-05-01" } \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py index c2bce556aa59..228d48f013ac 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py @@ -1149,6 +1149,7 @@ async def get_deleted(self, vault_name: str, location: str, **kwargs: Any) -> _m _request = build_vaults_get_deleted_request( vault_name=vault_name, location=location, + subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -1205,6 +1206,7 @@ async def _purge_deleted_initial(self, vault_name: str, location: str, **kwargs: _request = build_vaults_purge_deleted_request( vault_name=vault_name, location=location, + subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -1442,7 +1444,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) @@ -3008,6 +3010,7 @@ async def get_deleted(self, name: str, location: str, **kwargs: Any) -> _models. _request = build_managed_hsms_get_deleted_request( name=name, location=location, + subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -3064,6 +3067,7 @@ async def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) _request = build_managed_hsms_purge_deleted_request( name=name, location=location, + subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, params=_params, diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_models.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_models.py index ea4d57d105bd..9e77545fd692 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_models.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_models.py @@ -2662,7 +2662,7 @@ def __setattr__(self, key: str, value: Any) -> None: if key in self.__flattened_items: if self.operation_properties is None: self.operation_properties = self._attr_to_rest_field["operation_properties"]._class_type() - setattr(self.properties, key, value) + setattr(self.operation_properties, key, value) else: super().__setattr__(key, value) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py index 4aa33382cbd9..0fddf0b1f1a0 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py @@ -270,7 +270,9 @@ def build_vaults_update_access_policy_request( # pylint: disable=name-too-long return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_vaults_get_deleted_request(vault_name: str, location: str, **kwargs: Any) -> HttpRequest: +def build_vaults_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 {}) @@ -282,6 +284,7 @@ def build_vaults_get_deleted_request(vault_name: str, location: str, **kwargs: A 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: str = _url.format(**path_format_arguments) # type: ignore @@ -295,7 +298,9 @@ def build_vaults_get_deleted_request(vault_name: str, location: str, **kwargs: A return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_vaults_purge_deleted_request(vault_name: str, location: str, **kwargs: Any) -> HttpRequest: +def build_vaults_purge_deleted_request( + vault_name: str, location: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) @@ -304,6 +309,7 @@ def build_vaults_purge_deleted_request(vault_name: str, location: str, **kwargs: 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: str = _url.format(**path_format_arguments) # type: ignore @@ -702,7 +708,9 @@ def build_managed_hsms_list_by_subscription_request( # pylint: disable=name-too return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_managed_hsms_get_deleted_request(name: str, location: str, **kwargs: Any) -> HttpRequest: +def build_managed_hsms_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 {}) @@ -714,6 +722,7 @@ def build_managed_hsms_get_deleted_request(name: str, location: str, **kwargs: A path_format_arguments = { "name": _SERIALIZER.url("name", name, "str"), "location": _SERIALIZER.url("location", location, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -727,7 +736,9 @@ def build_managed_hsms_get_deleted_request(name: str, location: str, **kwargs: A return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_managed_hsms_purge_deleted_request(name: str, location: str, **kwargs: Any) -> HttpRequest: +def build_managed_hsms_purge_deleted_request( + name: str, location: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) @@ -736,6 +747,7 @@ def build_managed_hsms_purge_deleted_request(name: str, location: str, **kwargs: path_format_arguments = { "name": _SERIALIZER.url("name", name, "str"), "location": _SERIALIZER.url("location", location, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2483,6 +2495,7 @@ def get_deleted(self, vault_name: str, location: str, **kwargs: Any) -> _models. _request = build_vaults_get_deleted_request( vault_name=vault_name, location=location, + subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -2539,6 +2552,7 @@ def _purge_deleted_initial(self, vault_name: str, location: str, **kwargs: Any) _request = build_vaults_purge_deleted_request( vault_name=vault_name, location=location, + subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -2776,7 +2790,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) @@ -4340,6 +4354,7 @@ def get_deleted(self, name: str, location: str, **kwargs: Any) -> _models.Delete _request = build_managed_hsms_get_deleted_request( name=name, location=location, + subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, params=_params, @@ -4396,6 +4411,7 @@ def _purge_deleted_initial(self, name: str, location: str, **kwargs: Any) -> Ite _request = build_managed_hsms_purge_deleted_request( name=name, location=location, + subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, params=_params, diff --git a/sdk/keyvault/azure-mgmt-keyvault/pyproject.toml b/sdk/keyvault/azure-mgmt-keyvault/pyproject.toml index 53df278bd915..334c1722206b 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/pyproject.toml +++ b/sdk/keyvault/azure-mgmt-keyvault/pyproject.toml @@ -1,19 +1,23 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + [build-system] -requires = [ - "setuptools>=77.0.3", - "wheel", -] +requires = ["setuptools>=77.0.3", "wheel"] build-backend = "setuptools.build_meta" [project] name = "azure-mgmt-keyvault" authors = [ - { name = "Microsoft Corporation", email = "azpysdkhelp@microsoft.com" }, + { name = "Microsoft Corporation", email = "azpysdkhelp@microsoft.com" }, ] description = "Microsoft Azure Keyvault Management Client Library for Python" license = "MIT" classifiers = [ - "Development Status :: 5 - Production/Stable", + "Development Status :: 4 - Beta", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", @@ -24,32 +28,23 @@ classifiers = [ "Programming Language :: Python :: 3.13", ] requires-python = ">=3.9" -keywords = [ - "azure", - "azure sdk", -] +keywords = ["azure", "azure sdk"] + dependencies = [ "isodate>=0.6.1", "azure-mgmt-core>=1.6.0", "typing-extensions>=4.6.0", ] dynamic = [ - "version", - "readme", +"version", "readme" ] [project.urls] repository = "https://github.com/Azure/azure-sdk-for-python" -[tool.setuptools.dynamic.version] -attr = "azure.mgmt.keyvault._version.VERSION" - -[tool.setuptools.dynamic.readme] -file = [ - "README.md", - "CHANGELOG.md", -] -content-type = "text/markdown" +[tool.setuptools.dynamic] +version = {attr = "azure.mgmt.keyvault._version.VERSION"} +readme = {file = ["README.md", "CHANGELOG.md"], content-type = "text/markdown"} [tool.setuptools.packages.find] exclude = [ @@ -63,9 +58,7 @@ exclude = [ ] [tool.setuptools.package-data] -pytyped = [ - "py.typed", -] +pytyped = ["py.typed"] [tool.azure-sdk-build] breaking = false From 5cf56be9ab977a68a8de65a133aad8a5005e637b Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Thu, 13 Nov 2025 17:45:09 +0800 Subject: [PATCH 16/34] customize --- .../azure/mgmt/keyvault/aio/operations/_operations.py | 2 +- .../azure/mgmt/keyvault/operations/_operations.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py index 228d48f013ac..323fc38551c9 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py @@ -1444,7 +1444,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._config.api_version + _next_request_params["api-version"] = api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py index 0fddf0b1f1a0..5698377f14e5 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py @@ -2790,7 +2790,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._config.api_version + _next_request_params["api-version"] = api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) From 57b83f63b41d0130953de2166e24d9d5c0540a64 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 17 Nov 2025 16:06:58 -0500 Subject: [PATCH 17/34] add tests and fix backcompat functions --- .../azure-core/azure/core/serialization.py | 84 +++- .../modeltypes/_utils/model_base.py | 19 + .../azure-core/tests/test_serialization.py | 472 ++++++++++++++++++ 3 files changed, 562 insertions(+), 13 deletions(-) diff --git a/sdk/core/azure-core/azure/core/serialization.py b/sdk/core/azure-core/azure/core/serialization.py index df6db58319e0..ea312929739c 100644 --- a/sdk/core/azure-core/azure/core/serialization.py +++ b/sdk/core/azure-core/azure/core/serialization.py @@ -331,6 +331,17 @@ def _as_attribute_dict_value(v: Any, *, exclude_readonly: bool = False) -> Any: return {dk: _as_attribute_dict_value(dv, exclude_readonly=exclude_readonly) for dk, dv in v.items()} return as_attribute_dict(v, exclude_readonly=exclude_readonly) if is_generated_model(v) else v +def _get_backcompat_attr_to_rest_field(obj: Any) -> Dict[str, Any]: + """Get the backcompat attribute to rest field mapping for a generated TypeSpec model. + + :param any obj: The object to get the mapping from. + :return: The backcompat attribute to rest field mapping. + :rtype: Dict[str, Any] + """ + try: + return obj._backcompat_attr_to_rest_field # pylint: disable=protected-access + except AttributeError: + return obj._attr_to_rest_field # pylint: disable=protected-access def _get_flattened_attribute(obj: Any) -> Optional[str]: """Get the name of the flattened attribute in a generated TypeSpec model if one exists. @@ -348,11 +359,18 @@ def _get_flattened_attribute(obj: Any) -> Optional[str]: if flattened_items is None: return None - for k, v in obj._attr_to_rest_field.items(): # pylint: disable=protected-access + flattened_items_set = set(flattened_items) + for k, v in _get_backcompat_attr_to_rest_field(obj).items(): # pylint: disable=protected-access try: - if set(v._class_type._attr_to_rest_field.keys()).intersection( # pylint: disable=protected-access - set(flattened_items) - ): + # Check if this property contains a nested model + if not hasattr(v, '_class_type'): + continue + + # Get backcompat names from the nested model + nested_backcompat_names = set(_get_backcompat_attr_to_rest_field(v._class_type).keys()) # pylint: disable=protected-access + + # If any flattened items match the backcompat names in the nested model, this is our flattened attribute + if flattened_items_set.intersection(nested_backcompat_names): return k except AttributeError: # if the attribute does not have _class_type, it is not a typespec generated model @@ -375,9 +393,15 @@ def attribute_list(obj: Any) -> List[str]: return list(obj._attribute_map.keys()) # pylint: disable=protected-access flattened_attribute = _get_flattened_attribute(obj) retval: List[str] = [] - for attr_name, rest_field in obj._attr_to_rest_field.items(): # pylint: disable=protected-access + for attr_name, rest_field in _get_backcompat_attr_to_rest_field(obj).items(): # pylint: disable=protected-access if flattened_attribute == attr_name: - retval.extend(attribute_list(rest_field._class_type)) # pylint: disable=protected-access + # For flattened attributes, return the flattened item names from __flattened_items + try: + flattened_items = getattr(obj, next(a for a in dir(obj) if "__flattened_items" in a), None) + if flattened_items: + retval.extend(flattened_items) + except StopIteration: + pass else: retval.append(attr_name) return retval @@ -410,28 +434,62 @@ def as_attribute_dict(obj: Any, *, exclude_readonly: bool = False) -> Dict[str, # create a reverse mapping from rest field name to attribute name rest_to_attr = {} flattened_attribute = _get_flattened_attribute(obj) - for attr_name, rest_field in obj._attr_to_rest_field.items(): # pylint: disable=protected-access + flattened_items = None + flattened_actual_attr = None # Store the actual attribute name for the flattened attribute + if flattened_attribute: + try: + flattened_items = getattr(obj, next(a for a in dir(obj) if "__flattened_items" in a), None) + # Find the actual attribute name that corresponds to the flattened attribute + # flattened_attribute could be either an actual attr name or a backcompat name + # We need to find the actual attr name that appears in obj.items() + for actual_attr_name, rest_field in obj._attr_to_rest_field.items(): # pylint: disable=protected-access + # Get the backcompat name for this attribute + original_tsp_name = getattr(rest_field, "_original_tsp_name", None) + backcompat_name = original_tsp_name if original_tsp_name else actual_attr_name + + if backcompat_name == flattened_attribute: + flattened_actual_attr = actual_attr_name + break + except StopIteration: + pass + + for attr_name, rest_field in _get_backcompat_attr_to_rest_field(obj).items(): # pylint: disable=protected-access if exclude_readonly and _is_readonly(rest_field): # if we're excluding readonly properties, we need to track them readonly_props.add(rest_field._rest_name) # pylint: disable=protected-access if flattened_attribute == attr_name: - for fk, fv in rest_field._class_type._attr_to_rest_field.items(): # pylint: disable=protected-access - rest_to_attr[fv._rest_name] = fk # pylint: disable=protected-access + # For flattened attributes, map flattened item names directly to their nested field names + nested_backcompat_map = _get_backcompat_attr_to_rest_field(rest_field._class_type) # pylint: disable=protected-access + for flattened_name in flattened_items or []: + if flattened_name in nested_backcompat_map: + nested_field = nested_backcompat_map[flattened_name] + rest_to_attr[nested_field._rest_name] = flattened_name # pylint: disable=protected-access else: rest_to_attr[rest_field._rest_name] = attr_name # pylint: disable=protected-access + for k, v in obj.items(): if exclude_readonly and k in readonly_props: # pyright: ignore continue - if k == flattened_attribute: - for fk, fv in v.items(): - result[rest_to_attr.get(fk, fk)] = _as_attribute_dict_value(fv, exclude_readonly=exclude_readonly) + if k == flattened_actual_attr: + # For flattened attributes, extract values from nested model using backcompat names + if hasattr(v, 'items'): + for fk, fv in v.items(): + mapped_name = rest_to_attr.get(fk, fk) + if mapped_name in (flattened_items or []): + # Check if this flattened item should be excluded due to readonly + nested_backcompat_map = _get_backcompat_attr_to_rest_field(getattr(obj._attr_to_rest_field[flattened_actual_attr], '_class_type')) # pylint: disable=protected-access + if mapped_name in nested_backcompat_map: + nested_field = nested_backcompat_map[mapped_name] + if exclude_readonly and _is_readonly(nested_field): + continue + result[mapped_name] = _as_attribute_dict_value(fv, exclude_readonly=exclude_readonly) else: is_multipart_file_input = False try: is_multipart_file_input = next( # pylint: disable=protected-access rf - for rf in obj._attr_to_rest_field.values() # pylint: disable=protected-access + for rf in _get_backcompat_attr_to_rest_field(obj).values() # pylint: disable=protected-access if rf._rest_name == k # pylint: disable=protected-access )._is_multipart_file_input except StopIteration: diff --git a/sdk/core/azure-core/tests/specs_sdk/modeltypes/modeltypes/_utils/model_base.py b/sdk/core/azure-core/tests/specs_sdk/modeltypes/modeltypes/_utils/model_base.py index e46c56097a8c..9172543a2791 100644 --- a/sdk/core/azure-core/tests/specs_sdk/modeltypes/modeltypes/_utils/model_base.py +++ b/sdk/core/azure-core/tests/specs_sdk/modeltypes/modeltypes/_utils/model_base.py @@ -654,6 +654,10 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: if not rf._rest_name_input: rf._rest_name_input = attr cls._attr_to_rest_field: typing.Dict[str, _RestField] = dict(attr_to_rest_field.items()) + cls._backcompat_attr_to_rest_field: typing.Dict[str, _RestField] = { + Model._get_backcompat_attribute_name(cls._attr_to_rest_field, attr): rf for attr, rf in cls + ._attr_to_rest_field.items() + } cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") return super().__new__(cls) @@ -663,6 +667,17 @@ def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: if hasattr(base, "__mapping__"): base.__mapping__[discriminator or cls.__name__] = cls # type: ignore + @classmethod + def _get_backcompat_attribute_name(cls, _attr_to_rest_field: typing.Dict[str, "_RestField"], attr_name: str) -> str: + rest_field = _attr_to_rest_field.get(attr_name) # pylint: disable=protected-access + if rest_field is None: + return attr_name + original_tsp_name = getattr(rest_field, "_original_tsp_name", None) # pylint: disable=protected-access + if original_tsp_name: + return original_tsp_name + return attr_name + + @classmethod def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: for v in cls.__dict__.values(): @@ -998,6 +1013,7 @@ def __init__( format: typing.Optional[str] = None, is_multipart_file_input: bool = False, xml: typing.Optional[typing.Dict[str, typing.Any]] = None, + original_tsp_name: typing.Optional[str] = None, ): self._type = type self._rest_name_input = name @@ -1009,6 +1025,7 @@ def __init__( self._format = format self._is_multipart_file_input = is_multipart_file_input self._xml = xml if xml is not None else {} + self._original_tsp_name = original_tsp_name @property def _class_type(self) -> typing.Any: @@ -1060,6 +1077,7 @@ def rest_field( format: typing.Optional[str] = None, is_multipart_file_input: bool = False, xml: typing.Optional[typing.Dict[str, typing.Any]] = None, + original_tsp_name: typing.Optional[str] = None, ) -> typing.Any: return _RestField( name=name, @@ -1069,6 +1087,7 @@ def rest_field( format=format, is_multipart_file_input=is_multipart_file_input, xml=xml, + original_tsp_name=original_tsp_name, ) diff --git a/sdk/core/azure-core/tests/test_serialization.py b/sdk/core/azure-core/tests/test_serialization.py index 094715c9d30f..3fb7d1a4c80e 100644 --- a/sdk/core/azure-core/tests/test_serialization.py +++ b/sdk/core/azure-core/tests/test_serialization.py @@ -1644,3 +1644,475 @@ def deserializer_b(cls, data: Dict[str, Any]) -> ModelB: deserialized_a = _deserialize(ModelA, json_dict_a) assert isinstance(deserialized_a, ModelA) assert deserialized_a.type == "A2" + + +class TestBackcompatPropertyMatrix: + """ + Systematic test matrix for DPG model property backcompat scenarios. + + Tests all combinations of 5 key dimensions: + 1. wireName: same/different from attr_name + 2. attr_name: normal/padded (reserved word) + 3. original_tsp_name: None/present (TSP name before padding) + 4. visibility: readonly/readwrite (affects exclude_readonly) + 5. structure: regular/nested/flattened models + + COMPLETE TEST MATRIX: + ┌───────┬─────────────┬──────────────┬─────────────────┬────────────┬──────────────┬─────────────────────────────┐ + │ Test │ Wire Name │ Attr Name │ Original TSP │ Visibility │ Structure │ Expected Behavior │ + ├───────┼─────────────┼──────────────┼─────────────────┼────────────┼──────────────┼─────────────────────────────┤ + │ 1a │ same │ normal │ None │ readwrite │ regular │ attr_name │ + │ 1b │ same │ normal │ None │ readonly │ regular │ attr_name (exclude test) │ + │ 2a │ different │ normal │ None │ readwrite │ regular │ attr_name │ + │ 2b │ different │ normal │ None │ readonly │ regular │ attr_name (exclude test) │ + │ 3a │ same │ padded │ present │ readwrite │ regular │ original_tsp_name │ + │ 3b │ same │ padded │ present │ readonly │ regular │ original_tsp_name (exclude) │ + │ 4a │ different │ padded │ present │ readwrite │ regular │ original_tsp_name │ + │ 4b │ different │ padded │ present │ readonly │ regular │ original_tsp_name (exclude) │ + │ 5a │ various │ mixed │ mixed │ mixed │ nested │ recursive backcompat │ + │ 6a │ same │ padded │ present │ readwrite │ flat-contain │ flattened + backcompat │ + │ 6b │ various │ mixed │ mixed │ mixed │ flat-props │ flattened props backcompat │ + │ 6c │ various │ mixed │ mixed │ readonly │ flat-mixed │ flattened + exclude │ + └───────┴─────────────┴──────────────┴─────────────────┴────────────┴──────────────┴─────────────────────────────┘ + """ + + # ========== DIMENSION 1-4 COMBINATIONS: REGULAR STRUCTURE ========== + + def test_1a_same_wire_normal_attr_no_original_readwrite_regular(self): + """Wire=attr, normal attr, no original, readwrite, regular model""" + + class RegularModel(HybridModel): + field_name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + + model = RegularModel(field_name="value") + + # Should use attr_name (same as wire name) + assert attribute_list(model) == ["field_name"] + assert as_attribute_dict(model) == {"field_name": "value"} + assert as_attribute_dict(model, exclude_readonly=True) == {"field_name": "value"} + + def test_1b_same_wire_normal_attr_no_original_readonly_regular(self): + """Wire=attr, normal attr, no original, readonly, regular model""" + + class ReadonlyModel(HybridModel): + field_name: str = rest_field(visibility=["read"]) + + model = ReadonlyModel(field_name="value") + + # Should use attr_name, but excluded when exclude_readonly=True + assert attribute_list(model) == ["field_name"] + assert as_attribute_dict(model) == {"field_name": "value"} + assert as_attribute_dict(model, exclude_readonly=True) == {} + + def test_2a_different_wire_normal_attr_no_original_readwrite_regular(self): + """Wire≠attr, normal attr, no original, readwrite, regular model""" + + class DifferentWireModel(HybridModel): + client_field: str = rest_field(name="wireField", visibility=["read", "create", "update", "delete", "query"]) + + model = DifferentWireModel(client_field="value") + + # Should use attr_name (wire name is different) + assert attribute_list(model) == ["client_field"] + assert as_attribute_dict(model) == {"client_field": "value"} + # Verify wire representation uses different name + assert dict(model) == {"wireField": "value"} + + def test_2b_different_wire_normal_attr_no_original_readonly_regular(self): + """Wire≠attr, normal attr, no original, readonly, regular model""" + + class ReadonlyDifferentWireModel(HybridModel): + client_field: str = rest_field(name="wireField", visibility=["read"]) + + model = ReadonlyDifferentWireModel(client_field="value") + + # Should use attr_name, excluded when exclude_readonly=True + assert attribute_list(model) == ["client_field"] + assert as_attribute_dict(model) == {"client_field": "value"} + assert as_attribute_dict(model, exclude_readonly=True) == {} + + def test_3a_same_wire_padded_attr_with_original_readwrite_regular(self): + """Wire=original, padded attr, original present, readwrite, regular model""" + + class PaddedModel(HybridModel): + keys_property: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + # Set original TSP name for backcompat + self._attr_to_rest_field['keys_property']._original_tsp_name = "keys" + # Create backcompat mapping + self._backcompat_attr_to_rest_field = { + "keys": self._attr_to_rest_field['keys_property'] + } + + model = PaddedModel(keys_property="value") + + # Should use original_tsp_name when available + assert attribute_list(model) == ["keys"] + assert as_attribute_dict(model) == {"keys": "value"} + + def test_3b_same_wire_padded_attr_with_original_readonly_regular(self): + """Wire=original, padded attr, original present, readonly, regular model""" + + class ReadonlyPaddedModel(HybridModel): + keys_property: str = rest_field(visibility=["read"], original_tsp_name="keys") + + model = ReadonlyPaddedModel(keys_property="value") + + # Should use original_tsp_name, excluded when exclude_readonly=True + assert attribute_list(model) == ["keys"] + assert as_attribute_dict(model) == {"keys": "value"} + assert as_attribute_dict(model, exclude_readonly=True) == {} + + def test_4a_different_wire_padded_attr_with_original_readwrite_regular(self): + """Wire≠original, padded attr, original present, readwrite, regular model""" + + class DifferentWirePaddedModel(HybridModel): + keys_property: str = rest_field(name="keysWire", original_tsp_name="keys") + + model = DifferentWirePaddedModel(keys_property="value") + + # Should use original_tsp_name + assert attribute_list(model) == ["keys"] + assert as_attribute_dict(model) == {"keys": "value"} + # Verify wire uses different name + assert dict(model) == {"keysWire": "value"} + + def test_4b_different_wire_padded_attr_with_original_readonly_regular(self): + """Wire≠original, padded attr, original present, readonly, regular model""" + + class ReadonlyDifferentWirePaddedModel(HybridModel): + keys_property: str = rest_field( + name="keysWire", + visibility=["read"], + original_tsp_name="keys" + ) + + model = ReadonlyDifferentWirePaddedModel(keys_property="value") + + # Should use original_tsp_name, excluded when exclude_readonly=True + assert attribute_list(model) == ["keys"] + assert as_attribute_dict(model) == {"keys": "value"} + assert as_attribute_dict(model, exclude_readonly=True) == {} + + # ========== DIMENSION 5: STRUCTURE VARIATIONS ========== + + def test_5a_nested_model_backcompat_recursive(self): + """Nested models with mixed backcompat scenarios""" + + class NestedBackcompatModel(HybridModel): + keys_property: str = rest_field(name="keysWire", original_tsp_name="keys") + normal_field: str = rest_field(name="normalWire") + + class ParentModel(HybridModel): + nested: NestedBackcompatModel = rest_field() + type_property: str = rest_field(original_tsp_name="type") + + nested_model = NestedBackcompatModel( + keys_property="nested_keys", + normal_field="nested_normal" + ) + parent_model = ParentModel(nested=nested_model, type_property="parent_type") + + # Test nested model independently + nested_attrs = attribute_list(nested_model) + assert set(nested_attrs) == {"keys", "normal_field"} + + nested_dict = as_attribute_dict(nested_model) + assert nested_dict == {"keys": "nested_keys", "normal_field": "nested_normal"} + + # Test parent model with recursive backcompat + parent_attrs = attribute_list(parent_model) + assert set(parent_attrs) == {"nested", "type"} + + parent_dict = as_attribute_dict(parent_model) + expected_parent = { + "nested": {"keys": "nested_keys", "normal_field": "nested_normal"}, + "type": "parent_type" + } + assert parent_dict == expected_parent + + def test_6a_flattened_container_with_backcompat(self): + """Flattened property where container has backcompat (keys_property → keys)""" + + # Helper model for flattening content + class ContentModel(HybridModel): + name: str = rest_field() + description: str = rest_field() + + class FlattenedContainerModel(HybridModel): + id: str = rest_field() + keys_property: ContentModel = rest_field(original_tsp_name="keys") + + __flattened_items = ["name", "description"] + + def __init__(self, *args, **kwargs): + _flattened = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened.items(): + setattr(self, k, v) + + def __getattr__(self, name: str): + if name in self.__flattened_items and self.keys_property is not None: + return getattr(self.keys_property, name) + raise AttributeError(f"No attribute '{name}'") + + def __setattr__(self, key: str, value): + if key in self.__flattened_items: + if self.keys_property is None: + self.keys_property = ContentModel() + setattr(self.keys_property, key, value) + else: + super().__setattr__(key, value) + + model = FlattenedContainerModel( + id="test_id", + name="flattened_name", + description="flattened_desc" + ) + + # Flattened items should appear at top level + attrs = attribute_list(model) + assert set(attrs) == {"id", "name", "description"} + + # Flattened dict should use top-level names + attr_dict = as_attribute_dict(model) + expected = {"id": "test_id", "name": "flattened_name", "description": "flattened_desc"} + assert attr_dict == expected + + def test_6b_flattened_properties_with_backcompat(self): + """Flattened properties themselves have backcompat (type_property → type)""" + + class BackcompatContentModel(HybridModel): + type_property: str = rest_field(name="typeWire", original_tsp_name="type") + class_property: str = rest_field(name="classWire", original_tsp_name="class") + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self._attr_to_rest_field['type_property']._original_tsp_name = "type" + self._attr_to_rest_field['class_property']._original_tsp_name = "class" + self._backcompat_attr_to_rest_field = { + "type": self._attr_to_rest_field['type_property'], + "class": self._attr_to_rest_field['class_property'] + } + + class FlattenedPropsBackcompatModel(HybridModel): + name: str = rest_field() + properties: BackcompatContentModel = rest_field() + + __flattened_items = ["type", "class"] # Use original names + + def __init__(self, *args, **kwargs): + _flattened = {} + for item in ["type", "class"]: + if item in kwargs: + _flattened[item] = kwargs.pop(item) + super().__init__(*args, **kwargs) + for k, v in _flattened.items(): + setattr(self, k, v) + + def __getattr__(self, name: str): + if name in self.__flattened_items and self.properties is not None: + attr_map = {"type": "type_property", "class": "class_property"} + return getattr(self.properties, attr_map[name]) + raise AttributeError(f"No attribute '{name}'") + + def __setattr__(self, key: str, value): + if key in self.__flattened_items: + if self.properties is None: + self.properties = BackcompatContentModel() + attr_map = {"type": "type_property", "class": "class_property"} + setattr(self.properties, attr_map[key], value) + else: + super().__setattr__(key, value) + + model = FlattenedPropsBackcompatModel( + name="test_name", + type="test_type", + **{"class": "test_class"} + ) + + # Should use original names for flattened properties + attrs = attribute_list(model) + assert set(attrs) == {"name", "type", "class"} + + attr_dict = as_attribute_dict(model) + expected = {"name": "test_name", "type": "test_type", "class": "test_class"} + assert attr_dict == expected + + def test_6c_flattened_with_readonly_exclusion(self): + """Flattened model with readonly properties and exclude_readonly behavior""" + + class ReadonlyContentModel(HybridModel): + readonly_field: str = rest_field( + name="readonlyWire", + visibility=["read"], + original_tsp_name="readonly_prop" + ) + readwrite_field: str = rest_field( + name="readwriteWire", + original_tsp_name="readwrite_prop" + ) + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self._attr_to_rest_field['readonly_field']._original_tsp_name = "readonly_prop" + self._attr_to_rest_field['readwrite_field']._original_tsp_name = "readwrite_prop" + self._backcompat_attr_to_rest_field = { + "readonly_prop": self._attr_to_rest_field['readonly_field'], + "readwrite_prop": self._attr_to_rest_field['readwrite_field'] + } + + class FlattenedReadonlyModel(HybridModel): + id: str = rest_field() + content: ReadonlyContentModel = rest_field() + + __flattened_items = ["readonly_prop", "readwrite_prop"] + + def __init__(self, *args, **kwargs): + _flattened = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened.items(): + setattr(self, k, v) + + def __getattr__(self, name: str): + if name in self.__flattened_items and self.content is not None: + attr_map = { + "readonly_prop": "readonly_field", + "readwrite_prop": "readwrite_field" + } + return getattr(self.content, attr_map[name]) + raise AttributeError(f"No attribute '{name}'") + + def __setattr__(self, key: str, value): + if key in self.__flattened_items: + if self.content is None: + self.content = ReadonlyContentModel() + attr_map = { + "readonly_prop": "readonly_field", + "readwrite_prop": "readwrite_field" + } + setattr(self.content, attr_map[key], value) + else: + super().__setattr__(key, value) + + model = FlattenedReadonlyModel( + id="test_id", + readonly_prop="readonly_value", + readwrite_prop="readwrite_value" + ) + + # All properties included by default + full_dict = as_attribute_dict(model, exclude_readonly=False) + expected_full = { + "id": "test_id", + "readonly_prop": "readonly_value", + "readwrite_prop": "readwrite_value" + } + assert full_dict == expected_full + + # Readonly properties excluded when requested + filtered_dict = as_attribute_dict(model, exclude_readonly=True) + expected_filtered = { + "id": "test_id", + "readwrite_prop": "readwrite_value" + } + assert filtered_dict == expected_filtered + + # ========== EDGE CASES ========== + + def test_mixed_combinations_comprehensive(self): + """Comprehensive test mixing all backcompat scenarios in one model""" + + class ComprehensiveModel(HybridModel): + # Case 1: Normal field, same wire name, no original + normal_field: str = rest_field() + + # Case 2: Normal field, different wire name, no original + different_wire: str = rest_field(name="wireNameDifferent") + + # Case 3: Padded field with original, same wire name + keys_property: str = rest_field(original_tsp_name="keys") + + # Case 4: Padded field with original, different wire name + type_property: str = rest_field(name="typeWire", original_tsp_name="type") + + # Case 5: Readonly field with original + readonly_class: str = rest_field( + name="classWire", + visibility=["read"], + original_tsp_name="class" + ) + + model = ComprehensiveModel( + normal_field="normal", + different_wire="different", + keys_property="keys_val", + type_property="type_val", + readonly_class="class_val" + ) + + # attribute_list should use backcompat names where available + attrs = attribute_list(model) + expected_attrs = {"normal_field", "different_wire", "keys", "type", "class"} + assert set(attrs) == expected_attrs + + # Full as_attribute_dict + full_dict = as_attribute_dict(model) + expected_full = { + "normal_field": "normal", + "different_wire": "different", + "keys": "keys_val", + "type": "type_val", + "class": "class_val" + } + assert full_dict == expected_full + + # Exclude readonly + filtered_dict = as_attribute_dict(model, exclude_readonly=True) + expected_filtered = { + "normal_field": "normal", + "different_wire": "different", + "keys": "keys_val", + "type": "type_val" + # "class" excluded because it's readonly + } + assert filtered_dict == expected_filtered + + # Verify wire representations use correct wire names + wire_dict = dict(model) + expected_wire = { + "normal_field": "normal", # same as attr + "wireNameDifferent": "different", # different wire name + "keys_property": "keys_val", # same as attr (padded) + "typeWire": "type_val", # different wire name + "classWire": "class_val" # different wire name + } + assert wire_dict == expected_wire + + def test_no_backcompat_fallback(self): + """Test fallback behavior when no backcompat mapping exists""" + + class NoBackcompatModel(HybridModel): + padded_attr: str = rest_field(name="wireField") + # Note: No original_tsp_name set, so no backcompat should occur + + model = NoBackcompatModel(padded_attr="value") + + # Should fall back to using actual attribute names + assert attribute_list(model) == ["padded_attr"] + assert as_attribute_dict(model) == {"padded_attr": "value"} + assert dict(model) == {"wireField": "value"} + + def test_property_with_padding_in_actual_name(self): + """Test handling of properties that have padding in their actual attribute names""" + + class PaddingInNameModel(HybridModel): + keys_property: str = rest_field(name="myKeys") + + model = PaddingInNameModel(keys_property="value") + # Should use actual attribute name since no original_tsp_name is set + assert attribute_list(model) == ["keys_property"] + assert as_attribute_dict(model) == {"keys_property": "value"} + assert dict(model) == {"myKeys": "value"} From 5ab99697a3b2c9a59a1b500f07c003fb211148e8 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 17 Nov 2025 16:15:28 -0500 Subject: [PATCH 18/34] add changelog --- sdk/core/azure-core/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sdk/core/azure-core/CHANGELOG.md b/sdk/core/azure-core/CHANGELOG.md index 160b820c1a97..a5b08ea4f0b1 100644 --- a/sdk/core/azure-core/CHANGELOG.md +++ b/sdk/core/azure-core/CHANGELOG.md @@ -8,6 +8,8 @@ ### Bugs Fixed +- Fix `attribute_list` and `as_attribute_dict` to return original model attribute name in cases where we pad the name now but used to not pad #44084 + ### Other Changes - Updated `BearerTokenCredentialPolicy` and `AsyncBearerTokenCredentialPolicy` to set the `enable_cae` parameter to `True` by default. This change enables Continuous Access Evaluation (CAE) for all token requests made through these policies. #42941 From 7e9e659a4e4f895f46f24d6ab077c6cc993aeed9 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Tue, 18 Nov 2025 13:40:20 -0500 Subject: [PATCH 19/34] lint and run black --- sdk/core/azure-core/azure/core/serialization.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sdk/core/azure-core/azure/core/serialization.py b/sdk/core/azure-core/azure/core/serialization.py index ea312929739c..ae2c21348e58 100644 --- a/sdk/core/azure-core/azure/core/serialization.py +++ b/sdk/core/azure-core/azure/core/serialization.py @@ -365,10 +365,10 @@ def _get_flattened_attribute(obj: Any) -> Optional[str]: # Check if this property contains a nested model if not hasattr(v, '_class_type'): continue - + # Get backcompat names from the nested model nested_backcompat_names = set(_get_backcompat_attr_to_rest_field(v._class_type).keys()) # pylint: disable=protected-access - + # If any flattened items match the backcompat names in the nested model, this is our flattened attribute if flattened_items_set.intersection(nested_backcompat_names): return k @@ -446,13 +446,13 @@ def as_attribute_dict(obj: Any, *, exclude_readonly: bool = False) -> Dict[str, # Get the backcompat name for this attribute original_tsp_name = getattr(rest_field, "_original_tsp_name", None) backcompat_name = original_tsp_name if original_tsp_name else actual_attr_name - + if backcompat_name == flattened_attribute: flattened_actual_attr = actual_attr_name break except StopIteration: pass - + for attr_name, rest_field in _get_backcompat_attr_to_rest_field(obj).items(): # pylint: disable=protected-access if exclude_readonly and _is_readonly(rest_field): @@ -467,7 +467,7 @@ def as_attribute_dict(obj: Any, *, exclude_readonly: bool = False) -> Dict[str, rest_to_attr[nested_field._rest_name] = flattened_name # pylint: disable=protected-access else: rest_to_attr[rest_field._rest_name] = attr_name # pylint: disable=protected-access - + for k, v in obj.items(): if exclude_readonly and k in readonly_props: # pyright: ignore continue @@ -478,7 +478,9 @@ def as_attribute_dict(obj: Any, *, exclude_readonly: bool = False) -> Dict[str, mapped_name = rest_to_attr.get(fk, fk) if mapped_name in (flattened_items or []): # Check if this flattened item should be excluded due to readonly - nested_backcompat_map = _get_backcompat_attr_to_rest_field(getattr(obj._attr_to_rest_field[flattened_actual_attr], '_class_type')) # pylint: disable=protected-access + nested_backcompat_map = _get_backcompat_attr_to_rest_field( + getattr(obj._attr_to_rest_field[flattened_actual_attr], '_class_type') + ) # pylint: disable=protected-access if mapped_name in nested_backcompat_map: nested_field = nested_backcompat_map[mapped_name] if exclude_readonly and _is_readonly(nested_field): From 96f03021a8ae5ccf052a83c406d10f0de23fbe52 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Tue, 18 Nov 2025 13:46:01 -0500 Subject: [PATCH 20/34] run black --- .../azure-core/azure/core/serialization.py | 34 +- .../modeltypes/_utils/model_base.py | 5 +- .../azure-core/tests/test_serialization.py | 302 ++++++++---------- 3 files changed, 154 insertions(+), 187 deletions(-) diff --git a/sdk/core/azure-core/azure/core/serialization.py b/sdk/core/azure-core/azure/core/serialization.py index ae2c21348e58..aef3aecb8b0a 100644 --- a/sdk/core/azure-core/azure/core/serialization.py +++ b/sdk/core/azure-core/azure/core/serialization.py @@ -331,6 +331,7 @@ def _as_attribute_dict_value(v: Any, *, exclude_readonly: bool = False) -> Any: return {dk: _as_attribute_dict_value(dv, exclude_readonly=exclude_readonly) for dk, dv in v.items()} return as_attribute_dict(v, exclude_readonly=exclude_readonly) if is_generated_model(v) else v + def _get_backcompat_attr_to_rest_field(obj: Any) -> Dict[str, Any]: """Get the backcompat attribute to rest field mapping for a generated TypeSpec model. @@ -343,6 +344,7 @@ def _get_backcompat_attr_to_rest_field(obj: Any) -> Dict[str, Any]: except AttributeError: return obj._attr_to_rest_field # pylint: disable=protected-access + def _get_flattened_attribute(obj: Any) -> Optional[str]: """Get the name of the flattened attribute in a generated TypeSpec model if one exists. @@ -363,11 +365,13 @@ def _get_flattened_attribute(obj: Any) -> Optional[str]: for k, v in _get_backcompat_attr_to_rest_field(obj).items(): # pylint: disable=protected-access try: # Check if this property contains a nested model - if not hasattr(v, '_class_type'): + if not hasattr(v, "_class_type"): continue # Get backcompat names from the nested model - nested_backcompat_names = set(_get_backcompat_attr_to_rest_field(v._class_type).keys()) # pylint: disable=protected-access + nested_backcompat_names = set( + _get_backcompat_attr_to_rest_field(v._class_type).keys() # pylint: disable=protected-access + ) # If any flattened items match the backcompat names in the nested model, this is our flattened attribute if flattened_items_set.intersection(nested_backcompat_names): @@ -393,7 +397,7 @@ def attribute_list(obj: Any) -> List[str]: return list(obj._attribute_map.keys()) # pylint: disable=protected-access flattened_attribute = _get_flattened_attribute(obj) retval: List[str] = [] - for attr_name, rest_field in _get_backcompat_attr_to_rest_field(obj).items(): # pylint: disable=protected-access + for attr_name in _get_backcompat_attr_to_rest_field(obj).keys(): # pylint: disable=protected-access if flattened_attribute == attr_name: # For flattened attributes, return the flattened item names from __flattened_items try: @@ -407,7 +411,9 @@ def attribute_list(obj: Any) -> List[str]: return retval -def as_attribute_dict(obj: Any, *, exclude_readonly: bool = False) -> Dict[str, Any]: +def as_attribute_dict( # pylint: disable=too-many-branches,too-many-statements + obj: Any, *, exclude_readonly: bool = False +) -> Dict[str, Any]: """Convert an object to a dictionary of its attributes. Made solely for backcompatibility with the legacy `.as_dict()` on msrest models. @@ -426,7 +432,7 @@ def as_attribute_dict(obj: Any, *, exclude_readonly: bool = False) -> Dict[str, if hasattr(obj, "_attribute_map"): # msrest generated model return obj.as_dict(keep_readonly=not exclude_readonly) - try: + try: # pylint: disable=too-many-nested-blocks # now we're a typespec generated model result = {} readonly_props = set() @@ -453,14 +459,18 @@ def as_attribute_dict(obj: Any, *, exclude_readonly: bool = False) -> Dict[str, except StopIteration: pass - for attr_name, rest_field in _get_backcompat_attr_to_rest_field(obj).items(): # pylint: disable=protected-access + for attr_name, rest_field in _get_backcompat_attr_to_rest_field( + obj + ).items(): # pylint: disable=protected-access if exclude_readonly and _is_readonly(rest_field): # if we're excluding readonly properties, we need to track them readonly_props.add(rest_field._rest_name) # pylint: disable=protected-access if flattened_attribute == attr_name: # For flattened attributes, map flattened item names directly to their nested field names - nested_backcompat_map = _get_backcompat_attr_to_rest_field(rest_field._class_type) # pylint: disable=protected-access + nested_backcompat_map = _get_backcompat_attr_to_rest_field( + rest_field._class_type # pylint: disable=protected-access + ) for flattened_name in flattened_items or []: if flattened_name in nested_backcompat_map: nested_field = nested_backcompat_map[flattened_name] @@ -473,14 +483,18 @@ def as_attribute_dict(obj: Any, *, exclude_readonly: bool = False) -> Dict[str, continue if k == flattened_actual_attr: # For flattened attributes, extract values from nested model using backcompat names - if hasattr(v, 'items'): + if hasattr(v, "items"): for fk, fv in v.items(): mapped_name = rest_to_attr.get(fk, fk) if mapped_name in (flattened_items or []): # Check if this flattened item should be excluded due to readonly nested_backcompat_map = _get_backcompat_attr_to_rest_field( - getattr(obj._attr_to_rest_field[flattened_actual_attr], '_class_type') - ) # pylint: disable=protected-access + getattr( + # pylint: disable-next=protected-access + obj._attr_to_rest_field[flattened_actual_attr], + "_class_type", + ) + ) if mapped_name in nested_backcompat_map: nested_field = nested_backcompat_map[mapped_name] if exclude_readonly and _is_readonly(nested_field): diff --git a/sdk/core/azure-core/tests/specs_sdk/modeltypes/modeltypes/_utils/model_base.py b/sdk/core/azure-core/tests/specs_sdk/modeltypes/modeltypes/_utils/model_base.py index 9172543a2791..4d6a099c61ba 100644 --- a/sdk/core/azure-core/tests/specs_sdk/modeltypes/modeltypes/_utils/model_base.py +++ b/sdk/core/azure-core/tests/specs_sdk/modeltypes/modeltypes/_utils/model_base.py @@ -655,8 +655,8 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: rf._rest_name_input = attr cls._attr_to_rest_field: typing.Dict[str, _RestField] = dict(attr_to_rest_field.items()) cls._backcompat_attr_to_rest_field: typing.Dict[str, _RestField] = { - Model._get_backcompat_attribute_name(cls._attr_to_rest_field, attr): rf for attr, rf in cls - ._attr_to_rest_field.items() + Model._get_backcompat_attribute_name(cls._attr_to_rest_field, attr): rf + for attr, rf in cls._attr_to_rest_field.items() } cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") @@ -677,7 +677,6 @@ def _get_backcompat_attribute_name(cls, _attr_to_rest_field: typing.Dict[str, "_ return original_tsp_name return attr_name - @classmethod def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: for v in cls.__dict__.values(): diff --git a/sdk/core/azure-core/tests/test_serialization.py b/sdk/core/azure-core/tests/test_serialization.py index 3fb7d1a4c80e..f41d422895ea 100644 --- a/sdk/core/azure-core/tests/test_serialization.py +++ b/sdk/core/azure-core/tests/test_serialization.py @@ -1649,14 +1649,14 @@ def deserializer_b(cls, data: Dict[str, Any]) -> ModelB: class TestBackcompatPropertyMatrix: """ Systematic test matrix for DPG model property backcompat scenarios. - + Tests all combinations of 5 key dimensions: 1. wireName: same/different from attr_name - 2. attr_name: normal/padded (reserved word) + 2. attr_name: normal/padded (reserved word) 3. original_tsp_name: None/present (TSP name before padding) 4. visibility: readonly/readwrite (affects exclude_readonly) 5. structure: regular/nested/flattened models - + COMPLETE TEST MATRIX: ┌───────┬─────────────┬──────────────┬─────────────────┬────────────┬──────────────┬─────────────────────────────┐ │ Test │ Wire Name │ Attr Name │ Original TSP │ Visibility │ Structure │ Expected Behavior │ @@ -1675,189 +1675,177 @@ class TestBackcompatPropertyMatrix: │ 6c │ various │ mixed │ mixed │ readonly │ flat-mixed │ flattened + exclude │ └───────┴─────────────┴──────────────┴─────────────────┴────────────┴──────────────┴─────────────────────────────┘ """ - + # ========== DIMENSION 1-4 COMBINATIONS: REGULAR STRUCTURE ========== - + def test_1a_same_wire_normal_attr_no_original_readwrite_regular(self): """Wire=attr, normal attr, no original, readwrite, regular model""" - + class RegularModel(HybridModel): field_name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - + model = RegularModel(field_name="value") - + # Should use attr_name (same as wire name) assert attribute_list(model) == ["field_name"] assert as_attribute_dict(model) == {"field_name": "value"} assert as_attribute_dict(model, exclude_readonly=True) == {"field_name": "value"} - + def test_1b_same_wire_normal_attr_no_original_readonly_regular(self): """Wire=attr, normal attr, no original, readonly, regular model""" - + class ReadonlyModel(HybridModel): field_name: str = rest_field(visibility=["read"]) - + model = ReadonlyModel(field_name="value") - + # Should use attr_name, but excluded when exclude_readonly=True assert attribute_list(model) == ["field_name"] assert as_attribute_dict(model) == {"field_name": "value"} assert as_attribute_dict(model, exclude_readonly=True) == {} - + def test_2a_different_wire_normal_attr_no_original_readwrite_regular(self): """Wire≠attr, normal attr, no original, readwrite, regular model""" - + class DifferentWireModel(HybridModel): client_field: str = rest_field(name="wireField", visibility=["read", "create", "update", "delete", "query"]) - + model = DifferentWireModel(client_field="value") - + # Should use attr_name (wire name is different) assert attribute_list(model) == ["client_field"] assert as_attribute_dict(model) == {"client_field": "value"} # Verify wire representation uses different name assert dict(model) == {"wireField": "value"} - + def test_2b_different_wire_normal_attr_no_original_readonly_regular(self): """Wire≠attr, normal attr, no original, readonly, regular model""" - + class ReadonlyDifferentWireModel(HybridModel): client_field: str = rest_field(name="wireField", visibility=["read"]) - + model = ReadonlyDifferentWireModel(client_field="value") - + # Should use attr_name, excluded when exclude_readonly=True assert attribute_list(model) == ["client_field"] assert as_attribute_dict(model) == {"client_field": "value"} assert as_attribute_dict(model, exclude_readonly=True) == {} - + def test_3a_same_wire_padded_attr_with_original_readwrite_regular(self): """Wire=original, padded attr, original present, readwrite, regular model""" - + class PaddedModel(HybridModel): keys_property: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - + def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # Set original TSP name for backcompat - self._attr_to_rest_field['keys_property']._original_tsp_name = "keys" + self._attr_to_rest_field["keys_property"]._original_tsp_name = "keys" # Create backcompat mapping - self._backcompat_attr_to_rest_field = { - "keys": self._attr_to_rest_field['keys_property'] - } - + self._backcompat_attr_to_rest_field = {"keys": self._attr_to_rest_field["keys_property"]} + model = PaddedModel(keys_property="value") - + # Should use original_tsp_name when available assert attribute_list(model) == ["keys"] assert as_attribute_dict(model) == {"keys": "value"} - + def test_3b_same_wire_padded_attr_with_original_readonly_regular(self): """Wire=original, padded attr, original present, readonly, regular model""" - + class ReadonlyPaddedModel(HybridModel): keys_property: str = rest_field(visibility=["read"], original_tsp_name="keys") - + model = ReadonlyPaddedModel(keys_property="value") - + # Should use original_tsp_name, excluded when exclude_readonly=True assert attribute_list(model) == ["keys"] assert as_attribute_dict(model) == {"keys": "value"} assert as_attribute_dict(model, exclude_readonly=True) == {} - + def test_4a_different_wire_padded_attr_with_original_readwrite_regular(self): """Wire≠original, padded attr, original present, readwrite, regular model""" - + class DifferentWirePaddedModel(HybridModel): keys_property: str = rest_field(name="keysWire", original_tsp_name="keys") - + model = DifferentWirePaddedModel(keys_property="value") - + # Should use original_tsp_name assert attribute_list(model) == ["keys"] assert as_attribute_dict(model) == {"keys": "value"} # Verify wire uses different name assert dict(model) == {"keysWire": "value"} - + def test_4b_different_wire_padded_attr_with_original_readonly_regular(self): """Wire≠original, padded attr, original present, readonly, regular model""" - + class ReadonlyDifferentWirePaddedModel(HybridModel): - keys_property: str = rest_field( - name="keysWire", - visibility=["read"], - original_tsp_name="keys" - ) - + keys_property: str = rest_field(name="keysWire", visibility=["read"], original_tsp_name="keys") + model = ReadonlyDifferentWirePaddedModel(keys_property="value") - - # Should use original_tsp_name, excluded when exclude_readonly=True + + # Should use original_tsp_name, excluded when exclude_readonly=True assert attribute_list(model) == ["keys"] assert as_attribute_dict(model) == {"keys": "value"} assert as_attribute_dict(model, exclude_readonly=True) == {} - + # ========== DIMENSION 5: STRUCTURE VARIATIONS ========== - + def test_5a_nested_model_backcompat_recursive(self): """Nested models with mixed backcompat scenarios""" - + class NestedBackcompatModel(HybridModel): keys_property: str = rest_field(name="keysWire", original_tsp_name="keys") normal_field: str = rest_field(name="normalWire") - + class ParentModel(HybridModel): nested: NestedBackcompatModel = rest_field() type_property: str = rest_field(original_tsp_name="type") - - nested_model = NestedBackcompatModel( - keys_property="nested_keys", - normal_field="nested_normal" - ) + + nested_model = NestedBackcompatModel(keys_property="nested_keys", normal_field="nested_normal") parent_model = ParentModel(nested=nested_model, type_property="parent_type") - + # Test nested model independently nested_attrs = attribute_list(nested_model) assert set(nested_attrs) == {"keys", "normal_field"} - + nested_dict = as_attribute_dict(nested_model) assert nested_dict == {"keys": "nested_keys", "normal_field": "nested_normal"} - + # Test parent model with recursive backcompat parent_attrs = attribute_list(parent_model) assert set(parent_attrs) == {"nested", "type"} - + parent_dict = as_attribute_dict(parent_model) - expected_parent = { - "nested": {"keys": "nested_keys", "normal_field": "nested_normal"}, - "type": "parent_type" - } + expected_parent = {"nested": {"keys": "nested_keys", "normal_field": "nested_normal"}, "type": "parent_type"} assert parent_dict == expected_parent - + def test_6a_flattened_container_with_backcompat(self): """Flattened property where container has backcompat (keys_property → keys)""" - + # Helper model for flattening content class ContentModel(HybridModel): name: str = rest_field() description: str = rest_field() - + class FlattenedContainerModel(HybridModel): id: str = rest_field() keys_property: ContentModel = rest_field(original_tsp_name="keys") - + __flattened_items = ["name", "description"] - + def __init__(self, *args, **kwargs): _flattened = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) for k, v in _flattened.items(): setattr(self, k, v) - + def __getattr__(self, name: str): if name in self.__flattened_items and self.keys_property is not None: return getattr(self.keys_property, name) raise AttributeError(f"No attribute '{name}'") - + def __setattr__(self, key: str, value): if key in self.__flattened_items: if self.keys_property is None: @@ -1865,44 +1853,40 @@ def __setattr__(self, key: str, value): setattr(self.keys_property, key, value) else: super().__setattr__(key, value) - - model = FlattenedContainerModel( - id="test_id", - name="flattened_name", - description="flattened_desc" - ) - + + model = FlattenedContainerModel(id="test_id", name="flattened_name", description="flattened_desc") + # Flattened items should appear at top level attrs = attribute_list(model) assert set(attrs) == {"id", "name", "description"} - + # Flattened dict should use top-level names attr_dict = as_attribute_dict(model) expected = {"id": "test_id", "name": "flattened_name", "description": "flattened_desc"} assert attr_dict == expected - + def test_6b_flattened_properties_with_backcompat(self): """Flattened properties themselves have backcompat (type_property → type)""" - + class BackcompatContentModel(HybridModel): type_property: str = rest_field(name="typeWire", original_tsp_name="type") class_property: str = rest_field(name="classWire", original_tsp_name="class") - + def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - self._attr_to_rest_field['type_property']._original_tsp_name = "type" - self._attr_to_rest_field['class_property']._original_tsp_name = "class" + self._attr_to_rest_field["type_property"]._original_tsp_name = "type" + self._attr_to_rest_field["class_property"]._original_tsp_name = "class" self._backcompat_attr_to_rest_field = { - "type": self._attr_to_rest_field['type_property'], - "class": self._attr_to_rest_field['class_property'] + "type": self._attr_to_rest_field["type_property"], + "class": self._attr_to_rest_field["class_property"], } - + class FlattenedPropsBackcompatModel(HybridModel): name: str = rest_field() properties: BackcompatContentModel = rest_field() - + __flattened_items = ["type", "class"] # Use original names - + def __init__(self, *args, **kwargs): _flattened = {} for item in ["type", "class"]: @@ -1911,13 +1895,13 @@ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) for k, v in _flattened.items(): setattr(self, k, v) - + def __getattr__(self, name: str): if name in self.__flattened_items and self.properties is not None: attr_map = {"type": "type_property", "class": "class_property"} return getattr(self.properties, attr_map[name]) raise AttributeError(f"No attribute '{name}'") - + def __setattr__(self, key: str, value): if key in self.__flattened_items: if self.properties is None: @@ -1926,180 +1910,150 @@ def __setattr__(self, key: str, value): setattr(self.properties, attr_map[key], value) else: super().__setattr__(key, value) - - model = FlattenedPropsBackcompatModel( - name="test_name", - type="test_type", - **{"class": "test_class"} - ) - + + model = FlattenedPropsBackcompatModel(name="test_name", type="test_type", **{"class": "test_class"}) + # Should use original names for flattened properties attrs = attribute_list(model) assert set(attrs) == {"name", "type", "class"} - + attr_dict = as_attribute_dict(model) expected = {"name": "test_name", "type": "test_type", "class": "test_class"} assert attr_dict == expected - + def test_6c_flattened_with_readonly_exclusion(self): """Flattened model with readonly properties and exclude_readonly behavior""" - + class ReadonlyContentModel(HybridModel): readonly_field: str = rest_field( - name="readonlyWire", - visibility=["read"], - original_tsp_name="readonly_prop" + name="readonlyWire", visibility=["read"], original_tsp_name="readonly_prop" ) - readwrite_field: str = rest_field( - name="readwriteWire", - original_tsp_name="readwrite_prop" - ) - + readwrite_field: str = rest_field(name="readwriteWire", original_tsp_name="readwrite_prop") + def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - self._attr_to_rest_field['readonly_field']._original_tsp_name = "readonly_prop" - self._attr_to_rest_field['readwrite_field']._original_tsp_name = "readwrite_prop" + self._attr_to_rest_field["readonly_field"]._original_tsp_name = "readonly_prop" + self._attr_to_rest_field["readwrite_field"]._original_tsp_name = "readwrite_prop" self._backcompat_attr_to_rest_field = { - "readonly_prop": self._attr_to_rest_field['readonly_field'], - "readwrite_prop": self._attr_to_rest_field['readwrite_field'] + "readonly_prop": self._attr_to_rest_field["readonly_field"], + "readwrite_prop": self._attr_to_rest_field["readwrite_field"], } - + class FlattenedReadonlyModel(HybridModel): id: str = rest_field() content: ReadonlyContentModel = rest_field() - + __flattened_items = ["readonly_prop", "readwrite_prop"] - + def __init__(self, *args, **kwargs): _flattened = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) for k, v in _flattened.items(): setattr(self, k, v) - + def __getattr__(self, name: str): if name in self.__flattened_items and self.content is not None: - attr_map = { - "readonly_prop": "readonly_field", - "readwrite_prop": "readwrite_field" - } + attr_map = {"readonly_prop": "readonly_field", "readwrite_prop": "readwrite_field"} return getattr(self.content, attr_map[name]) raise AttributeError(f"No attribute '{name}'") - + def __setattr__(self, key: str, value): if key in self.__flattened_items: if self.content is None: self.content = ReadonlyContentModel() - attr_map = { - "readonly_prop": "readonly_field", - "readwrite_prop": "readwrite_field" - } + attr_map = {"readonly_prop": "readonly_field", "readwrite_prop": "readwrite_field"} setattr(self.content, attr_map[key], value) else: super().__setattr__(key, value) - - model = FlattenedReadonlyModel( - id="test_id", - readonly_prop="readonly_value", - readwrite_prop="readwrite_value" - ) - + + model = FlattenedReadonlyModel(id="test_id", readonly_prop="readonly_value", readwrite_prop="readwrite_value") + # All properties included by default full_dict = as_attribute_dict(model, exclude_readonly=False) - expected_full = { - "id": "test_id", - "readonly_prop": "readonly_value", - "readwrite_prop": "readwrite_value" - } + expected_full = {"id": "test_id", "readonly_prop": "readonly_value", "readwrite_prop": "readwrite_value"} assert full_dict == expected_full - + # Readonly properties excluded when requested filtered_dict = as_attribute_dict(model, exclude_readonly=True) - expected_filtered = { - "id": "test_id", - "readwrite_prop": "readwrite_value" - } + expected_filtered = {"id": "test_id", "readwrite_prop": "readwrite_value"} assert filtered_dict == expected_filtered - + # ========== EDGE CASES ========== - + def test_mixed_combinations_comprehensive(self): """Comprehensive test mixing all backcompat scenarios in one model""" - + class ComprehensiveModel(HybridModel): # Case 1: Normal field, same wire name, no original normal_field: str = rest_field() - - # Case 2: Normal field, different wire name, no original + + # Case 2: Normal field, different wire name, no original different_wire: str = rest_field(name="wireNameDifferent") - + # Case 3: Padded field with original, same wire name keys_property: str = rest_field(original_tsp_name="keys") - + # Case 4: Padded field with original, different wire name type_property: str = rest_field(name="typeWire", original_tsp_name="type") - + # Case 5: Readonly field with original - readonly_class: str = rest_field( - name="classWire", - visibility=["read"], - original_tsp_name="class" - ) - + readonly_class: str = rest_field(name="classWire", visibility=["read"], original_tsp_name="class") + model = ComprehensiveModel( normal_field="normal", different_wire="different", keys_property="keys_val", type_property="type_val", - readonly_class="class_val" + readonly_class="class_val", ) - + # attribute_list should use backcompat names where available attrs = attribute_list(model) expected_attrs = {"normal_field", "different_wire", "keys", "type", "class"} assert set(attrs) == expected_attrs - + # Full as_attribute_dict full_dict = as_attribute_dict(model) expected_full = { "normal_field": "normal", "different_wire": "different", "keys": "keys_val", - "type": "type_val", - "class": "class_val" + "type": "type_val", + "class": "class_val", } assert full_dict == expected_full - + # Exclude readonly filtered_dict = as_attribute_dict(model, exclude_readonly=True) expected_filtered = { "normal_field": "normal", "different_wire": "different", "keys": "keys_val", - "type": "type_val" + "type": "type_val", # "class" excluded because it's readonly } assert filtered_dict == expected_filtered - + # Verify wire representations use correct wire names wire_dict = dict(model) expected_wire = { - "normal_field": "normal", # same as attr + "normal_field": "normal", # same as attr "wireNameDifferent": "different", # different wire name - "keys_property": "keys_val", # same as attr (padded) - "typeWire": "type_val", # different wire name - "classWire": "class_val" # different wire name + "keys_property": "keys_val", # same as attr (padded) + "typeWire": "type_val", # different wire name + "classWire": "class_val", # different wire name } assert wire_dict == expected_wire - + def test_no_backcompat_fallback(self): """Test fallback behavior when no backcompat mapping exists""" - + class NoBackcompatModel(HybridModel): padded_attr: str = rest_field(name="wireField") # Note: No original_tsp_name set, so no backcompat should occur - + model = NoBackcompatModel(padded_attr="value") - + # Should fall back to using actual attribute names assert attribute_list(model) == ["padded_attr"] assert as_attribute_dict(model) == {"padded_attr": "value"} @@ -2107,7 +2061,7 @@ class NoBackcompatModel(HybridModel): def test_property_with_padding_in_actual_name(self): """Test handling of properties that have padding in their actual attribute names""" - + class PaddingInNameModel(HybridModel): keys_property: str = rest_field(name="myKeys") From 4db5a195995374feecbfd133b63e72e9c942fe8f Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Tue, 18 Nov 2025 18:23:44 -0500 Subject: [PATCH 21/34] add get_old_attribute --- .../azure-core/azure/core/serialization.py | 152 +++++------ .../azure-core/tests/test_serialization.py | 250 ++++++++++-------- 2 files changed, 202 insertions(+), 200 deletions(-) diff --git a/sdk/core/azure-core/azure/core/serialization.py b/sdk/core/azure-core/azure/core/serialization.py index aef3aecb8b0a..fa080927f6ce 100644 --- a/sdk/core/azure-core/azure/core/serialization.py +++ b/sdk/core/azure-core/azure/core/serialization.py @@ -4,6 +4,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- +# pylint: disable=protected-access import base64 from functools import partial from json import JSONEncoder @@ -19,6 +20,7 @@ "as_attribute_dict", "attribute_list", "TypeHandlerRegistry", + "get_old_attribute", ] TZ_UTC = timezone.utc @@ -317,7 +319,7 @@ def _is_readonly(p: Any) -> bool: :rtype: bool """ try: - return p._visibility == ["read"] # pylint: disable=protected-access + return p._visibility == ["read"] except AttributeError: return False @@ -332,17 +334,18 @@ def _as_attribute_dict_value(v: Any, *, exclude_readonly: bool = False) -> Any: return as_attribute_dict(v, exclude_readonly=exclude_readonly) if is_generated_model(v) else v -def _get_backcompat_attr_to_rest_field(obj: Any) -> Dict[str, Any]: - """Get the backcompat attribute to rest field mapping for a generated TypeSpec model. +def _get_backcompat_name(rest_field: Any, default_attr_name: str) -> str: + """Get the backcompat name for an attribute. - :param any obj: The object to get the mapping from. - :return: The backcompat attribute to rest field mapping. - :rtype: Dict[str, Any] + :param any rest_field: The rest field to get the backcompat name from. + :param str default_attr_name: The default attribute name to use if no backcompat name + :return: The backcompat name. + :rtype: str """ try: - return obj._backcompat_attr_to_rest_field # pylint: disable=protected-access + return rest_field._original_tsp_name or default_attr_name except AttributeError: - return obj._attr_to_rest_field # pylint: disable=protected-access + return default_attr_name def _get_flattened_attribute(obj: Any) -> Optional[str]: @@ -361,20 +364,9 @@ def _get_flattened_attribute(obj: Any) -> Optional[str]: if flattened_items is None: return None - flattened_items_set = set(flattened_items) - for k, v in _get_backcompat_attr_to_rest_field(obj).items(): # pylint: disable=protected-access + for k, v in obj._attr_to_rest_field.items(): try: - # Check if this property contains a nested model - if not hasattr(v, "_class_type"): - continue - - # Get backcompat names from the nested model - nested_backcompat_names = set( - _get_backcompat_attr_to_rest_field(v._class_type).keys() # pylint: disable=protected-access - ) - - # If any flattened items match the backcompat names in the nested model, this is our flattened attribute - if flattened_items_set.intersection(nested_backcompat_names): + if set(v._class_type._attr_to_rest_field.keys()).intersection(set(flattened_items)): return k except AttributeError: # if the attribute does not have _class_type, it is not a typespec generated model @@ -394,26 +386,18 @@ def attribute_list(obj: Any) -> List[str]: raise TypeError("Object is not a generated SDK model.") if hasattr(obj, "_attribute_map"): # msrest model - return list(obj._attribute_map.keys()) # pylint: disable=protected-access + return list(obj._attribute_map.keys()) flattened_attribute = _get_flattened_attribute(obj) retval: List[str] = [] - for attr_name in _get_backcompat_attr_to_rest_field(obj).keys(): # pylint: disable=protected-access + for attr_name, rest_field in obj._attr_to_rest_field.items(): if flattened_attribute == attr_name: - # For flattened attributes, return the flattened item names from __flattened_items - try: - flattened_items = getattr(obj, next(a for a in dir(obj) if "__flattened_items" in a), None) - if flattened_items: - retval.extend(flattened_items) - except StopIteration: - pass + retval.extend(attribute_list(rest_field._class_type)) else: - retval.append(attr_name) + retval.append(_get_backcompat_name(rest_field, attr_name)) return retval -def as_attribute_dict( # pylint: disable=too-many-branches,too-many-statements - obj: Any, *, exclude_readonly: bool = False -) -> Dict[str, Any]: +def as_attribute_dict(obj: Any, *, exclude_readonly: bool = False) -> Dict[str, Any]: """Convert an object to a dictionary of its attributes. Made solely for backcompatibility with the legacy `.as_dict()` on msrest models. @@ -432,7 +416,7 @@ def as_attribute_dict( # pylint: disable=too-many-branches,too-many-statements if hasattr(obj, "_attribute_map"): # msrest generated model return obj.as_dict(keep_readonly=not exclude_readonly) - try: # pylint: disable=too-many-nested-blocks + try: # now we're a typespec generated model result = {} readonly_props = set() @@ -440,73 +424,27 @@ def as_attribute_dict( # pylint: disable=too-many-branches,too-many-statements # create a reverse mapping from rest field name to attribute name rest_to_attr = {} flattened_attribute = _get_flattened_attribute(obj) - flattened_items = None - flattened_actual_attr = None # Store the actual attribute name for the flattened attribute - if flattened_attribute: - try: - flattened_items = getattr(obj, next(a for a in dir(obj) if "__flattened_items" in a), None) - # Find the actual attribute name that corresponds to the flattened attribute - # flattened_attribute could be either an actual attr name or a backcompat name - # We need to find the actual attr name that appears in obj.items() - for actual_attr_name, rest_field in obj._attr_to_rest_field.items(): # pylint: disable=protected-access - # Get the backcompat name for this attribute - original_tsp_name = getattr(rest_field, "_original_tsp_name", None) - backcompat_name = original_tsp_name if original_tsp_name else actual_attr_name - - if backcompat_name == flattened_attribute: - flattened_actual_attr = actual_attr_name - break - except StopIteration: - pass - - for attr_name, rest_field in _get_backcompat_attr_to_rest_field( - obj - ).items(): # pylint: disable=protected-access + for attr_name, rest_field in obj._attr_to_rest_field.items(): if exclude_readonly and _is_readonly(rest_field): # if we're excluding readonly properties, we need to track them - readonly_props.add(rest_field._rest_name) # pylint: disable=protected-access + readonly_props.add(rest_field._rest_name) if flattened_attribute == attr_name: - # For flattened attributes, map flattened item names directly to their nested field names - nested_backcompat_map = _get_backcompat_attr_to_rest_field( - rest_field._class_type # pylint: disable=protected-access - ) - for flattened_name in flattened_items or []: - if flattened_name in nested_backcompat_map: - nested_field = nested_backcompat_map[flattened_name] - rest_to_attr[nested_field._rest_name] = flattened_name # pylint: disable=protected-access + for fk, fv in rest_field._class_type._attr_to_rest_field.items(): + rest_to_attr[fv._rest_name] = _get_backcompat_name(fv, fk) else: - rest_to_attr[rest_field._rest_name] = attr_name # pylint: disable=protected-access - + rest_to_attr[rest_field._rest_name] = _get_backcompat_name(rest_field, attr_name) for k, v in obj.items(): if exclude_readonly and k in readonly_props: # pyright: ignore continue - if k == flattened_actual_attr: - # For flattened attributes, extract values from nested model using backcompat names - if hasattr(v, "items"): - for fk, fv in v.items(): - mapped_name = rest_to_attr.get(fk, fk) - if mapped_name in (flattened_items or []): - # Check if this flattened item should be excluded due to readonly - nested_backcompat_map = _get_backcompat_attr_to_rest_field( - getattr( - # pylint: disable-next=protected-access - obj._attr_to_rest_field[flattened_actual_attr], - "_class_type", - ) - ) - if mapped_name in nested_backcompat_map: - nested_field = nested_backcompat_map[mapped_name] - if exclude_readonly and _is_readonly(nested_field): - continue - result[mapped_name] = _as_attribute_dict_value(fv, exclude_readonly=exclude_readonly) + if k == flattened_attribute: + for fk, fv in v.items(): + result[rest_to_attr.get(fk, fk)] = _as_attribute_dict_value(fv, exclude_readonly=exclude_readonly) else: is_multipart_file_input = False try: - is_multipart_file_input = next( # pylint: disable=protected-access - rf - for rf in _get_backcompat_attr_to_rest_field(obj).values() # pylint: disable=protected-access - if rf._rest_name == k # pylint: disable=protected-access + is_multipart_file_input = next( + rf for rf in obj._attr_to_rest_field.values() if rf._rest_name == k )._is_multipart_file_input except StopIteration: pass @@ -518,3 +456,35 @@ def as_attribute_dict( # pylint: disable=too-many-branches,too-many-statements except AttributeError as exc: # not a typespec generated model raise TypeError("Object must be a generated model instance.") from exc + + +def get_old_attribute(model: Any, field_name: str) -> Any: + """Get the value of an attribute using backcompat attribute access. + + This function takes a field name that may be a backcompat name (original TSP name) + and returns the value from the corresponding actual attribute on the model. + + :param any model: The model instance. + :param str field_name: The backcompat attribute name (from attribute_list). + :return: The value of the attribute. + :rtype: any + """ + if not is_generated_model(model): + raise TypeError("Object must be a generated model instance.") + + # Check if field_name is an original TSP name in the model + flattened_attribute = _get_flattened_attribute(model) + for attr_name, rest_field in model._attr_to_rest_field.items(): + # Check if field_name matches this attribute's original TSP name (regardless of flattening) + if _get_backcompat_name(rest_field, attr_name) == field_name: + return getattr(model, attr_name) + + # If this is a flattened attribute, check if field_name is an original TSP name inside it + if flattened_attribute == attr_name: + for fk, fv in rest_field._class_type._attr_to_rest_field.items(): + if _get_backcompat_name(fv, fk) == field_name: + # This is a flattened property - access the actual attribute name + return getattr(model, fk) + + # Fallback to direct attribute access + return getattr(model, field_name) diff --git a/sdk/core/azure-core/tests/test_serialization.py b/sdk/core/azure-core/tests/test_serialization.py index f41d422895ea..a59c5fabf0ba 100644 --- a/sdk/core/azure-core/tests/test_serialization.py +++ b/sdk/core/azure-core/tests/test_serialization.py @@ -11,7 +11,14 @@ from typing import Any, Dict, List, Optional, Union, Type from io import BytesIO -from azure.core.serialization import AzureJSONEncoder, NULL, as_attribute_dict, is_generated_model, attribute_list +from azure.core.serialization import ( + AzureJSONEncoder, + NULL, + as_attribute_dict, + get_old_attribute, + is_generated_model, + attribute_list, +) from azure.core.exceptions import DeserializationError import pytest from modeltypes._utils.model_base import ( @@ -1682,7 +1689,7 @@ def test_1a_same_wire_normal_attr_no_original_readwrite_regular(self): """Wire=attr, normal attr, no original, readwrite, regular model""" class RegularModel(HybridModel): - field_name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + field_name: str = rest_field() model = RegularModel(field_name="value") @@ -1690,6 +1697,8 @@ class RegularModel(HybridModel): assert attribute_list(model) == ["field_name"] assert as_attribute_dict(model) == {"field_name": "value"} assert as_attribute_dict(model, exclude_readonly=True) == {"field_name": "value"} + assert getattr(model, "field_name") == "value" + assert get_old_attribute(model, "field_name") == "value" def test_1b_same_wire_normal_attr_no_original_readonly_regular(self): """Wire=attr, normal attr, no original, readonly, regular model""" @@ -1703,12 +1712,14 @@ class ReadonlyModel(HybridModel): assert attribute_list(model) == ["field_name"] assert as_attribute_dict(model) == {"field_name": "value"} assert as_attribute_dict(model, exclude_readonly=True) == {} + assert getattr(model, "field_name") == "value" + assert get_old_attribute(model, "field_name") == "value" def test_2a_different_wire_normal_attr_no_original_readwrite_regular(self): """Wire≠attr, normal attr, no original, readwrite, regular model""" class DifferentWireModel(HybridModel): - client_field: str = rest_field(name="wireField", visibility=["read", "create", "update", "delete", "query"]) + client_field: str = rest_field(name="wireField") model = DifferentWireModel(client_field="value") @@ -1717,6 +1728,8 @@ class DifferentWireModel(HybridModel): assert as_attribute_dict(model) == {"client_field": "value"} # Verify wire representation uses different name assert dict(model) == {"wireField": "value"} + assert getattr(model, "client_field") == "value" + assert get_old_attribute(model, "client_field") == "value" def test_2b_different_wire_normal_attr_no_original_readonly_regular(self): """Wire≠attr, normal attr, no original, readonly, regular model""" @@ -1730,25 +1743,22 @@ class ReadonlyDifferentWireModel(HybridModel): assert attribute_list(model) == ["client_field"] assert as_attribute_dict(model) == {"client_field": "value"} assert as_attribute_dict(model, exclude_readonly=True) == {} + assert getattr(model, "client_field") == "value" + assert get_old_attribute(model, "client_field") == "value" def test_3a_same_wire_padded_attr_with_original_readwrite_regular(self): """Wire=original, padded attr, original present, readwrite, regular model""" class PaddedModel(HybridModel): - keys_property: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - # Set original TSP name for backcompat - self._attr_to_rest_field["keys_property"]._original_tsp_name = "keys" - # Create backcompat mapping - self._backcompat_attr_to_rest_field = {"keys": self._attr_to_rest_field["keys_property"]} + keys_property: str = rest_field(original_tsp_name="keys") model = PaddedModel(keys_property="value") # Should use original_tsp_name when available assert attribute_list(model) == ["keys"] assert as_attribute_dict(model) == {"keys": "value"} + assert getattr(model, "keys_property") == get_old_attribute(model, "keys") == "value" + assert set(model.keys()) == {"keys_property"} def test_3b_same_wire_padded_attr_with_original_readonly_regular(self): """Wire=original, padded attr, original present, readonly, regular model""" @@ -1762,33 +1772,39 @@ class ReadonlyPaddedModel(HybridModel): assert attribute_list(model) == ["keys"] assert as_attribute_dict(model) == {"keys": "value"} assert as_attribute_dict(model, exclude_readonly=True) == {} + assert getattr(model, "keys_property") == get_old_attribute(model, "keys") == "value" + assert set(model.keys()) == {"keys_property"} def test_4a_different_wire_padded_attr_with_original_readwrite_regular(self): """Wire≠original, padded attr, original present, readwrite, regular model""" class DifferentWirePaddedModel(HybridModel): - keys_property: str = rest_field(name="keysWire", original_tsp_name="keys") + clear_property: str = rest_field(name="clearWire", original_tsp_name="clear") - model = DifferentWirePaddedModel(keys_property="value") + model = DifferentWirePaddedModel(clear_property="value") # Should use original_tsp_name - assert attribute_list(model) == ["keys"] - assert as_attribute_dict(model) == {"keys": "value"} + assert attribute_list(model) == ["clear"] + assert as_attribute_dict(model) == {"clear": "value"} # Verify wire uses different name - assert dict(model) == {"keysWire": "value"} + assert dict(model) == {"clearWire": "value"} + assert getattr(model, "clear_property") == get_old_attribute(model, "clear") == "value" + assert set(model.keys()) == {"clearWire"} def test_4b_different_wire_padded_attr_with_original_readonly_regular(self): """Wire≠original, padded attr, original present, readonly, regular model""" class ReadonlyDifferentWirePaddedModel(HybridModel): - keys_property: str = rest_field(name="keysWire", visibility=["read"], original_tsp_name="keys") + pop_property: str = rest_field(name="popWire", visibility=["read"], original_tsp_name="pop") - model = ReadonlyDifferentWirePaddedModel(keys_property="value") + model = ReadonlyDifferentWirePaddedModel(pop_property="value") # Should use original_tsp_name, excluded when exclude_readonly=True - assert attribute_list(model) == ["keys"] - assert as_attribute_dict(model) == {"keys": "value"} + assert attribute_list(model) == ["pop"] + assert as_attribute_dict(model) == {"pop": "value"} assert as_attribute_dict(model, exclude_readonly=True) == {} + assert getattr(model, "pop_property") == get_old_attribute(model, "pop") == "value" + assert set(model.keys()) == {"popWire"} # ========== DIMENSION 5: STRUCTURE VARIATIONS ========== @@ -1801,10 +1817,10 @@ class NestedBackcompatModel(HybridModel): class ParentModel(HybridModel): nested: NestedBackcompatModel = rest_field() - type_property: str = rest_field(original_tsp_name="type") + items_property: str = rest_field(name="itemsWire", original_tsp_name="items") nested_model = NestedBackcompatModel(keys_property="nested_keys", normal_field="nested_normal") - parent_model = ParentModel(nested=nested_model, type_property="parent_type") + parent_model = ParentModel(nested=nested_model, items_property="parent_items") # Test nested model independently nested_attrs = attribute_list(nested_model) @@ -1815,12 +1831,22 @@ class ParentModel(HybridModel): # Test parent model with recursive backcompat parent_attrs = attribute_list(parent_model) - assert set(parent_attrs) == {"nested", "type"} + assert set(parent_attrs) == {"nested", "items"} parent_dict = as_attribute_dict(parent_model) - expected_parent = {"nested": {"keys": "nested_keys", "normal_field": "nested_normal"}, "type": "parent_type"} + expected_parent = {"nested": {"keys": "nested_keys", "normal_field": "nested_normal"}, "items": "parent_items"} assert parent_dict == expected_parent + assert getattr(nested_model, "keys_property") == get_old_attribute(nested_model, "keys") == "nested_keys" + assert getattr(parent_model, "items_property") == get_old_attribute(parent_model, "items") == "parent_items" + + assert set(nested_model.keys()) == {"keysWire", "normalWire"} + assert set(nested_model.items()) == {("keysWire", "nested_keys"), ("normalWire", "nested_normal")} + assert set(parent_model.keys()) == {"nested", "itemsWire"} + assert len(parent_model.items()) == 2 + assert ("nested", parent_model.nested) in parent_model.items() + assert ("itemsWire", "parent_items") in parent_model.items() + def test_6a_flattened_container_with_backcompat(self): """Flattened property where container has backcompat (keys_property → keys)""" @@ -1831,26 +1857,28 @@ class ContentModel(HybridModel): class FlattenedContainerModel(HybridModel): id: str = rest_field() - keys_property: ContentModel = rest_field(original_tsp_name="keys") + update_property: ContentModel = rest_field(original_tsp_name="update") __flattened_items = ["name", "description"] - def __init__(self, *args, **kwargs): - _flattened = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) - for k, v in _flattened.items(): + for k, v in _flattened_input.items(): setattr(self, k, v) - def __getattr__(self, name: str): - if name in self.__flattened_items and self.keys_property is not None: - return getattr(self.keys_property, name) - raise AttributeError(f"No attribute '{name}'") + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.update_property is None: + return None + return getattr(self.update_property, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") - def __setattr__(self, key: str, value): + def __setattr__(self, key: str, value: Any) -> None: if key in self.__flattened_items: - if self.keys_property is None: - self.keys_property = ContentModel() - setattr(self.keys_property, key, value) + if self.update_property is None: + self.update_property = self._attr_to_rest_field["update_property"]._class_type() + setattr(self.update_property, key, value) else: super().__setattr__(key, value) @@ -1859,125 +1887,123 @@ def __setattr__(self, key: str, value): # Flattened items should appear at top level attrs = attribute_list(model) assert set(attrs) == {"id", "name", "description"} + assert getattr(model, "name") == "flattened_name" + assert getattr(model, "description") == "flattened_desc" # Flattened dict should use top-level names attr_dict = as_attribute_dict(model) expected = {"id": "test_id", "name": "flattened_name", "description": "flattened_desc"} assert attr_dict == expected + assert get_old_attribute(model, "update") is model.update_property + assert get_old_attribute(model, "update").name == "flattened_name" + assert get_old_attribute(model, "update").description == "flattened_desc" + + assert set(model.keys()) == {"id", "update_property"} + def test_6b_flattened_properties_with_backcompat(self): """Flattened properties themselves have backcompat (type_property → type)""" class BackcompatContentModel(HybridModel): - type_property: str = rest_field(name="typeWire", original_tsp_name="type") - class_property: str = rest_field(name="classWire", original_tsp_name="class") - - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - self._attr_to_rest_field["type_property"]._original_tsp_name = "type" - self._attr_to_rest_field["class_property"]._original_tsp_name = "class" - self._backcompat_attr_to_rest_field = { - "type": self._attr_to_rest_field["type_property"], - "class": self._attr_to_rest_field["class_property"], - } + values_property: str = rest_field(name="valuesWire", original_tsp_name="values") + get_property: str = rest_field(name="getWire", original_tsp_name="get") class FlattenedPropsBackcompatModel(HybridModel): name: str = rest_field() properties: BackcompatContentModel = rest_field() - __flattened_items = ["type", "class"] # Use original names + __flattened_items = ["values_property", "get_property"] - def __init__(self, *args, **kwargs): - _flattened = {} - for item in ["type", "class"]: - if item in kwargs: - _flattened[item] = kwargs.pop(item) + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) - for k, v in _flattened.items(): + for k, v in _flattened_input.items(): setattr(self, k, v) - def __getattr__(self, name: str): - if name in self.__flattened_items and self.properties is not None: - attr_map = {"type": "type_property", "class": "class_property"} - return getattr(self.properties, attr_map[name]) - raise AttributeError(f"No attribute '{name}'") + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") - def __setattr__(self, key: str, value): + def __setattr__(self, key: str, value: Any) -> None: if key in self.__flattened_items: if self.properties is None: - self.properties = BackcompatContentModel() - attr_map = {"type": "type_property", "class": "class_property"} - setattr(self.properties, attr_map[key], value) + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) else: super().__setattr__(key, value) - model = FlattenedPropsBackcompatModel(name="test_name", type="test_type", **{"class": "test_class"}) + model = FlattenedPropsBackcompatModel( + name="test_name", values_property="test_values", get_property="test_class" + ) # Should use original names for flattened properties attrs = attribute_list(model) - assert set(attrs) == {"name", "type", "class"} + assert set(attrs) == {"name", "values", "get"} + assert get_old_attribute(model, "values_property") == "test_values" + assert "test_name" in model.values() attr_dict = as_attribute_dict(model) - expected = {"name": "test_name", "type": "test_type", "class": "test_class"} + expected = {"name": "test_name", "values": "test_values", "get": "test_class"} assert attr_dict == expected def test_6c_flattened_with_readonly_exclusion(self): """Flattened model with readonly properties and exclude_readonly behavior""" class ReadonlyContentModel(HybridModel): - readonly_field: str = rest_field( - name="readonlyWire", visibility=["read"], original_tsp_name="readonly_prop" - ) - readwrite_field: str = rest_field(name="readwriteWire", original_tsp_name="readwrite_prop") - - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - self._attr_to_rest_field["readonly_field"]._original_tsp_name = "readonly_prop" - self._attr_to_rest_field["readwrite_field"]._original_tsp_name = "readwrite_prop" - self._backcompat_attr_to_rest_field = { - "readonly_prop": self._attr_to_rest_field["readonly_field"], - "readwrite_prop": self._attr_to_rest_field["readwrite_field"], - } + setdefault_property: str = rest_field(name="readonlyWire", original_tsp_name="setdefault") + popitem_property: str = rest_field(name="readwriteWire", original_tsp_name="popitem") class FlattenedReadonlyModel(HybridModel): - id: str = rest_field() - content: ReadonlyContentModel = rest_field() + get_property: str = rest_field(name="getProperty", original_tsp_name="get", visibility=["read"]) + properties: ReadonlyContentModel = rest_field() - __flattened_items = ["readonly_prop", "readwrite_prop"] + __flattened_items = ["setdefault_property", "popitem_property"] - def __init__(self, *args, **kwargs): - _flattened = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) - for k, v in _flattened.items(): + for k, v in _flattened_input.items(): setattr(self, k, v) - def __getattr__(self, name: str): - if name in self.__flattened_items and self.content is not None: - attr_map = {"readonly_prop": "readonly_field", "readwrite_prop": "readwrite_field"} - return getattr(self.content, attr_map[name]) - raise AttributeError(f"No attribute '{name}'") + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") - def __setattr__(self, key: str, value): + def __setattr__(self, key: str, value: Any) -> None: if key in self.__flattened_items: - if self.content is None: - self.content = ReadonlyContentModel() - attr_map = {"readonly_prop": "readonly_field", "readwrite_prop": "readwrite_field"} - setattr(self.content, attr_map[key], value) + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) else: super().__setattr__(key, value) - model = FlattenedReadonlyModel(id="test_id", readonly_prop="readonly_value", readwrite_prop="readwrite_value") + model = FlattenedReadonlyModel( + get_property="test_get", setdefault_property="setdefault", popitem_property="readwrite_value" + ) # All properties included by default full_dict = as_attribute_dict(model, exclude_readonly=False) - expected_full = {"id": "test_id", "readonly_prop": "readonly_value", "readwrite_prop": "readwrite_value"} + expected_full = {"get": "test_get", "setdefault": "setdefault", "popitem": "readwrite_value"} assert full_dict == expected_full # Readonly properties excluded when requested filtered_dict = as_attribute_dict(model, exclude_readonly=True) - expected_filtered = {"id": "test_id", "readwrite_prop": "readwrite_value"} + expected_filtered = {"setdefault": "setdefault", "popitem": "readwrite_value"} assert filtered_dict == expected_filtered + attribute_list_result = attribute_list(model) + expected_attrs = {"get", "setdefault", "popitem"} + assert set(attribute_list_result) == expected_attrs + assert get_old_attribute(model, "setdefault") == "setdefault" + assert get_old_attribute(model, "popitem") == "readwrite_value" + assert getattr(model, "get_property") == "test_get" + # ========== EDGE CASES ========== def test_mixed_combinations_comprehensive(self): @@ -1994,23 +2020,28 @@ class ComprehensiveModel(HybridModel): keys_property: str = rest_field(original_tsp_name="keys") # Case 4: Padded field with original, different wire name - type_property: str = rest_field(name="typeWire", original_tsp_name="type") + values_property: str = rest_field(name="valuesWire", original_tsp_name="values") # Case 5: Readonly field with original - readonly_class: str = rest_field(name="classWire", visibility=["read"], original_tsp_name="class") + items_property: str = rest_field(name="itemsWire", visibility=["read"], original_tsp_name="items") model = ComprehensiveModel( normal_field="normal", different_wire="different", keys_property="keys_val", - type_property="type_val", - readonly_class="class_val", + values_property="values_val", + items_property="items_val", ) # attribute_list should use backcompat names where available attrs = attribute_list(model) - expected_attrs = {"normal_field", "different_wire", "keys", "type", "class"} + expected_attrs = {"normal_field", "different_wire", "keys", "values", "items"} assert set(attrs) == expected_attrs + assert getattr(model, "keys_property") == get_old_attribute(model, "keys") == "keys_val" + assert getattr(model, "values_property") == get_old_attribute(model, "values") == "values_val" + assert getattr(model, "items_property") == get_old_attribute(model, "items") == "items_val" + assert getattr(model, "normal_field") == get_old_attribute(model, "normal_field") == "normal" + assert getattr(model, "different_wire") == get_old_attribute(model, "different_wire") == "different" # Full as_attribute_dict full_dict = as_attribute_dict(model) @@ -2018,8 +2049,8 @@ class ComprehensiveModel(HybridModel): "normal_field": "normal", "different_wire": "different", "keys": "keys_val", - "type": "type_val", - "class": "class_val", + "values": "values_val", + "items": "items_val", } assert full_dict == expected_full @@ -2029,8 +2060,8 @@ class ComprehensiveModel(HybridModel): "normal_field": "normal", "different_wire": "different", "keys": "keys_val", - "type": "type_val", - # "class" excluded because it's readonly + "values": "values_val", + # "items" excluded because it's readonly } assert filtered_dict == expected_filtered @@ -2040,8 +2071,8 @@ class ComprehensiveModel(HybridModel): "normal_field": "normal", # same as attr "wireNameDifferent": "different", # different wire name "keys_property": "keys_val", # same as attr (padded) - "typeWire": "type_val", # different wire name - "classWire": "class_val", # different wire name + "valuesWire": "values_val", # different wire name + "itemsWire": "items_val", # different wire name } assert wire_dict == expected_wire @@ -2070,3 +2101,4 @@ class PaddingInNameModel(HybridModel): assert attribute_list(model) == ["keys_property"] assert as_attribute_dict(model) == {"keys_property": "value"} assert dict(model) == {"myKeys": "value"} + assert getattr(model, "keys_property") == "value" From f21e2d134defa3a540beb8c58e7be4357ff73672 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Mon, 1 Dec 2025 14:56:13 +0800 Subject: [PATCH 22/34] add test case --- .../azure-mgmt-keyvault/tests/test_unit.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 sdk/keyvault/azure-mgmt-keyvault/tests/test_unit.py diff --git a/sdk/keyvault/azure-mgmt-keyvault/tests/test_unit.py b/sdk/keyvault/azure-mgmt-keyvault/tests/test_unit.py new file mode 100644 index 000000000000..4dc7b075914e --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/tests/test_unit.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 azure.mgmt.keyvault.models import Key, KeyAttributes + + +def test_model_initialization(): + key = Key(kty="EC", attributes=KeyAttributes(enabled=True), key_ops=["encrypt", "decrypt"]) + assert key.kty == "EC" + assert key.properties.kty == "EC" + assert key.attributes.enabled is True + assert key.properties.attributes.enabled is True + assert "encrypt" in key.key_ops + assert "decrypt" in key.key_ops + assert "encrypt" in key.properties.key_ops + assert "decrypt" in key.properties.key_ops From b542030c2fd9bf43f81ec8f56d688305a11b8d0c Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Wed, 3 Dec 2025 11:56:10 +0800 Subject: [PATCH 23/34] update test case --- .../azure-mgmt-keyvault/tests/test_unit.py | 20 -------- .../tests/test_unittest.py | 47 +++++++++++++++++++ 2 files changed, 47 insertions(+), 20 deletions(-) delete mode 100644 sdk/keyvault/azure-mgmt-keyvault/tests/test_unit.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/tests/test_unittest.py diff --git a/sdk/keyvault/azure-mgmt-keyvault/tests/test_unit.py b/sdk/keyvault/azure-mgmt-keyvault/tests/test_unit.py deleted file mode 100644 index 4dc7b075914e..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/tests/test_unit.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for 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.mgmt.keyvault.models import Key, KeyAttributes - - -def test_model_initialization(): - key = Key(kty="EC", attributes=KeyAttributes(enabled=True), key_ops=["encrypt", "decrypt"]) - assert key.kty == "EC" - assert key.properties.kty == "EC" - assert key.attributes.enabled is True - assert key.properties.attributes.enabled is True - assert "encrypt" in key.key_ops - assert "decrypt" in key.key_ops - assert "encrypt" in key.properties.key_ops - assert "decrypt" in key.properties.key_ops diff --git a/sdk/keyvault/azure-mgmt-keyvault/tests/test_unittest.py b/sdk/keyvault/azure-mgmt-keyvault/tests/test_unittest.py new file mode 100644 index 000000000000..3ea877fc6ad2 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/tests/test_unittest.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.mgmt.keyvault.models import Key, KeyAttributes, KeyProperties +from azure.core.serialization import attribute_list + + +def test_model_initialization(): + key = Key(kty="EC", attributes=KeyAttributes(enabled=True), key_ops=["encrypt", "decrypt"]) + assert key.kty == "EC" + assert key.properties.kty == "EC" + assert key.attributes.enabled is True + assert key.properties.attributes.enabled is True + assert "encrypt" in key.key_ops + assert "decrypt" in key.key_ops + assert "encrypt" in key.properties.key_ops + assert "decrypt" in key.properties.key_ops + + +def test_model_attribute_list_for_compatibility(): + # if none of attributes in properties of model instance is assigned, attribute_list will return top-level attributes + assert {"id", "name", "type", "system_data", "properties", "location", "tags"} == set(attribute_list(Key())) + + # if any attribute in properties of model instance is assigned, attribute_list will return flattened attributes + expected_attributes = { + "id", + "name", + "type", + "system_data", + "attributes", + "kty", + "key_ops", + "key_size", + "curve_name", + "key_uri", + "key_uri_with_version", + "rotation_policy", + "release_policy", + "location", + "tags", + } + assert expected_attributes == set(attribute_list(Key(properties=KeyProperties(kty="RSA")))) + assert expected_attributes == set(attribute_list(Key(kty="RSA"))) From 77f629de6c20bb883967eeda92e490cceaab7749 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Wed, 3 Dec 2025 13:38:07 +0800 Subject: [PATCH 24/34] update test case --- .../azure-mgmt-keyvault/tests/test_unittest.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/sdk/keyvault/azure-mgmt-keyvault/tests/test_unittest.py b/sdk/keyvault/azure-mgmt-keyvault/tests/test_unittest.py index 3ea877fc6ad2..085404cf824c 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/tests/test_unittest.py +++ b/sdk/keyvault/azure-mgmt-keyvault/tests/test_unittest.py @@ -22,11 +22,7 @@ def test_model_initialization(): def test_model_attribute_list_for_compatibility(): - # if none of attributes in properties of model instance is assigned, attribute_list will return top-level attributes - assert {"id", "name", "type", "system_data", "properties", "location", "tags"} == set(attribute_list(Key())) - - # if any attribute in properties of model instance is assigned, attribute_list will return flattened attributes - expected_attributes = { + expected_attributes = sorted([ "id", "name", "type", @@ -42,6 +38,8 @@ def test_model_attribute_list_for_compatibility(): "release_policy", "location", "tags", - } - assert expected_attributes == set(attribute_list(Key(properties=KeyProperties(kty="RSA")))) - assert expected_attributes == set(attribute_list(Key(kty="RSA"))) + ]) + assert expected_attributes == sorted(attribute_list(Key(properties=KeyProperties(kty="RSA")))) + assert expected_attributes == sorted(attribute_list(Key(kty="RSA"))) + assert expected_attributes == sorted(attribute_list(Key())) + From 2e0a7934fb73538869e7ab7f78fe0ab38629c847 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Wed, 3 Dec 2025 17:35:00 +0800 Subject: [PATCH 25/34] update --- sdk/keyvault/azure-mgmt-keyvault/tests/test_unittest.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sdk/keyvault/azure-mgmt-keyvault/tests/test_unittest.py b/sdk/keyvault/azure-mgmt-keyvault/tests/test_unittest.py index 085404cf824c..a9601bc4ba44 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/tests/test_unittest.py +++ b/sdk/keyvault/azure-mgmt-keyvault/tests/test_unittest.py @@ -5,7 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from azure.mgmt.keyvault.models import Key, KeyAttributes, KeyProperties +from azure.mgmt.keyvault.models import Key, KeyAttributes, KeyProperties, PrivateLinkResource from azure.core.serialization import attribute_list @@ -43,3 +43,8 @@ def test_model_attribute_list_for_compatibility(): assert expected_attributes == sorted(attribute_list(Key(kty="RSA"))) assert expected_attributes == sorted(attribute_list(Key())) +def test_private_link_resource_initialization(): + plr = PrivateLinkResource(group_id="vault", required_members=["member1", "member2"], required_zone_names=["zone1", "zone2"]) + assert plr.group_id == "vault" + assert plr.properties.group_id == "vault" + \ No newline at end of file From b223bbc8915f2656d41948a5dae3483c8d3b2f7d Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Wed, 3 Dec 2025 20:04:11 -0500 Subject: [PATCH 26/34] switch to get_backcompat_attr_name --- sdk/core/azure-core/CHANGELOG.md | 8 +- .../azure-core/azure/core/serialization.py | 53 ++++++------- .../azure-core/tests/test_serialization.py | 74 ++++++++++--------- 3 files changed, 70 insertions(+), 65 deletions(-) diff --git a/sdk/core/azure-core/CHANGELOG.md b/sdk/core/azure-core/CHANGELOG.md index a5b08ea4f0b1..fa7d74214ee6 100644 --- a/sdk/core/azure-core/CHANGELOG.md +++ b/sdk/core/azure-core/CHANGELOG.md @@ -1,14 +1,12 @@ # Release History -## 1.36.1 (Unreleased) +## 1.37.0(Unreleased) ### Features Added -### Breaking Changes - -### Bugs Fixed +- Added `get_backcompat_attr` to `azure.core.serialization`. `get_backcompat_attr` gets the value of an attribute using backcompat attribute access. #44084 -- Fix `attribute_list` and `as_attribute_dict` to return original model attribute name in cases where we pad the name now but used to not pad #44084 +### Breaking Changes ### Other Changes diff --git a/sdk/core/azure-core/azure/core/serialization.py b/sdk/core/azure-core/azure/core/serialization.py index fa080927f6ce..fbb81dc3473f 100644 --- a/sdk/core/azure-core/azure/core/serialization.py +++ b/sdk/core/azure-core/azure/core/serialization.py @@ -20,7 +20,7 @@ "as_attribute_dict", "attribute_list", "TypeHandlerRegistry", - "get_old_attribute", + "get_backcompat_attr_name", ] TZ_UTC = timezone.utc @@ -393,7 +393,7 @@ def attribute_list(obj: Any) -> List[str]: if flattened_attribute == attr_name: retval.extend(attribute_list(rest_field._class_type)) else: - retval.append(_get_backcompat_name(rest_field, attr_name)) + retval.append(attr_name) return retval @@ -431,9 +431,9 @@ def as_attribute_dict(obj: Any, *, exclude_readonly: bool = False) -> Dict[str, readonly_props.add(rest_field._rest_name) if flattened_attribute == attr_name: for fk, fv in rest_field._class_type._attr_to_rest_field.items(): - rest_to_attr[fv._rest_name] = _get_backcompat_name(fv, fk) + rest_to_attr[fv._rest_name] = fk else: - rest_to_attr[rest_field._rest_name] = _get_backcompat_name(rest_field, attr_name) + rest_to_attr[rest_field._rest_name] = attr_name for k, v in obj.items(): if exclude_readonly and k in readonly_props: # pyright: ignore continue @@ -458,33 +458,34 @@ def as_attribute_dict(obj: Any, *, exclude_readonly: bool = False) -> Dict[str, raise TypeError("Object must be a generated model instance.") from exc -def get_old_attribute(model: Any, field_name: str) -> Any: - """Get the value of an attribute using backcompat attribute access. +def get_backcompat_attr_name(model: Any, attr_name: str) -> str: + """Get the backcompat attribute name for a given attribute. - This function takes a field name that may be a backcompat name (original TSP name) - and returns the value from the corresponding actual attribute on the model. + This function takes an attribute name and returns the backcompat name (original TSP name) + if one exists, otherwise returns the attribute name itself. :param any model: The model instance. - :param str field_name: The backcompat attribute name (from attribute_list). - :return: The value of the attribute. - :rtype: any + :param str attr_name: The attribute name to get the backcompat name for. + :return: The backcompat attribute name (original TSP name) or the attribute name itself. + :rtype: str """ if not is_generated_model(model): raise TypeError("Object must be a generated model instance.") - - # Check if field_name is an original TSP name in the model + + # Check if attr_name exists in the model's attributes flattened_attribute = _get_flattened_attribute(model) - for attr_name, rest_field in model._attr_to_rest_field.items(): - # Check if field_name matches this attribute's original TSP name (regardless of flattening) - if _get_backcompat_name(rest_field, attr_name) == field_name: - return getattr(model, attr_name) - - # If this is a flattened attribute, check if field_name is an original TSP name inside it - if flattened_attribute == attr_name: + for field_attr_name, rest_field in model._attr_to_rest_field.items(): + # Check if this is the attribute we're looking for + if field_attr_name == attr_name: + # Return the original TSP name if it exists, otherwise the attribute name + return _get_backcompat_name(rest_field, attr_name) + + # If this is a flattened attribute, check inside it + if flattened_attribute == field_attr_name: for fk, fv in rest_field._class_type._attr_to_rest_field.items(): - if _get_backcompat_name(fv, fk) == field_name: - # This is a flattened property - access the actual attribute name - return getattr(model, fk) - - # Fallback to direct attribute access - return getattr(model, field_name) + if fk == attr_name: + # Return the original TSP name for this flattened property + return _get_backcompat_name(fv, fk) + + # If not found in the model, just return the attribute name as-is + return attr_name diff --git a/sdk/core/azure-core/tests/test_serialization.py b/sdk/core/azure-core/tests/test_serialization.py index a59c5fabf0ba..fb386cf130c3 100644 --- a/sdk/core/azure-core/tests/test_serialization.py +++ b/sdk/core/azure-core/tests/test_serialization.py @@ -7,7 +7,6 @@ from enum import Enum import json import sys -import traceback from typing import Any, Dict, List, Optional, Union, Type from io import BytesIO @@ -15,7 +14,7 @@ AzureJSONEncoder, NULL, as_attribute_dict, - get_old_attribute, + get_backcompat_attr_name, is_generated_model, attribute_list, ) @@ -1698,7 +1697,7 @@ class RegularModel(HybridModel): assert as_attribute_dict(model) == {"field_name": "value"} assert as_attribute_dict(model, exclude_readonly=True) == {"field_name": "value"} assert getattr(model, "field_name") == "value" - assert get_old_attribute(model, "field_name") == "value" + assert get_backcompat_attr_name(model, "field_name") == "field_name" def test_1b_same_wire_normal_attr_no_original_readonly_regular(self): """Wire=attr, normal attr, no original, readonly, regular model""" @@ -1713,7 +1712,7 @@ class ReadonlyModel(HybridModel): assert as_attribute_dict(model) == {"field_name": "value"} assert as_attribute_dict(model, exclude_readonly=True) == {} assert getattr(model, "field_name") == "value" - assert get_old_attribute(model, "field_name") == "value" + assert get_backcompat_attr_name(model, "field_name") == "field_name" def test_2a_different_wire_normal_attr_no_original_readwrite_regular(self): """Wire≠attr, normal attr, no original, readwrite, regular model""" @@ -1729,7 +1728,7 @@ class DifferentWireModel(HybridModel): # Verify wire representation uses different name assert dict(model) == {"wireField": "value"} assert getattr(model, "client_field") == "value" - assert get_old_attribute(model, "client_field") == "value" + assert get_backcompat_attr_name(model, "client_field") == "client_field" def test_2b_different_wire_normal_attr_no_original_readonly_regular(self): """Wire≠attr, normal attr, no original, readonly, regular model""" @@ -1744,7 +1743,7 @@ class ReadonlyDifferentWireModel(HybridModel): assert as_attribute_dict(model) == {"client_field": "value"} assert as_attribute_dict(model, exclude_readonly=True) == {} assert getattr(model, "client_field") == "value" - assert get_old_attribute(model, "client_field") == "value" + assert get_backcompat_attr_name(model, "client_field") == "client_field" def test_3a_same_wire_padded_attr_with_original_readwrite_regular(self): """Wire=original, padded attr, original present, readwrite, regular model""" @@ -1755,9 +1754,10 @@ class PaddedModel(HybridModel): model = PaddedModel(keys_property="value") # Should use original_tsp_name when available - assert attribute_list(model) == ["keys"] - assert as_attribute_dict(model) == {"keys": "value"} - assert getattr(model, "keys_property") == get_old_attribute(model, "keys") == "value" + assert attribute_list(model) == ["keys_property"] + assert as_attribute_dict(model) == {"keys_property": "value"} + assert get_backcompat_attr_name(model, "keys_property") == "keys" + assert getattr(model, "keys_property") == "value" assert set(model.keys()) == {"keys_property"} def test_3b_same_wire_padded_attr_with_original_readonly_regular(self): @@ -1769,10 +1769,11 @@ class ReadonlyPaddedModel(HybridModel): model = ReadonlyPaddedModel(keys_property="value") # Should use original_tsp_name, excluded when exclude_readonly=True - assert attribute_list(model) == ["keys"] - assert as_attribute_dict(model) == {"keys": "value"} + assert attribute_list(model) == ["keys_property"] + assert as_attribute_dict(model) == {"keys_property": "value"} assert as_attribute_dict(model, exclude_readonly=True) == {} - assert getattr(model, "keys_property") == get_old_attribute(model, "keys") == "value" + assert get_backcompat_attr_name(model, "keys_property") == "keys" + assert getattr(model, "keys_property") == "value" assert set(model.keys()) == {"keys_property"} def test_4a_different_wire_padded_attr_with_original_readwrite_regular(self): @@ -1788,7 +1789,7 @@ class DifferentWirePaddedModel(HybridModel): assert as_attribute_dict(model) == {"clear": "value"} # Verify wire uses different name assert dict(model) == {"clearWire": "value"} - assert getattr(model, "clear_property") == get_old_attribute(model, "clear") == "value" + assert getattr(model, "clear_property") == get_backcompat_attr_name(model, "clear") == "value" assert set(model.keys()) == {"clearWire"} def test_4b_different_wire_padded_attr_with_original_readonly_regular(self): @@ -1803,7 +1804,7 @@ class ReadonlyDifferentWirePaddedModel(HybridModel): assert attribute_list(model) == ["pop"] assert as_attribute_dict(model) == {"pop": "value"} assert as_attribute_dict(model, exclude_readonly=True) == {} - assert getattr(model, "pop_property") == get_old_attribute(model, "pop") == "value" + assert getattr(model, "pop_property") == get_backcompat_attr_name(model, "pop") == "value" assert set(model.keys()) == {"popWire"} # ========== DIMENSION 5: STRUCTURE VARIATIONS ========== @@ -1837,8 +1838,8 @@ class ParentModel(HybridModel): expected_parent = {"nested": {"keys": "nested_keys", "normal_field": "nested_normal"}, "items": "parent_items"} assert parent_dict == expected_parent - assert getattr(nested_model, "keys_property") == get_old_attribute(nested_model, "keys") == "nested_keys" - assert getattr(parent_model, "items_property") == get_old_attribute(parent_model, "items") == "parent_items" + assert getattr(nested_model, "keys_property") == get_backcompat_attr_name(nested_model, "keys") == "nested_keys" + assert getattr(parent_model, "items_property") == get_backcompat_attr_name(parent_model, "items") == "parent_items" assert set(nested_model.keys()) == {"keysWire", "normalWire"} assert set(nested_model.items()) == {("keysWire", "nested_keys"), ("normalWire", "nested_normal")} @@ -1895,9 +1896,9 @@ def __setattr__(self, key: str, value: Any) -> None: expected = {"id": "test_id", "name": "flattened_name", "description": "flattened_desc"} assert attr_dict == expected - assert get_old_attribute(model, "update") is model.update_property - assert get_old_attribute(model, "update").name == "flattened_name" - assert get_old_attribute(model, "update").description == "flattened_desc" + assert get_backcompat_attr_name(model, "update") is model.update_property + assert get_backcompat_attr_name(model, "update").name == "flattened_name" + assert get_backcompat_attr_name(model, "update").description == "flattened_desc" assert set(model.keys()) == {"id", "update_property"} @@ -1942,7 +1943,7 @@ def __setattr__(self, key: str, value: Any) -> None: # Should use original names for flattened properties attrs = attribute_list(model) assert set(attrs) == {"name", "values", "get"} - assert get_old_attribute(model, "values_property") == "test_values" + assert get_backcompat_attr_name(model, "values_property") == "test_values" assert "test_name" in model.values() attr_dict = as_attribute_dict(model) @@ -2000,8 +2001,8 @@ def __setattr__(self, key: str, value: Any) -> None: attribute_list_result = attribute_list(model) expected_attrs = {"get", "setdefault", "popitem"} assert set(attribute_list_result) == expected_attrs - assert get_old_attribute(model, "setdefault") == "setdefault" - assert get_old_attribute(model, "popitem") == "readwrite_value" + assert get_backcompat_attr_name(model, "setdefault") == "setdefault" + assert get_backcompat_attr_name(model, "popitem") == "readwrite_value" assert getattr(model, "get_property") == "test_get" # ========== EDGE CASES ========== @@ -2035,22 +2036,27 @@ class ComprehensiveModel(HybridModel): # attribute_list should use backcompat names where available attrs = attribute_list(model) - expected_attrs = {"normal_field", "different_wire", "keys", "values", "items"} + expected_attrs = {"normal_field", "different_wire", "keys_property", "values_property", "items_property"} assert set(attrs) == expected_attrs - assert getattr(model, "keys_property") == get_old_attribute(model, "keys") == "keys_val" - assert getattr(model, "values_property") == get_old_attribute(model, "values") == "values_val" - assert getattr(model, "items_property") == get_old_attribute(model, "items") == "items_val" - assert getattr(model, "normal_field") == get_old_attribute(model, "normal_field") == "normal" - assert getattr(model, "different_wire") == get_old_attribute(model, "different_wire") == "different" + assert get_backcompat_attr_name(model, "keys_property") == "keys" + assert get_backcompat_attr_name(model, "values_property") == "values" + assert get_backcompat_attr_name(model, "items_property") == "items" + assert get_backcompat_attr_name(model, "normal_field") == "normal_field" + assert get_backcompat_attr_name(model, "different_wire") == "different_wire" + assert getattr(model, "keys_property") == "keys_val" + assert getattr(model, "values_property") == "values_val" + assert getattr(model, "items_property") == "items_val" + assert getattr(model, "normal_field") == "normal" + assert getattr(model, "different_wire") == "different" # Full as_attribute_dict full_dict = as_attribute_dict(model) expected_full = { "normal_field": "normal", "different_wire": "different", - "keys": "keys_val", - "values": "values_val", - "items": "items_val", + "keys_property": "keys_val", + "values_property": "values_val", + "items_property": "items_val", } assert full_dict == expected_full @@ -2059,9 +2065,9 @@ class ComprehensiveModel(HybridModel): expected_filtered = { "normal_field": "normal", "different_wire": "different", - "keys": "keys_val", - "values": "values_val", - # "items" excluded because it's readonly + "keys_property": "keys_val", + "values_property": "values_val", + # "items_property" excluded because it's readonly } assert filtered_dict == expected_filtered From a7df72e18e04d85e7ef6135f7af025bac35d4bfe Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Thu, 4 Dec 2025 13:26:01 +0800 Subject: [PATCH 27/34] fix ci --- sdk/core/azure-core/CHANGELOG.md | 2 +- sdk/core/azure-core/azure/core/_version.py | 2 +- .../azure-core/tests/test_serialization.py | 56 ++++++++++--------- 3 files changed, 31 insertions(+), 29 deletions(-) diff --git a/sdk/core/azure-core/CHANGELOG.md b/sdk/core/azure-core/CHANGELOG.md index fa7d74214ee6..8a1af2cbb5bb 100644 --- a/sdk/core/azure-core/CHANGELOG.md +++ b/sdk/core/azure-core/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.37.0(Unreleased) +## 1.37.0 (Unreleased) ### Features Added diff --git a/sdk/core/azure-core/azure/core/_version.py b/sdk/core/azure-core/azure/core/_version.py index 4ac212ba998c..5b21ec1bb8d4 100644 --- a/sdk/core/azure-core/azure/core/_version.py +++ b/sdk/core/azure-core/azure/core/_version.py @@ -9,4 +9,4 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "1.36.1" +VERSION = "1.37.0" diff --git a/sdk/core/azure-core/tests/test_serialization.py b/sdk/core/azure-core/tests/test_serialization.py index fb386cf130c3..10fe1b7d61b1 100644 --- a/sdk/core/azure-core/tests/test_serialization.py +++ b/sdk/core/azure-core/tests/test_serialization.py @@ -1768,12 +1768,11 @@ class ReadonlyPaddedModel(HybridModel): model = ReadonlyPaddedModel(keys_property="value") - # Should use original_tsp_name, excluded when exclude_readonly=True assert attribute_list(model) == ["keys_property"] assert as_attribute_dict(model) == {"keys_property": "value"} assert as_attribute_dict(model, exclude_readonly=True) == {} assert get_backcompat_attr_name(model, "keys_property") == "keys" - assert getattr(model, "keys_property") == "value" + assert getattr(model, "keys_property") == "value" assert set(model.keys()) == {"keys_property"} def test_4a_different_wire_padded_attr_with_original_readwrite_regular(self): @@ -1784,12 +1783,11 @@ class DifferentWirePaddedModel(HybridModel): model = DifferentWirePaddedModel(clear_property="value") - # Should use original_tsp_name - assert attribute_list(model) == ["clear"] - assert as_attribute_dict(model) == {"clear": "value"} + assert attribute_list(model) == ["clear_property"] + assert as_attribute_dict(model) == {"clear_property": "value"} # Verify wire uses different name assert dict(model) == {"clearWire": "value"} - assert getattr(model, "clear_property") == get_backcompat_attr_name(model, "clear") == "value" + assert getattr(model, "clear_property") == "value" assert set(model.keys()) == {"clearWire"} def test_4b_different_wire_padded_attr_with_original_readonly_regular(self): @@ -1800,11 +1798,10 @@ class ReadonlyDifferentWirePaddedModel(HybridModel): model = ReadonlyDifferentWirePaddedModel(pop_property="value") - # Should use original_tsp_name, excluded when exclude_readonly=True - assert attribute_list(model) == ["pop"] - assert as_attribute_dict(model) == {"pop": "value"} + assert attribute_list(model) == ["pop_property"] + assert as_attribute_dict(model) == {"pop_property": "value"} assert as_attribute_dict(model, exclude_readonly=True) == {} - assert getattr(model, "pop_property") == get_backcompat_attr_name(model, "pop") == "value" + assert getattr(model, "pop_property") == "value" assert set(model.keys()) == {"popWire"} # ========== DIMENSION 5: STRUCTURE VARIATIONS ========== @@ -1825,21 +1822,24 @@ class ParentModel(HybridModel): # Test nested model independently nested_attrs = attribute_list(nested_model) - assert set(nested_attrs) == {"keys", "normal_field"} + assert set(nested_attrs) == {"keys_property", "normal_field"} nested_dict = as_attribute_dict(nested_model) - assert nested_dict == {"keys": "nested_keys", "normal_field": "nested_normal"} + assert nested_dict == {"keys_property": "nested_keys", "normal_field": "nested_normal"} # Test parent model with recursive backcompat parent_attrs = attribute_list(parent_model) - assert set(parent_attrs) == {"nested", "items"} + assert set(parent_attrs) == {"nested", "items_property"} parent_dict = as_attribute_dict(parent_model) - expected_parent = {"nested": {"keys": "nested_keys", "normal_field": "nested_normal"}, "items": "parent_items"} + expected_parent = { + "nested": {"keys_property": "nested_keys", "normal_field": "nested_normal"}, + "items_property": "parent_items", + } assert parent_dict == expected_parent - assert getattr(nested_model, "keys_property") == get_backcompat_attr_name(nested_model, "keys") == "nested_keys" - assert getattr(parent_model, "items_property") == get_backcompat_attr_name(parent_model, "items") == "parent_items" + assert getattr(nested_model, "keys_property") == "nested_keys" + assert getattr(parent_model, "items_property") == "parent_items" assert set(nested_model.keys()) == {"keysWire", "normalWire"} assert set(nested_model.items()) == {("keysWire", "nested_keys"), ("normalWire", "nested_normal")} @@ -1896,9 +1896,7 @@ def __setattr__(self, key: str, value: Any) -> None: expected = {"id": "test_id", "name": "flattened_name", "description": "flattened_desc"} assert attr_dict == expected - assert get_backcompat_attr_name(model, "update") is model.update_property - assert get_backcompat_attr_name(model, "update").name == "flattened_name" - assert get_backcompat_attr_name(model, "update").description == "flattened_desc" + assert get_backcompat_attr_name(model, "update_property") == "update" assert set(model.keys()) == {"id", "update_property"} @@ -1942,12 +1940,12 @@ def __setattr__(self, key: str, value: Any) -> None: # Should use original names for flattened properties attrs = attribute_list(model) - assert set(attrs) == {"name", "values", "get"} - assert get_backcompat_attr_name(model, "values_property") == "test_values" + assert set(attrs) == {"name", "values_property", "get_property"} + assert get_backcompat_attr_name(model, "values_property") == "values" assert "test_name" in model.values() attr_dict = as_attribute_dict(model) - expected = {"name": "test_name", "values": "test_values", "get": "test_class"} + expected = {"name": "test_name", "values_property": "test_values", "get_property": "test_class"} assert attr_dict == expected def test_6c_flattened_with_readonly_exclusion(self): @@ -1990,19 +1988,23 @@ def __setattr__(self, key: str, value: Any) -> None: # All properties included by default full_dict = as_attribute_dict(model, exclude_readonly=False) - expected_full = {"get": "test_get", "setdefault": "setdefault", "popitem": "readwrite_value"} + expected_full = { + "get_property": "test_get", + "setdefault_property": "setdefault", + "popitem_property": "readwrite_value", + } assert full_dict == expected_full # Readonly properties excluded when requested filtered_dict = as_attribute_dict(model, exclude_readonly=True) - expected_filtered = {"setdefault": "setdefault", "popitem": "readwrite_value"} + expected_filtered = {"setdefault_property": "setdefault", "popitem_property": "readwrite_value"} assert filtered_dict == expected_filtered attribute_list_result = attribute_list(model) - expected_attrs = {"get", "setdefault", "popitem"} + expected_attrs = {"get_property", "setdefault_property", "popitem_property"} assert set(attribute_list_result) == expected_attrs - assert get_backcompat_attr_name(model, "setdefault") == "setdefault" - assert get_backcompat_attr_name(model, "popitem") == "readwrite_value" + assert get_backcompat_attr_name(model, "setdefault_property") == "setdefault" + assert get_backcompat_attr_name(model, "popitem_property") == "popitem" assert getattr(model, "get_property") == "test_get" # ========== EDGE CASES ========== From 16793a8aa1a2bfcf74b2311d94b21735163f7836 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Thu, 4 Dec 2025 14:39:08 +0800 Subject: [PATCH 28/34] format --- sdk/core/azure-core/azure/core/serialization.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/core/azure-core/azure/core/serialization.py b/sdk/core/azure-core/azure/core/serialization.py index fbb81dc3473f..65f2608c18d6 100644 --- a/sdk/core/azure-core/azure/core/serialization.py +++ b/sdk/core/azure-core/azure/core/serialization.py @@ -471,7 +471,7 @@ def get_backcompat_attr_name(model: Any, attr_name: str) -> str: """ if not is_generated_model(model): raise TypeError("Object must be a generated model instance.") - + # Check if attr_name exists in the model's attributes flattened_attribute = _get_flattened_attribute(model) for field_attr_name, rest_field in model._attr_to_rest_field.items(): @@ -479,13 +479,13 @@ def get_backcompat_attr_name(model: Any, attr_name: str) -> str: if field_attr_name == attr_name: # Return the original TSP name if it exists, otherwise the attribute name return _get_backcompat_name(rest_field, attr_name) - + # If this is a flattened attribute, check inside it if flattened_attribute == field_attr_name: for fk, fv in rest_field._class_type._attr_to_rest_field.items(): if fk == attr_name: # Return the original TSP name for this flattened property return _get_backcompat_name(fv, fk) - + # If not found in the model, just return the attribute name as-is return attr_name From 14df027dbbc4b9399e4d3bc4ff2411c696085228 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Fri, 5 Dec 2025 12:51:21 +0800 Subject: [PATCH 29/34] regeneration --- eng/emitter-package-lock.json | 209 +++++++++++++++--- eng/emitter-package.json | 2 +- .../azure/mgmt/keyvault/_utils/model_base.py | 25 ++- .../azure/mgmt/keyvault/models/_models.py | 2 +- .../tests/test_unittest.py | 42 ++-- 5 files changed, 233 insertions(+), 47 deletions(-) diff --git a/eng/emitter-package-lock.json b/eng/emitter-package-lock.json index 8ebd55749cbe..259ff88ff3a3 100644 --- a/eng/emitter-package-lock.json +++ b/eng/emitter-package-lock.json @@ -6,7 +6,7 @@ "": { "name": "dist/src/index.js", "dependencies": { - "@azure-tools/typespec-python": "0.54.0" + "@azure-tools/typespec-python": "C:/dev/autorest.python/packages/typespec-python/azure-tools-typespec-python-0.53.3.tgz" }, "devDependencies": { "@azure-tools/typespec-autorest": "~0.62.0", @@ -30,6 +30,7 @@ "version": "0.62.0", "resolved": "https://registry.npmjs.org/@azure-tools/typespec-autorest/-/typespec-autorest-0.62.0.tgz", "integrity": "sha512-XftwipfGGMk9e3qGzbRMBvVpfIqLMJKc8H+XlPHFymnCfexBniZn4Qu2t8nzOVM9fgOoFDjNDzk8W5lf59U5Dg==", + "license": "MIT", "engines": { "node": ">=20.0.0" }, @@ -54,6 +55,7 @@ "version": "0.62.0", "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-core/-/typespec-azure-core-0.62.0.tgz", "integrity": "sha512-4LIFqNHhKO1/jiCH0U2rfI+yH7vkWcFuwpjNyRTWXw/YghAI2d+aIEwtT4oM8jWeYR3KUQfA6AqGPRCm90AXYA==", + "license": "MIT", "engines": { "node": ">=20.0.0" }, @@ -67,6 +69,7 @@ "version": "0.62.1", "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-resource-manager/-/typespec-azure-resource-manager-0.62.1.tgz", "integrity": "sha512-sbCwg5Auvm2/fYUWbx3RlQyZGlMoAmhtRjrurgwWzZIBxBJ7sVqgUQktl3WGHAoeJ3qYa2gAIL4j8/xSPwt5kw==", + "license": "MIT", "dependencies": { "change-case": "~5.4.4", "pluralize": "^8.0.0" @@ -87,6 +90,7 @@ "version": "0.62.0", "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-rulesets/-/typespec-azure-rulesets-0.62.0.tgz", "integrity": "sha512-jEsR9ogSYkYxcOc5biEKbwbYS77ffD8avjT8Sbf5r+8VMPZj46uK3V0FaySbtPh+EEgoBrVj2jcbGGKDFrse1A==", + "license": "MIT", "engines": { "node": ">=20.0.0" }, @@ -101,6 +105,7 @@ "version": "0.62.0", "resolved": "https://registry.npmjs.org/@azure-tools/typespec-client-generator-core/-/typespec-client-generator-core-0.62.0.tgz", "integrity": "sha512-fZilNfvqIW6Jzb97SuM5f+i9p5b0261InQRbQcTbeuYGtb5z5M0v8tuGglE4adU8NqQ1OmEv/oRjQjSeSjlxwA==", + "license": "MIT", "dependencies": { "change-case": "~5.4.4", "pluralize": "^8.0.0", @@ -129,12 +134,13 @@ "dev": true }, "node_modules/@azure-tools/typespec-python": { - "version": "0.54.0", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-python/-/typespec-python-0.54.0.tgz", - "integrity": "sha512-9DKv+HQsJOfhvTETN7NgrZisTJkM2zhvb6N34NJY8nUqYSZ6J2EPie4gasHYWZJ90ug9GxqjHptplcFNnUUgqw==", + "version": "0.53.3", + "resolved": "file:../../autorest.python/packages/typespec-python/azure-tools-typespec-python-0.53.3.tgz", + "integrity": "sha512-ZcHsEYYJk5p6eoRPCSk+jAvMiqEwjGsxJA187gSx/gAN3+fCIAZa7h4nlso5ObLh1FMVuZM84L0YlDg4x4qRLA==", "hasInstallScript": true, + "license": "MIT", "dependencies": { - "@typespec/http-client-python": "~0.21.0", + "@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTYzNjI1My9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.21.0.tgz", "fs-extra": "~11.2.0", "js-yaml": "~4.1.0", "semver": "~7.6.2", @@ -164,6 +170,7 @@ "version": "7.27.1", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==", + "license": "MIT", "dependencies": { "@babel/helper-validator-identifier": "^7.27.1", "js-tokens": "^4.0.0", @@ -177,6 +184,7 @@ "version": "7.28.5", "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", + "license": "MIT", "engines": { "node": ">=6.9.0" } @@ -188,6 +196,7 @@ "cpu": [ "ppc64" ], + "license": "MIT", "optional": true, "os": [ "aix" @@ -203,6 +212,7 @@ "cpu": [ "arm" ], + "license": "MIT", "optional": true, "os": [ "android" @@ -218,6 +228,7 @@ "cpu": [ "arm64" ], + "license": "MIT", "optional": true, "os": [ "android" @@ -233,6 +244,7 @@ "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "android" @@ -248,6 +260,7 @@ "cpu": [ "arm64" ], + "license": "MIT", "optional": true, "os": [ "darwin" @@ -263,6 +276,7 @@ "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "darwin" @@ -278,6 +292,7 @@ "cpu": [ "arm64" ], + "license": "MIT", "optional": true, "os": [ "freebsd" @@ -293,6 +308,7 @@ "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "freebsd" @@ -308,6 +324,7 @@ "cpu": [ "arm" ], + "license": "MIT", "optional": true, "os": [ "linux" @@ -323,6 +340,7 @@ "cpu": [ "arm64" ], + "license": "MIT", "optional": true, "os": [ "linux" @@ -338,6 +356,7 @@ "cpu": [ "ia32" ], + "license": "MIT", "optional": true, "os": [ "linux" @@ -353,6 +372,7 @@ "cpu": [ "loong64" ], + "license": "MIT", "optional": true, "os": [ "linux" @@ -368,6 +388,7 @@ "cpu": [ "mips64el" ], + "license": "MIT", "optional": true, "os": [ "linux" @@ -383,6 +404,7 @@ "cpu": [ "ppc64" ], + "license": "MIT", "optional": true, "os": [ "linux" @@ -398,6 +420,7 @@ "cpu": [ "riscv64" ], + "license": "MIT", "optional": true, "os": [ "linux" @@ -413,6 +436,7 @@ "cpu": [ "s390x" ], + "license": "MIT", "optional": true, "os": [ "linux" @@ -428,6 +452,7 @@ "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "linux" @@ -443,6 +468,7 @@ "cpu": [ "arm64" ], + "license": "MIT", "optional": true, "os": [ "netbsd" @@ -458,6 +484,7 @@ "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "netbsd" @@ -473,6 +500,7 @@ "cpu": [ "arm64" ], + "license": "MIT", "optional": true, "os": [ "openbsd" @@ -488,6 +516,7 @@ "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "openbsd" @@ -503,6 +532,7 @@ "cpu": [ "arm64" ], + "license": "MIT", "optional": true, "os": [ "openharmony" @@ -518,6 +548,7 @@ "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "sunos" @@ -533,6 +564,7 @@ "cpu": [ "arm64" ], + "license": "MIT", "optional": true, "os": [ "win32" @@ -548,6 +580,7 @@ "cpu": [ "ia32" ], + "license": "MIT", "optional": true, "os": [ "win32" @@ -563,6 +596,7 @@ "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "win32" @@ -575,6 +609,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/@inquirer/ansi/-/ansi-1.0.2.tgz", "integrity": "sha512-S8qNSZiYzFd0wAcyG5AXCvUHC5Sr7xpZ9wZ2py9XR88jUz8wooStVx5M6dRzczbBWjic9NP7+rY0Xi7qqK/aMQ==", + "license": "MIT", "engines": { "node": ">=18" } @@ -583,6 +618,7 @@ "version": "4.3.2", "resolved": "https://registry.npmjs.org/@inquirer/checkbox/-/checkbox-4.3.2.tgz", "integrity": "sha512-VXukHf0RR1doGe6Sm4F0Em7SWYLTHSsbGfJdS9Ja2bX5/D5uwVOEjr07cncLROdBvmnvCATYEWlHqYmXv2IlQA==", + "license": "MIT", "dependencies": { "@inquirer/ansi": "^1.0.2", "@inquirer/core": "^10.3.2", @@ -606,6 +642,7 @@ "version": "5.1.21", "resolved": "https://registry.npmjs.org/@inquirer/confirm/-/confirm-5.1.21.tgz", "integrity": "sha512-KR8edRkIsUayMXV+o3Gv+q4jlhENF9nMYUZs9PA2HzrXeHI8M5uDag70U7RJn9yyiMZSbtF5/UexBtAVtZGSbQ==", + "license": "MIT", "dependencies": { "@inquirer/core": "^10.3.2", "@inquirer/type": "^3.0.10" @@ -626,6 +663,7 @@ "version": "10.3.2", "resolved": "https://registry.npmjs.org/@inquirer/core/-/core-10.3.2.tgz", "integrity": "sha512-43RTuEbfP8MbKzedNqBrlhhNKVwoK//vUFNW3Q3vZ88BLcrs4kYpGg+B2mm5p2K/HfygoCxuKwJJiv8PbGmE0A==", + "license": "MIT", "dependencies": { "@inquirer/ansi": "^1.0.2", "@inquirer/figures": "^1.0.15", @@ -652,6 +690,7 @@ "version": "4.2.23", "resolved": "https://registry.npmjs.org/@inquirer/editor/-/editor-4.2.23.tgz", "integrity": "sha512-aLSROkEwirotxZ1pBaP8tugXRFCxW94gwrQLxXfrZsKkfjOYC1aRvAZuhpJOb5cu4IBTJdsCigUlf2iCOu4ZDQ==", + "license": "MIT", "dependencies": { "@inquirer/core": "^10.3.2", "@inquirer/external-editor": "^1.0.3", @@ -673,6 +712,7 @@ "version": "4.0.23", "resolved": "https://registry.npmjs.org/@inquirer/expand/-/expand-4.0.23.tgz", "integrity": "sha512-nRzdOyFYnpeYTTR2qFwEVmIWypzdAx/sIkCMeTNTcflFOovfqUk+HcFhQQVBftAh9gmGrpFj6QcGEqrDMDOiew==", + "license": "MIT", "dependencies": { "@inquirer/core": "^10.3.2", "@inquirer/type": "^3.0.10", @@ -694,6 +734,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/@inquirer/external-editor/-/external-editor-1.0.3.tgz", "integrity": "sha512-RWbSrDiYmO4LbejWY7ttpxczuwQyZLBUyygsA9Nsv95hpzUWwnNTVQmAq3xuh7vNwCp07UTmE5i11XAEExx4RA==", + "license": "MIT", "dependencies": { "chardet": "^2.1.1", "iconv-lite": "^0.7.0" @@ -714,6 +755,7 @@ "version": "1.0.15", "resolved": "https://registry.npmjs.org/@inquirer/figures/-/figures-1.0.15.tgz", "integrity": "sha512-t2IEY+unGHOzAaVM5Xx6DEWKeXlDDcNPeDyUpsRc6CUhBfU3VQOEl+Vssh7VNp1dR8MdUJBWhuObjXCsVpjN5g==", + "license": "MIT", "engines": { "node": ">=18" } @@ -722,6 +764,7 @@ "version": "4.3.1", "resolved": "https://registry.npmjs.org/@inquirer/input/-/input-4.3.1.tgz", "integrity": "sha512-kN0pAM4yPrLjJ1XJBjDxyfDduXOuQHrBB8aLDMueuwUGn+vNpF7Gq7TvyVxx8u4SHlFFj4trmj+a2cbpG4Jn1g==", + "license": "MIT", "dependencies": { "@inquirer/core": "^10.3.2", "@inquirer/type": "^3.0.10" @@ -742,6 +785,7 @@ "version": "3.0.23", "resolved": "https://registry.npmjs.org/@inquirer/number/-/number-3.0.23.tgz", "integrity": "sha512-5Smv0OK7K0KUzUfYUXDXQc9jrf8OHo4ktlEayFlelCjwMXz0299Y8OrI+lj7i4gCBY15UObk76q0QtxjzFcFcg==", + "license": "MIT", "dependencies": { "@inquirer/core": "^10.3.2", "@inquirer/type": "^3.0.10" @@ -762,6 +806,7 @@ "version": "4.0.23", "resolved": "https://registry.npmjs.org/@inquirer/password/-/password-4.0.23.tgz", "integrity": "sha512-zREJHjhT5vJBMZX/IUbyI9zVtVfOLiTO66MrF/3GFZYZ7T4YILW5MSkEYHceSii/KtRk+4i3RE7E1CUXA2jHcA==", + "license": "MIT", "dependencies": { "@inquirer/ansi": "^1.0.2", "@inquirer/core": "^10.3.2", @@ -783,6 +828,7 @@ "version": "7.10.1", "resolved": "https://registry.npmjs.org/@inquirer/prompts/-/prompts-7.10.1.tgz", "integrity": "sha512-Dx/y9bCQcXLI5ooQ5KyvA4FTgeo2jYj/7plWfV5Ak5wDPKQZgudKez2ixyfz7tKXzcJciTxqLeK7R9HItwiByg==", + "license": "MIT", "dependencies": { "@inquirer/checkbox": "^4.3.2", "@inquirer/confirm": "^5.1.21", @@ -811,6 +857,7 @@ "version": "4.1.11", "resolved": "https://registry.npmjs.org/@inquirer/rawlist/-/rawlist-4.1.11.tgz", "integrity": "sha512-+LLQB8XGr3I5LZN/GuAHo+GpDJegQwuPARLChlMICNdwW7OwV2izlCSCxN6cqpL0sMXmbKbFcItJgdQq5EBXTw==", + "license": "MIT", "dependencies": { "@inquirer/core": "^10.3.2", "@inquirer/type": "^3.0.10", @@ -832,6 +879,7 @@ "version": "3.2.2", "resolved": "https://registry.npmjs.org/@inquirer/search/-/search-3.2.2.tgz", "integrity": "sha512-p2bvRfENXCZdWF/U2BXvnSI9h+tuA8iNqtUKb9UWbmLYCRQxd8WkvwWvYn+3NgYaNwdUkHytJMGG4MMLucI1kA==", + "license": "MIT", "dependencies": { "@inquirer/core": "^10.3.2", "@inquirer/figures": "^1.0.15", @@ -854,6 +902,7 @@ "version": "4.4.2", "resolved": "https://registry.npmjs.org/@inquirer/select/-/select-4.4.2.tgz", "integrity": "sha512-l4xMuJo55MAe+N7Qr4rX90vypFwCajSakx59qe/tMaC1aEHWLyw68wF4o0A4SLAY4E0nd+Vt+EyskeDIqu1M6w==", + "license": "MIT", "dependencies": { "@inquirer/ansi": "^1.0.2", "@inquirer/core": "^10.3.2", @@ -877,6 +926,7 @@ "version": "3.0.10", "resolved": "https://registry.npmjs.org/@inquirer/type/-/type-3.0.10.tgz", "integrity": "sha512-BvziSRxfz5Ov8ch0z/n3oijRSEcEsHnhggm4xFZe93DHcUCTlutlq9Ox4SVENAfcRD22UQq7T/atg9Wr3k09eA==", + "license": "MIT", "engines": { "node": ">=18" }, @@ -893,6 +943,7 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz", "integrity": "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==", + "license": "ISC", "dependencies": { "minipass": "^7.0.4" }, @@ -904,6 +955,7 @@ "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "license": "MIT", "dependencies": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" @@ -916,6 +968,7 @@ "version": "2.0.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "license": "MIT", "engines": { "node": ">= 8" } @@ -924,6 +977,7 @@ "version": "1.2.8", "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "license": "MIT", "dependencies": { "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" @@ -936,6 +990,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-4.0.0.tgz", "integrity": "sha512-tlqY9xq5ukxTUZBmoOp+m61cqwQD5pHJtFY3Mn8CA8ps6yghLH/Hw8UPdqg4OLmFW3IFlcXnQNmo/dh8HzXYIQ==", + "license": "MIT", "engines": { "node": ">=18" }, @@ -947,6 +1002,7 @@ "version": "1.6.0", "resolved": "https://registry.npmjs.org/@typespec/compiler/-/compiler-1.6.0.tgz", "integrity": "sha512-yxyV+ch8tnqiuU2gClv/mQEESoFwpkjo6177UkYfV0nVA9PzTg4zVVc7+WIMZk04wiLRRT3H1uc11FB1cwLY3g==", + "license": "MIT", "dependencies": { "@babel/code-frame": "~7.27.1", "@inquirer/prompts": "^7.4.0", @@ -978,6 +1034,7 @@ "version": "7.7.3", "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", + "license": "ISC", "bin": { "semver": "bin/semver.js" }, @@ -989,6 +1046,7 @@ "version": "0.76.0", "resolved": "https://registry.npmjs.org/@typespec/events/-/events-0.76.0.tgz", "integrity": "sha512-mdjYQ5HA3Y4ZeyAEmiIDdRa9hbc/5qey5hU9UCA0gL+YWVYgoqLPbZQQTwqq3smM35+5cWp9GTGPyNHcOoRwOA==", + "license": "MIT", "engines": { "node": ">=20.0.0" }, @@ -1000,6 +1058,7 @@ "version": "1.6.0", "resolved": "https://registry.npmjs.org/@typespec/http/-/http-1.6.0.tgz", "integrity": "sha512-q/JwVw21CF4buE3ZS+xSoy2TKAOwyhZ7g3kdNqCgm69BI5p5GGu+3ZlUA+4Blk8hkt0G8XcIN8fhJP+a4O6KAw==", + "license": "MIT", "engines": { "node": ">=20.0.0" }, @@ -1015,9 +1074,9 @@ }, "node_modules/@typespec/http-client-python": { "version": "0.21.0", - "resolved": "https://registry.npmjs.org/@typespec/http-client-python/-/http-client-python-0.21.0.tgz", - "integrity": "sha512-b5JD7wieN5l6U+6ZlIIoYBRaCuY6TWsSWOWK/7DFe5poFDMFCdvydChtvkWTJhz1kQCjmlk4RL0nYk04crwMRQ==", + "resolved": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTYzNjI1My9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.21.0.tgz", "hasInstallScript": true, + "license": "MIT", "dependencies": { "js-yaml": "~4.1.0", "marked": "^15.0.6", @@ -1049,6 +1108,7 @@ "version": "1.6.0", "resolved": "https://registry.npmjs.org/@typespec/openapi/-/openapi-1.6.0.tgz", "integrity": "sha512-KuxYAzfP5ljM0PUhSGclNZgTG0H+kyTQcwn6cf4TKhO72R2QMQmiMtN2plqvzsfkL+TLwad1iZhMWTCAMFAQ4w==", + "license": "MIT", "engines": { "node": ">=20.0.0" }, @@ -1061,6 +1121,7 @@ "version": "0.76.0", "resolved": "https://registry.npmjs.org/@typespec/rest/-/rest-0.76.0.tgz", "integrity": "sha512-6jtQWdcmuKyG9cmqWsJjaq64f6N5B/1DS4X3ZoTNgYhHA27Hnsxo1HZWXcpv7Wl+MxLAZM6kgpML0ugDEZcrYQ==", + "license": "MIT", "engines": { "node": ">=20.0.0" }, @@ -1073,6 +1134,7 @@ "version": "0.76.0", "resolved": "https://registry.npmjs.org/@typespec/sse/-/sse-0.76.0.tgz", "integrity": "sha512-mCd4oAXr0Tt990T2PDjx+6H0jmPHINyCH0XRU2HrWtGW5lG/NQVIs5oOxElc7NGg629HrolfLTw0oW8hdMD7Eg==", + "license": "MIT", "engines": { "node": ">=20.0.0" }, @@ -1087,6 +1149,7 @@ "version": "0.76.0", "resolved": "https://registry.npmjs.org/@typespec/streams/-/streams-0.76.0.tgz", "integrity": "sha512-7gQPtsokyn0Mjr43MAik6ZkQt1PZjseU+KcBE2iGT9P6oWYYTH3K1C4LLGXHZAbgEtBvFn4S+U8HPbDhj4nEhw==", + "license": "MIT", "engines": { "node": ">=20.0.0" }, @@ -1098,6 +1161,7 @@ "version": "0.76.0", "resolved": "https://registry.npmjs.org/@typespec/versioning/-/versioning-0.76.0.tgz", "integrity": "sha512-dguO/B+mwlCyenWGG+M+16cMQuGHSTJbU5Z0pyUou1uyWrB1px//s4pW7PKD14S+fPutJE0wTMQm+CctOq6quA==", + "license": "MIT", "engines": { "node": ">=20.0.0" }, @@ -1109,6 +1173,7 @@ "version": "0.76.0", "resolved": "https://registry.npmjs.org/@typespec/xml/-/xml-0.76.0.tgz", "integrity": "sha512-+I7hdWZDO3qBfzRT3St+1Dg/NQAMNLz8w1OydutSnVMx0G3KWg/ESonaByszBUfdq6Z5iTtls3gvj4wgrw80gA==", + "license": "MIT", "engines": { "node": ">=20.0.0" }, @@ -1120,6 +1185,7 @@ "version": "8.17.1", "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "license": "MIT", "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", @@ -1135,6 +1201,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", "engines": { "node": ">=8" } @@ -1143,6 +1210,7 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -1156,12 +1224,14 @@ "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "license": "Python-2.0" }, "node_modules/braces": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "license": "MIT", "dependencies": { "fill-range": "^7.1.1" }, @@ -1172,17 +1242,20 @@ "node_modules/change-case": { "version": "5.4.4", "resolved": "https://registry.npmjs.org/change-case/-/change-case-5.4.4.tgz", - "integrity": "sha512-HRQyTk2/YPEkt9TnUPbOpr64Uw3KOicFWPVBb+xiHvd6eBx/qPr9xqfBFDT8P2vWsvvz4jbEkfDe71W3VyNu2w==" + "integrity": "sha512-HRQyTk2/YPEkt9TnUPbOpr64Uw3KOicFWPVBb+xiHvd6eBx/qPr9xqfBFDT8P2vWsvvz4jbEkfDe71W3VyNu2w==", + "license": "MIT" }, "node_modules/chardet": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/chardet/-/chardet-2.1.1.tgz", - "integrity": "sha512-PsezH1rqdV9VvyNhxxOW32/d75r01NY7TQCmOqomRo15ZSOKbpTFVsfjghxo6JloQUCGnH4k1LGu0R4yCLlWQQ==" + "integrity": "sha512-PsezH1rqdV9VvyNhxxOW32/d75r01NY7TQCmOqomRo15ZSOKbpTFVsfjghxo6JloQUCGnH4k1LGu0R4yCLlWQQ==", + "license": "MIT" }, "node_modules/chownr": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz", "integrity": "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==", + "license": "BlueOak-1.0.0", "engines": { "node": ">=18" } @@ -1191,6 +1264,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-4.1.0.tgz", "integrity": "sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==", + "license": "ISC", "engines": { "node": ">= 12" } @@ -1199,6 +1273,7 @@ "version": "9.0.1", "resolved": "https://registry.npmjs.org/cliui/-/cliui-9.0.1.tgz", "integrity": "sha512-k7ndgKhwoQveBL+/1tqGJYNz097I7WOvwbmmU2AR5+magtbjPWQTS1C5vzGkBC8Ym8UWRzfKUzUUqFLypY4Q+w==", + "license": "ISC", "dependencies": { "string-width": "^7.2.0", "strip-ansi": "^7.1.0", @@ -1212,6 +1287,7 @@ "version": "6.2.2", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", + "license": "MIT", "engines": { "node": ">=12" }, @@ -1223,6 +1299,7 @@ "version": "6.2.3", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", + "license": "MIT", "engines": { "node": ">=12" }, @@ -1233,12 +1310,14 @@ "node_modules/cliui/node_modules/emoji-regex": { "version": "10.6.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.6.0.tgz", - "integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==" + "integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==", + "license": "MIT" }, "node_modules/cliui/node_modules/string-width": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", + "license": "MIT", "dependencies": { "emoji-regex": "^10.3.0", "get-east-asian-width": "^1.0.0", @@ -1255,6 +1334,7 @@ "version": "7.1.2", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", + "license": "MIT", "dependencies": { "ansi-regex": "^6.0.1" }, @@ -1269,6 +1349,7 @@ "version": "9.0.2", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.2.tgz", "integrity": "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==", + "license": "MIT", "dependencies": { "ansi-styles": "^6.2.1", "string-width": "^7.0.0", @@ -1285,6 +1366,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -1295,17 +1377,20 @@ "node_modules/color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "license": "MIT" }, "node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" }, "node_modules/env-paths": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-3.0.0.tgz", "integrity": "sha512-dtJUTepzMW3Lm/NPxRf3wP4642UWhjL2sQxc+ym2YMj1m/H2zDNQOlezafzkHwn6sMstjHTwG6iQQsctDW/b1A==", + "license": "MIT", "engines": { "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, @@ -1318,6 +1403,7 @@ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz", "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==", "hasInstallScript": true, + "license": "MIT", "bin": { "esbuild": "bin/esbuild" }, @@ -1357,6 +1443,7 @@ "version": "3.2.0", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "license": "MIT", "engines": { "node": ">=6" } @@ -1364,12 +1451,14 @@ "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "license": "MIT" }, "node_modules/fast-glob": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "license": "MIT", "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", @@ -1394,12 +1483,14 @@ "type": "opencollective", "url": "https://opencollective.com/fastify" } - ] + ], + "license": "BSD-3-Clause" }, "node_modules/fastq": { "version": "1.19.1", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz", "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", + "license": "ISC", "dependencies": { "reusify": "^1.0.4" } @@ -1408,6 +1499,7 @@ "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "license": "MIT", "dependencies": { "to-regex-range": "^5.0.1" }, @@ -1419,6 +1511,7 @@ "version": "11.2.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz", "integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==", + "license": "MIT", "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", @@ -1433,6 +1526,7 @@ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", "hasInstallScript": true, + "license": "MIT", "optional": true, "os": [ "darwin" @@ -1445,6 +1539,7 @@ "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "license": "ISC", "engines": { "node": "6.* || 8.* || >= 10.*" } @@ -1453,6 +1548,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.4.0.tgz", "integrity": "sha512-QZjmEOC+IT1uk6Rx0sX22V6uHWVwbdbxf1faPqJ1QhLdGgsRGCZoyaQBm/piRdJy/D2um6hM1UP7ZEeQ4EkP+Q==", + "license": "MIT", "engines": { "node": ">=18" }, @@ -1464,6 +1560,7 @@ "version": "4.13.0", "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.13.0.tgz", "integrity": "sha512-1VKTZJCwBrvbd+Wn3AOgQP/2Av+TfTCOlE4AcRJE72W1ksZXbAx8PPBR9RzgTeSPzlPMHrbANMH3LbltH73wxQ==", + "license": "MIT", "dependencies": { "resolve-pkg-maps": "^1.0.0" }, @@ -1475,6 +1572,7 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "license": "ISC", "dependencies": { "is-glob": "^4.0.1" }, @@ -1486,6 +1584,7 @@ "version": "15.0.0", "resolved": "https://registry.npmjs.org/globby/-/globby-15.0.0.tgz", "integrity": "sha512-oB4vkQGqlMl682wL1IlWd02tXCbquGWM4voPEI85QmNKCaw8zGTm1f1rubFgkg3Eli2PtKlFgrnmUqasbQWlkw==", + "license": "MIT", "dependencies": { "@sindresorhus/merge-streams": "^4.0.0", "fast-glob": "^3.3.3", @@ -1504,12 +1603,14 @@ "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "license": "ISC" }, "node_modules/iconv-lite": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.0.tgz", "integrity": "sha512-cf6L2Ds3h57VVmkZe+Pn+5APsT7FpqJtEhhieDCvrE2MK5Qk9MyffgQyuxQTm6BChfeZNtcOLHp9IcWRVcIcBQ==", + "license": "MIT", "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" }, @@ -1525,6 +1626,7 @@ "version": "7.0.5", "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", + "license": "MIT", "engines": { "node": ">= 4" } @@ -1533,6 +1635,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -1541,6 +1644,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", "engines": { "node": ">=8" } @@ -1549,6 +1653,7 @@ "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "license": "MIT", "dependencies": { "is-extglob": "^2.1.1" }, @@ -1560,6 +1665,7 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "license": "MIT", "engines": { "node": ">=0.12.0" } @@ -1568,6 +1674,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-2.1.0.tgz", "integrity": "sha512-mE00Gnza5EEB3Ds0HfMyllZzbBrmLOX3vfWoj9A9PEnTfratQ/BcaJOuMhnkhjXvb2+FkY3VuHqtAGpTPmglFQ==", + "license": "MIT", "engines": { "node": ">=18" }, @@ -1578,12 +1685,14 @@ "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "license": "MIT" }, "node_modules/js-yaml": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", + "license": "MIT", "dependencies": { "argparse": "^2.0.1" }, @@ -1594,12 +1703,14 @@ "node_modules/json-schema-traverse": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "license": "MIT" }, "node_modules/jsonfile": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz", "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", + "license": "MIT", "dependencies": { "universalify": "^2.0.0" }, @@ -1611,6 +1722,7 @@ "version": "15.0.12", "resolved": "https://registry.npmjs.org/marked/-/marked-15.0.12.tgz", "integrity": "sha512-8dD6FusOQSrpv9Z1rdNMdlSgQOIP880DHqnohobOmYLElGEqAL/JvxvuxZO16r4HtjTlfPRDC1hbvxC9dPN2nA==", + "license": "MIT", "bin": { "marked": "bin/marked.js" }, @@ -1622,6 +1734,7 @@ "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "license": "MIT", "engines": { "node": ">= 8" } @@ -1630,6 +1743,7 @@ "version": "4.0.8", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "license": "MIT", "dependencies": { "braces": "^3.0.3", "picomatch": "^2.3.1" @@ -1642,6 +1756,7 @@ "version": "7.1.2", "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", + "license": "ISC", "engines": { "node": ">=16 || 14 >=14.17" } @@ -1650,6 +1765,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.1.0.tgz", "integrity": "sha512-KZxYo1BUkWD2TVFLr0MQoM8vUUigWD3LlD83a/75BqC+4qE0Hb1Vo5v1FgcfaNXvfXzr+5EhQ6ing/CaBijTlw==", + "license": "MIT", "dependencies": { "minipass": "^7.1.2" }, @@ -1661,6 +1777,7 @@ "version": "4.2.0", "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz", "integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==", + "license": "MIT", "bin": { "mustache": "bin/mustache" } @@ -1669,6 +1786,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-2.0.0.tgz", "integrity": "sha512-WWdIxpyjEn+FhQJQQv9aQAYlHoNVdzIzUySNV1gHUPDSdZJ3yZn7pAAbQcV7B56Mvu881q9FZV+0Vx2xC44VWA==", + "license": "ISC", "engines": { "node": "^18.17.0 || >=20.5.0" } @@ -1677,6 +1795,7 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-6.0.0.tgz", "integrity": "sha512-Vj7sf++t5pBD637NSfkxpHSMfWaeig5+DKWLhcqIYx6mWQz5hdJTGDVMQiJcw1ZYkhs7AazKDGpRVji1LJCZUQ==", + "license": "MIT", "engines": { "node": ">=18" }, @@ -1687,12 +1806,14 @@ "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", - "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==" + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "license": "ISC" }, "node_modules/picomatch": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "license": "MIT", "engines": { "node": ">=8.6" }, @@ -1704,6 +1825,7 @@ "version": "8.0.0", "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", + "license": "MIT", "engines": { "node": ">=4" } @@ -1712,6 +1834,7 @@ "version": "3.6.2", "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.6.2.tgz", "integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==", + "license": "MIT", "bin": { "prettier": "bin/prettier.cjs" }, @@ -1726,6 +1849,7 @@ "version": "0.26.2", "resolved": "https://registry.npmjs.org/pyodide/-/pyodide-0.26.2.tgz", "integrity": "sha512-8VCRdFX83gBsWs6XP2rhG8HMaB+JaVyyav4q/EMzoV8fXH8HN6T5IISC92SNma6i1DRA3SVXA61S1rJcB8efgA==", + "license": "Apache-2.0", "dependencies": { "ws": "^8.5.0" }, @@ -1750,12 +1874,14 @@ "type": "consulting", "url": "https://feross.org/support" } - ] + ], + "license": "MIT" }, "node_modules/require-from-string": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -1764,6 +1890,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "license": "MIT", "funding": { "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" } @@ -1772,6 +1899,7 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "license": "MIT", "engines": { "iojs": ">=1.0.0", "node": ">=0.10.0" @@ -1795,6 +1923,7 @@ "url": "https://feross.org/support" } ], + "license": "MIT", "dependencies": { "queue-microtask": "^1.2.2" } @@ -1802,12 +1931,14 @@ "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" }, "node_modules/semver": { "version": "7.6.3", "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "license": "ISC", "bin": { "semver": "bin/semver.js" }, @@ -1819,6 +1950,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "license": "ISC", "engines": { "node": ">=14" }, @@ -1830,6 +1962,7 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", + "license": "MIT", "engines": { "node": ">=14.16" }, @@ -1841,6 +1974,7 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -1854,6 +1988,7 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" }, @@ -1865,6 +2000,7 @@ "version": "7.5.2", "resolved": "https://registry.npmjs.org/tar/-/tar-7.5.2.tgz", "integrity": "sha512-7NyxrTE4Anh8km8iEy7o0QYPs+0JKBTj5ZaqHg6B39erLg0qYXN3BijtShwbsNSvQ+LN75+KV+C4QR/f6Gwnpg==", + "license": "BlueOak-1.0.0", "dependencies": { "@isaacs/fs-minipass": "^4.0.0", "chownr": "^3.0.0", @@ -1880,6 +2016,7 @@ "version": "0.3.0", "resolved": "https://registry.npmjs.org/temporal-polyfill/-/temporal-polyfill-0.3.0.tgz", "integrity": "sha512-qNsTkX9K8hi+FHDfHmf22e/OGuXmfBm9RqNismxBrnSmZVJKegQ+HYYXT+R7Ha8F/YSm2Y34vmzD4cxMu2u95g==", + "license": "MIT", "dependencies": { "temporal-spec": "0.3.0" } @@ -1887,12 +2024,14 @@ "node_modules/temporal-spec": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/temporal-spec/-/temporal-spec-0.3.0.tgz", - "integrity": "sha512-n+noVpIqz4hYgFSMOSiINNOUOMFtV5cZQNCmmszA6GiVFVRt3G7AqVyhXjhCSmowvQn+NsGn+jMDMKJYHd3bSQ==" + "integrity": "sha512-n+noVpIqz4hYgFSMOSiINNOUOMFtV5cZQNCmmszA6GiVFVRt3G7AqVyhXjhCSmowvQn+NsGn+jMDMKJYHd3bSQ==", + "license": "ISC" }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "license": "MIT", "dependencies": { "is-number": "^7.0.0" }, @@ -1904,6 +2043,7 @@ "version": "4.19.4", "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.19.4.tgz", "integrity": "sha512-gK5GVzDkJK1SI1zwHf32Mqxf2tSJkNx+eYcNly5+nHvWqXUJYUkWBQtKauoESz3ymezAI++ZwT855x5p5eop+Q==", + "license": "MIT", "dependencies": { "esbuild": "~0.25.0", "get-tsconfig": "^4.7.5" @@ -1922,6 +2062,7 @@ "version": "0.3.0", "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.3.0.tgz", "integrity": "sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA==", + "license": "MIT", "engines": { "node": ">=18" }, @@ -1933,6 +2074,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "license": "MIT", "engines": { "node": ">= 10.0.0" } @@ -1941,6 +2083,7 @@ "version": "8.2.0", "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.0.tgz", "integrity": "sha512-C+r0eKJUIfiDIfwJhria30+TYWPtuHJXHtI7J0YlOmKAo7ogxP20T0zxB7HZQIFhIyvoBPwWskjxrvAtfjyZfA==", + "license": "MIT", "engines": { "node": ">=14.0.0" } @@ -1949,6 +2092,7 @@ "version": "9.0.1", "resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-9.0.1.tgz", "integrity": "sha512-woByF3PDpkHFUreUa7Hos7+pUWdeWMXRd26+ZX2A8cFx6v/JPTtd4/uN0/jB6XQHYaOlHbio03NTHCqrgG5n7g==", + "license": "MIT", "dependencies": { "vscode-languageserver-protocol": "3.17.5" }, @@ -1960,6 +2104,7 @@ "version": "3.17.5", "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.5.tgz", "integrity": "sha512-mb1bvRJN8SVznADSGWM9u/b07H7Ecg0I3OgXDuLdn307rl/J3A9YD6/eYOssqhecL27hK1IPZAsaqh00i/Jljg==", + "license": "MIT", "dependencies": { "vscode-jsonrpc": "8.2.0", "vscode-languageserver-types": "3.17.5" @@ -1968,17 +2113,20 @@ "node_modules/vscode-languageserver-textdocument": { "version": "1.0.12", "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.12.tgz", - "integrity": "sha512-cxWNPesCnQCcMPeenjKKsOCKQZ/L6Tv19DTRIGuLWe32lyzWhihGVJ/rcckZXJxfdKCFvRLS3fpBIsV/ZGX4zA==" + "integrity": "sha512-cxWNPesCnQCcMPeenjKKsOCKQZ/L6Tv19DTRIGuLWe32lyzWhihGVJ/rcckZXJxfdKCFvRLS3fpBIsV/ZGX4zA==", + "license": "MIT" }, "node_modules/vscode-languageserver-types": { "version": "3.17.5", "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.5.tgz", - "integrity": "sha512-Ld1VelNuX9pdF39h2Hgaeb5hEZM2Z3jUrrMgWQAu82jMtZp7p3vJT3BzToKtZI7NgQssZje5o0zryOrhQvzQAg==" + "integrity": "sha512-Ld1VelNuX9pdF39h2Hgaeb5hEZM2Z3jUrrMgWQAu82jMtZp7p3vJT3BzToKtZI7NgQssZje5o0zryOrhQvzQAg==", + "license": "MIT" }, "node_modules/wrap-ansi": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "license": "MIT", "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -1992,6 +2140,7 @@ "version": "8.18.3", "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz", "integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==", + "license": "MIT", "engines": { "node": ">=10.0.0" }, @@ -2012,6 +2161,7 @@ "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "license": "ISC", "engines": { "node": ">=10" } @@ -2020,6 +2170,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz", "integrity": "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==", + "license": "BlueOak-1.0.0", "engines": { "node": ">=18" } @@ -2028,6 +2179,7 @@ "version": "2.8.2", "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.2.tgz", "integrity": "sha512-mplynKqc1C2hTVYxd0PU2xQAc22TI1vShAYGksCCfxbn/dFwnHTNi1bvYsBTkhdUNtGIf5xNOg938rrSSYvS9A==", + "license": "ISC", "bin": { "yaml": "bin.mjs" }, @@ -2042,6 +2194,7 @@ "version": "18.0.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-18.0.0.tgz", "integrity": "sha512-4UEqdc2RYGHZc7Doyqkrqiln3p9X2DZVxaGbwhn2pi7MrRagKaOcIKe8L3OxYcbhXLgLFUS3zAYuQjKBQgmuNg==", + "license": "MIT", "dependencies": { "cliui": "^9.0.1", "escalade": "^3.1.1", @@ -2058,6 +2211,7 @@ "version": "22.0.0", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-22.0.0.tgz", "integrity": "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==", + "license": "ISC", "engines": { "node": "^20.19.0 || ^22.12.0 || >=23" } @@ -2066,6 +2220,7 @@ "version": "6.2.2", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", + "license": "MIT", "engines": { "node": ">=12" }, @@ -2076,12 +2231,14 @@ "node_modules/yargs/node_modules/emoji-regex": { "version": "10.6.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.6.0.tgz", - "integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==" + "integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==", + "license": "MIT" }, "node_modules/yargs/node_modules/string-width": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", + "license": "MIT", "dependencies": { "emoji-regex": "^10.3.0", "get-east-asian-width": "^1.0.0", @@ -2098,6 +2255,7 @@ "version": "7.1.2", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", + "license": "MIT", "dependencies": { "ansi-regex": "^6.0.1" }, @@ -2112,6 +2270,7 @@ "version": "2.1.3", "resolved": "https://registry.npmjs.org/yoctocolors-cjs/-/yoctocolors-cjs-2.1.3.tgz", "integrity": "sha512-U/PBtDf35ff0D8X8D0jfdzHYEPFxAI7jJlxZXwCSez5M3190m+QobIfh+sWDWSHMCWWJN2AWamkegn6vr6YBTw==", + "license": "MIT", "engines": { "node": ">=18" }, diff --git a/eng/emitter-package.json b/eng/emitter-package.json index e9f09aeb6459..95992e3fd093 100644 --- a/eng/emitter-package.json +++ b/eng/emitter-package.json @@ -1,7 +1,7 @@ { "name": "dist/src/index.js", "dependencies": { - "@azure-tools/typespec-python": "0.54.0" + "@azure-tools/typespec-python": "C:/dev/autorest.python/packages/typespec-python/azure-tools-typespec-python-0.53.3.tgz" }, "devDependencies": { "@typespec/compiler": "^1.6.0", diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_utils/model_base.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_utils/model_base.py index 12926fa98dcf..d883c1d0b855 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_utils/model_base.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_utils/model_base.py @@ -638,6 +638,10 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: if not rf._rest_name_input: rf._rest_name_input = attr cls._attr_to_rest_field: dict[str, _RestField] = dict(attr_to_rest_field.items()) + cls._backcompat_attr_to_rest_field: dict[str, _RestField] = { + Model._get_backcompat_attribute_name(cls._attr_to_rest_field, attr): rf + for attr, rf in cls._attr_to_rest_field.items() + } cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") return super().__new__(cls) @@ -647,6 +651,16 @@ def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: if hasattr(base, "__mapping__"): base.__mapping__[discriminator or cls.__name__] = cls # type: ignore + @classmethod + def _get_backcompat_attribute_name(cls, attr_to_rest_field: dict[str, "_RestField"], attr_name: str) -> str: + rest_field_obj = attr_to_rest_field.get(attr_name) # pylint: disable=protected-access + if rest_field_obj is None: + return attr_name + original_tsp_name = getattr(rest_field_obj, "_original_tsp_name", None) # pylint: disable=protected-access + if original_tsp_name: + return original_tsp_name + return attr_name + @classmethod def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: for v in cls.__dict__.values(): @@ -972,6 +986,7 @@ def _failsafe_deserialize_xml( return None +# pylint: disable=too-many-instance-attributes class _RestField: def __init__( self, @@ -984,6 +999,7 @@ def __init__( format: typing.Optional[str] = None, is_multipart_file_input: bool = False, xml: typing.Optional[dict[str, typing.Any]] = None, + original_tsp_name: typing.Optional[str] = None, ): self._type = type self._rest_name_input = name @@ -995,10 +1011,15 @@ def __init__( self._format = format self._is_multipart_file_input = is_multipart_file_input self._xml = xml if xml is not None else {} + self._original_tsp_name = original_tsp_name @property def _class_type(self) -> typing.Any: - return getattr(self._type, "args", [None])[0] + result = getattr(self._type, "args", [None])[0] + # type may be wrapped by nested functools.partial so we need to check for that + if isinstance(result, functools.partial): + return getattr(result, "args", [None])[0] + return result @property def _rest_name(self) -> str: @@ -1046,6 +1067,7 @@ def rest_field( format: typing.Optional[str] = None, is_multipart_file_input: bool = False, xml: typing.Optional[dict[str, typing.Any]] = None, + original_tsp_name: typing.Optional[str] = None, ) -> typing.Any: return _RestField( name=name, @@ -1055,6 +1077,7 @@ def rest_field( format=format, is_multipart_file_input=is_multipart_file_input, xml=xml, + original_tsp_name=original_tsp_name, ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_models.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_models.py index 9e77545fd692..c31f41ca7c30 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_models.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_models.py @@ -2754,7 +2754,7 @@ class Permissions(_Model): """ keys_property: Optional[list[Union[str, "_models.KeyPermissions"]]] = rest_field( - name="keys", visibility=["read", "create", "update", "delete", "query"] + name="keys", visibility=["read", "create", "update", "delete", "query"], original_tsp_name="keys" ) """Permissions to keys.""" secrets: Optional[list[Union[str, "_models.SecretPermissions"]]] = rest_field( diff --git a/sdk/keyvault/azure-mgmt-keyvault/tests/test_unittest.py b/sdk/keyvault/azure-mgmt-keyvault/tests/test_unittest.py index a9601bc4ba44..38dd51c99310 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/tests/test_unittest.py +++ b/sdk/keyvault/azure-mgmt-keyvault/tests/test_unittest.py @@ -22,29 +22,33 @@ def test_model_initialization(): def test_model_attribute_list_for_compatibility(): - expected_attributes = sorted([ - "id", - "name", - "type", - "system_data", - "attributes", - "kty", - "key_ops", - "key_size", - "curve_name", - "key_uri", - "key_uri_with_version", - "rotation_policy", - "release_policy", - "location", - "tags", - ]) + expected_attributes = sorted( + [ + "id", + "name", + "type", + "system_data", + "attributes", + "kty", + "key_ops", + "key_size", + "curve_name", + "key_uri", + "key_uri_with_version", + "rotation_policy", + "release_policy", + "location", + "tags", + ] + ) assert expected_attributes == sorted(attribute_list(Key(properties=KeyProperties(kty="RSA")))) assert expected_attributes == sorted(attribute_list(Key(kty="RSA"))) assert expected_attributes == sorted(attribute_list(Key())) + def test_private_link_resource_initialization(): - plr = PrivateLinkResource(group_id="vault", required_members=["member1", "member2"], required_zone_names=["zone1", "zone2"]) + plr = PrivateLinkResource( + group_id="vault", required_members=["member1", "member2"], required_zone_names=["zone1", "zone2"] + ) assert plr.group_id == "vault" assert plr.properties.group_id == "vault" - \ No newline at end of file From 64b9edaf4a432f0d11379874dcb57e7c6246be2a Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Wed, 10 Dec 2025 09:50:26 +0000 Subject: [PATCH 30/34] Configurations: 'specification/keyvault/KeyVault.Management/tspconfig.yaml', API Version: 2025-05-01, SDK Release Type: stable, and CommitSHA: 'cd9e490ce205294e81539af5b5d8dfa4da1d5240' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5655092 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md | 58 +++++++++++++++++++ .../azure-mgmt-keyvault/_metadata.json | 6 +- .../keyvault/aio/operations/_operations.py | 8 +-- .../mgmt/keyvault/operations/_operations.py | 8 +-- .../azure-mgmt-keyvault/pyproject.toml | 41 +++++++------ .../azure-mgmt-keyvault/tsp-location.yaml | 2 +- 6 files changed, 92 insertions(+), 31 deletions(-) diff --git a/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md b/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md index 037b97b2987f..9dbd219f43d9 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md +++ b/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md @@ -1,5 +1,63 @@ # Release History +## 13.0.0 (2025-12-10) + +### Features Added + + - Client `KeyVaultManagementClient` added method `send_request` + - Model `DeletedManagedHsm` added property `system_data` + - Model `DeletedVault` added property `system_data` + - Model `Key` added property `properties` + - Model `Key` added property `system_data` + - Model `MHSMPrivateEndpointConnectionItem` added property `properties` + - Model `ManagedHsmKey` added property `properties` + - Model `ManagedHsmKey` added property `system_data` + - Model `Operation` added property `operation_properties` + - Model `Permissions` added property `keys_property` + - Model `PrivateEndpointConnection` added property `system_data` + - Model `PrivateEndpointConnectionItem` added property `properties` + - Model `PrivateLinkResource` added property `system_data` + - Model `Secret` added property `system_data` + - Model `VaultCheckNameAvailabilityParameters` added property `type` + - Added model `ArmResource` + - Added model `CloudError` + - Added enum `CreatedByType` + - Added model `OperationProperties` + - Added model `ProxyResource` + - Added model `TrackedResource` + +### Breaking Changes + + - Model `Key` deleted or renamed its instance variable `attributes` + - Model `Key` deleted or renamed its instance variable `kty` + - Model `Key` deleted or renamed its instance variable `key_ops` + - Model `Key` deleted or renamed its instance variable `key_size` + - Model `Key` deleted or renamed its instance variable `curve_name` + - Model `Key` deleted or renamed its instance variable `key_uri` + - Model `Key` deleted or renamed its instance variable `key_uri_with_version` + - Model `Key` deleted or renamed its instance variable `rotation_policy` + - Model `Key` deleted or renamed its instance variable `release_policy` + - Model `MHSMPrivateEndpointConnectionItem` deleted or renamed its instance variable `private_endpoint` + - Model `MHSMPrivateEndpointConnectionItem` deleted or renamed its instance variable `private_link_service_connection_state` + - Model `MHSMPrivateEndpointConnectionItem` deleted or renamed its instance variable `provisioning_state` + - Model `ManagedHsmKey` deleted or renamed its instance variable `attributes` + - Model `ManagedHsmKey` deleted or renamed its instance variable `kty` + - Model `ManagedHsmKey` deleted or renamed its instance variable `key_ops` + - Model `ManagedHsmKey` deleted or renamed its instance variable `key_size` + - Model `ManagedHsmKey` deleted or renamed its instance variable `curve_name` + - Model `ManagedHsmKey` deleted or renamed its instance variable `key_uri` + - Model `ManagedHsmKey` deleted or renamed its instance variable `key_uri_with_version` + - Model `ManagedHsmKey` deleted or renamed its instance variable `rotation_policy` + - Model `ManagedHsmKey` deleted or renamed its instance variable `release_policy` + - Model `Operation` deleted or renamed its instance variable `service_specification` + - Model `Permissions` deleted or renamed its instance variable `keys` + - Model `PrivateEndpointConnectionItem` deleted or renamed its instance variable `private_endpoint` + - Model `PrivateEndpointConnectionItem` deleted or renamed its instance variable `private_link_service_connection_state` + - Model `PrivateEndpointConnectionItem` deleted or renamed its instance variable `provisioning_state` + - Deleted or renamed model `IdentityType` + - Deleted or renamed model `ProxyResourceWithoutSystemData` + - Deleted or renamed model `Resource` + ## 13.0.0 (2025-10-21) ### Features Added diff --git a/sdk/keyvault/azure-mgmt-keyvault/_metadata.json b/sdk/keyvault/azure-mgmt-keyvault/_metadata.json index 62fce0541477..84b8d37effa4 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/_metadata.json +++ b/sdk/keyvault/azure-mgmt-keyvault/_metadata.json @@ -1,3 +1,7 @@ { - "apiVersion": "2025-05-01" + "apiVersion": "2025-05-01", + "commit": "cd9e490ce205294e81539af5b5d8dfa4da1d5240", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "typespec_src": "specification/keyvault/KeyVault.Management", + "emitterVersion": "0.55.0" } \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py index 323fc38551c9..73e6a82432c9 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py @@ -1444,7 +1444,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) @@ -3652,17 +3652,13 @@ async def create_or_update( ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - if _stream: deserialized = response.iter_bytes() else: deserialized = _deserialize(_models.Secret, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py index 5698377f14e5..badf2081bb03 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py @@ -2790,7 +2790,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) @@ -4996,17 +4996,13 @@ def create_or_update( ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - if _stream: deserialized = response.iter_bytes() else: deserialized = _deserialize(_models.Secret, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/pyproject.toml b/sdk/keyvault/azure-mgmt-keyvault/pyproject.toml index 334c1722206b..53df278bd915 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/pyproject.toml +++ b/sdk/keyvault/azure-mgmt-keyvault/pyproject.toml @@ -1,23 +1,19 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - [build-system] -requires = ["setuptools>=77.0.3", "wheel"] +requires = [ + "setuptools>=77.0.3", + "wheel", +] build-backend = "setuptools.build_meta" [project] name = "azure-mgmt-keyvault" authors = [ - { name = "Microsoft Corporation", email = "azpysdkhelp@microsoft.com" }, + { name = "Microsoft Corporation", email = "azpysdkhelp@microsoft.com" }, ] description = "Microsoft Azure Keyvault Management Client Library for Python" license = "MIT" classifiers = [ - "Development Status :: 4 - Beta", + "Development Status :: 5 - Production/Stable", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", @@ -28,23 +24,32 @@ classifiers = [ "Programming Language :: Python :: 3.13", ] requires-python = ">=3.9" -keywords = ["azure", "azure sdk"] - +keywords = [ + "azure", + "azure sdk", +] dependencies = [ "isodate>=0.6.1", "azure-mgmt-core>=1.6.0", "typing-extensions>=4.6.0", ] dynamic = [ -"version", "readme" + "version", + "readme", ] [project.urls] repository = "https://github.com/Azure/azure-sdk-for-python" -[tool.setuptools.dynamic] -version = {attr = "azure.mgmt.keyvault._version.VERSION"} -readme = {file = ["README.md", "CHANGELOG.md"], content-type = "text/markdown"} +[tool.setuptools.dynamic.version] +attr = "azure.mgmt.keyvault._version.VERSION" + +[tool.setuptools.dynamic.readme] +file = [ + "README.md", + "CHANGELOG.md", +] +content-type = "text/markdown" [tool.setuptools.packages.find] exclude = [ @@ -58,7 +63,9 @@ exclude = [ ] [tool.setuptools.package-data] -pytyped = ["py.typed"] +pytyped = [ + "py.typed", +] [tool.azure-sdk-build] breaking = false diff --git a/sdk/keyvault/azure-mgmt-keyvault/tsp-location.yaml b/sdk/keyvault/azure-mgmt-keyvault/tsp-location.yaml index c528e8d3103f..ce32c433a482 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/tsp-location.yaml +++ b/sdk/keyvault/azure-mgmt-keyvault/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/keyvault/KeyVault.Management -commit: 08a510e768ebd24b415dd642416cf955b70c4069 +commit: cd9e490ce205294e81539af5b5d8dfa4da1d5240 repo: Azure/azure-rest-api-specs additionalDirectories: From 5c31833e44c1ed3f6fe21b26a7689c4af60b10ca Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Thu, 11 Dec 2025 10:17:25 +0800 Subject: [PATCH 31/34] Update CHANGELOG.md --- sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md | 94 ------------------- 1 file changed, 94 deletions(-) diff --git a/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md b/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md index 9dbd219f43d9..4a419dd0e25a 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md +++ b/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md @@ -1,99 +1,5 @@ # Release History -## 13.0.0 (2025-12-10) - -### Features Added - - - Client `KeyVaultManagementClient` added method `send_request` - - Model `DeletedManagedHsm` added property `system_data` - - Model `DeletedVault` added property `system_data` - - Model `Key` added property `properties` - - Model `Key` added property `system_data` - - Model `MHSMPrivateEndpointConnectionItem` added property `properties` - - Model `ManagedHsmKey` added property `properties` - - Model `ManagedHsmKey` added property `system_data` - - Model `Operation` added property `operation_properties` - - Model `Permissions` added property `keys_property` - - Model `PrivateEndpointConnection` added property `system_data` - - Model `PrivateEndpointConnectionItem` added property `properties` - - Model `PrivateLinkResource` added property `system_data` - - Model `Secret` added property `system_data` - - Model `VaultCheckNameAvailabilityParameters` added property `type` - - Added model `ArmResource` - - Added model `CloudError` - - Added enum `CreatedByType` - - Added model `OperationProperties` - - Added model `ProxyResource` - - Added model `TrackedResource` - -### Breaking Changes - - - Model `Key` deleted or renamed its instance variable `attributes` - - Model `Key` deleted or renamed its instance variable `kty` - - Model `Key` deleted or renamed its instance variable `key_ops` - - Model `Key` deleted or renamed its instance variable `key_size` - - Model `Key` deleted or renamed its instance variable `curve_name` - - Model `Key` deleted or renamed its instance variable `key_uri` - - Model `Key` deleted or renamed its instance variable `key_uri_with_version` - - Model `Key` deleted or renamed its instance variable `rotation_policy` - - Model `Key` deleted or renamed its instance variable `release_policy` - - Model `MHSMPrivateEndpointConnectionItem` deleted or renamed its instance variable `private_endpoint` - - Model `MHSMPrivateEndpointConnectionItem` deleted or renamed its instance variable `private_link_service_connection_state` - - Model `MHSMPrivateEndpointConnectionItem` deleted or renamed its instance variable `provisioning_state` - - Model `ManagedHsmKey` deleted or renamed its instance variable `attributes` - - Model `ManagedHsmKey` deleted or renamed its instance variable `kty` - - Model `ManagedHsmKey` deleted or renamed its instance variable `key_ops` - - Model `ManagedHsmKey` deleted or renamed its instance variable `key_size` - - Model `ManagedHsmKey` deleted or renamed its instance variable `curve_name` - - Model `ManagedHsmKey` deleted or renamed its instance variable `key_uri` - - Model `ManagedHsmKey` deleted or renamed its instance variable `key_uri_with_version` - - Model `ManagedHsmKey` deleted or renamed its instance variable `rotation_policy` - - Model `ManagedHsmKey` deleted or renamed its instance variable `release_policy` - - Model `Operation` deleted or renamed its instance variable `service_specification` - - Model `Permissions` deleted or renamed its instance variable `keys` - - Model `PrivateEndpointConnectionItem` deleted or renamed its instance variable `private_endpoint` - - Model `PrivateEndpointConnectionItem` deleted or renamed its instance variable `private_link_service_connection_state` - - Model `PrivateEndpointConnectionItem` deleted or renamed its instance variable `provisioning_state` - - Deleted or renamed model `IdentityType` - - Deleted or renamed model `ProxyResourceWithoutSystemData` - - Deleted or renamed model `Resource` - -## 13.0.0 (2025-10-21) - -### Features Added - - - Client `KeyVaultManagementClient` added method `send_request` - - Model `DeletedManagedHsm` added property `system_data` - - Model `DeletedVault` added property `system_data` - - Model `Key` added property `properties` - - Model `Key` added property `system_data` - - Model `MHSMPrivateEndpointConnectionItem` added property `properties` - - Model `ManagedHsmKey` added property `properties` - - Model `ManagedHsmKey` added property `system_data` - - Model `Operation` added property `operation_properties` - - Model `PrivateEndpointConnection` added property `system_data` - - Model `PrivateEndpointConnectionItem` added property `properties` - - Model `PrivateLinkResource` added property `system_data` - - Model `Secret` added property `system_data` - - Model `VaultCheckNameAvailabilityParameters` added property `type` - - Added model `ArmResource` - - Added model `CloudError` - - Added enum `CreatedByType` - - Added model `OperationProperties` - - Added model `ProxyResource` - - Added model `TrackedResource` - -### Breaking Changes - - - Model `Key` instance variables `attributes`, `kty`, `key_ops`, `key_size`, `curve_name`, `key_uri`, `key_uri_with_version`, `rotation_policy`, and `release_policy` have been moved under property `properties` - - Model `MHSMPrivateEndpointConnectionItem` instance variables `private_endpoint`, `private_link_service_connection_state`, and `provisioning_state` have been moved under property `properties` - - Model `ManagedHsmKey` instance variables `attributes`, `kty`, `key_ops`, `key_size`, `curve_name`, `key_uri`, `key_uri_with_version`, `rotation_policy`, and `release_policy` have been moved under property `properties` - - Model `Operation` instance variable `service_specification` has been moved under property `operation_properties` - - Model `Permissions` renamed instance variable `keys` to `keys_property` - - Model `PrivateEndpointConnectionItem` instance variables `private_endpoint`, `private_link_service_connection_state`, and `provisioning_state` have been moved under property `properties` - - Deleted or renamed model `ProxyResourceWithoutSystemData` - - Deleted or renamed model `Resource` - ## 12.1.1 (2025-10-09) ### Bugs Fixed From 6feb1d52b39dc1bb475cf5b93227a0ccabfed2d2 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Thu, 11 Dec 2025 02:27:39 +0000 Subject: [PATCH 32/34] Configurations: 'specification/keyvault/KeyVault.Management/tspconfig.yaml', API Version: 2025-05-01, SDK Release Type: stable, and CommitSHA: '74db5e79837425a7723e81bca0b7576ab725c186' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5658478 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md | 57 ++++++++++++++ .../azure-mgmt-keyvault/_metadata.json | 2 +- .../apiview-properties.json | 4 +- .../azure/mgmt/keyvault/models/__init__.py | 8 +- .../azure/mgmt/keyvault/models/_enums.py | 26 +++---- .../azure/mgmt/keyvault/models/_models.py | 76 +++++++++---------- .../azure-mgmt-keyvault/tsp-location.yaml | 2 +- 7 files changed, 116 insertions(+), 59 deletions(-) diff --git a/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md b/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md index 4a419dd0e25a..07471518b516 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md +++ b/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md @@ -1,5 +1,62 @@ # Release History +## 13.0.0 (2025-12-11) + +### Features Added + + - Client `KeyVaultManagementClient` added method `send_request` + - Model `DeletedManagedHsm` added property `system_data` + - Model `DeletedVault` added property `system_data` + - Model `Key` added property `properties` + - Model `Key` added property `system_data` + - Model `MHSMPrivateEndpointConnectionItem` added property `properties` + - Model `ManagedHsmKey` added property `properties` + - Model `ManagedHsmKey` added property `system_data` + - Model `Operation` added property `operation_properties` + - Model `Permissions` added property `keys_property` + - Model `PrivateEndpointConnection` added property `system_data` + - Model `PrivateEndpointConnectionItem` added property `properties` + - Model `PrivateLinkResource` added property `system_data` + - Model `Resource` added property `system_data` + - Model `Secret` added property `system_data` + - Model `VaultCheckNameAvailabilityParameters` added property `type` + - Added model `CloudError` + - Added model `OperationProperties` + - Added model `ProxyResource` + - Added model `TrackedResource` + +### Breaking Changes + + - Model `Key` deleted or renamed its instance variable `attributes` + - Model `Key` deleted or renamed its instance variable `kty` + - Model `Key` deleted or renamed its instance variable `key_ops` + - Model `Key` deleted or renamed its instance variable `key_size` + - Model `Key` deleted or renamed its instance variable `curve_name` + - Model `Key` deleted or renamed its instance variable `key_uri` + - Model `Key` deleted or renamed its instance variable `key_uri_with_version` + - Model `Key` deleted or renamed its instance variable `rotation_policy` + - Model `Key` deleted or renamed its instance variable `release_policy` + - Model `MHSMPrivateEndpointConnectionItem` deleted or renamed its instance variable `private_endpoint` + - Model `MHSMPrivateEndpointConnectionItem` deleted or renamed its instance variable `private_link_service_connection_state` + - Model `MHSMPrivateEndpointConnectionItem` deleted or renamed its instance variable `provisioning_state` + - Model `ManagedHsmKey` deleted or renamed its instance variable `attributes` + - Model `ManagedHsmKey` deleted or renamed its instance variable `kty` + - Model `ManagedHsmKey` deleted or renamed its instance variable `key_ops` + - Model `ManagedHsmKey` deleted or renamed its instance variable `key_size` + - Model `ManagedHsmKey` deleted or renamed its instance variable `curve_name` + - Model `ManagedHsmKey` deleted or renamed its instance variable `key_uri` + - Model `ManagedHsmKey` deleted or renamed its instance variable `key_uri_with_version` + - Model `ManagedHsmKey` deleted or renamed its instance variable `rotation_policy` + - Model `ManagedHsmKey` deleted or renamed its instance variable `release_policy` + - Model `Operation` deleted or renamed its instance variable `service_specification` + - Model `Permissions` deleted or renamed its instance variable `keys` + - Model `PrivateEndpointConnectionItem` deleted or renamed its instance variable `private_endpoint` + - Model `PrivateEndpointConnectionItem` deleted or renamed its instance variable `private_link_service_connection_state` + - Model `PrivateEndpointConnectionItem` deleted or renamed its instance variable `provisioning_state` + - Model `Resource` deleted or renamed its instance variable `location` + - Model `Resource` deleted or renamed its instance variable `tags` + - Deleted or renamed model `ProxyResourceWithoutSystemData` + ## 12.1.1 (2025-10-09) ### Bugs Fixed diff --git a/sdk/keyvault/azure-mgmt-keyvault/_metadata.json b/sdk/keyvault/azure-mgmt-keyvault/_metadata.json index 84b8d37effa4..e9dcd87a872f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/_metadata.json +++ b/sdk/keyvault/azure-mgmt-keyvault/_metadata.json @@ -1,6 +1,6 @@ { "apiVersion": "2025-05-01", - "commit": "cd9e490ce205294e81539af5b5d8dfa4da1d5240", + "commit": "74db5e79837425a7723e81bca0b7576ab725c186", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "typespec_src": "specification/keyvault/KeyVault.Management", "emitterVersion": "0.55.0" diff --git a/sdk/keyvault/azure-mgmt-keyvault/apiview-properties.json b/sdk/keyvault/azure-mgmt-keyvault/apiview-properties.json index ef9dcd5aa615..2a9f6a6b7d08 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/apiview-properties.json +++ b/sdk/keyvault/azure-mgmt-keyvault/apiview-properties.json @@ -3,13 +3,13 @@ "CrossLanguageDefinitionId": { "azure.mgmt.keyvault.models.AccessPolicyEntry": "Microsoft.KeyVault.AccessPolicyEntry", "azure.mgmt.keyvault.models.Action": "Microsoft.KeyVault.Action", - "azure.mgmt.keyvault.models.ArmResource": "Azure.ResourceManager.CommonTypes.Resource", "azure.mgmt.keyvault.models.Attributes": "Microsoft.KeyVault.Attributes", "azure.mgmt.keyvault.models.CheckMhsmNameAvailabilityParameters": "Microsoft.KeyVault.CheckMhsmNameAvailabilityParameters", "azure.mgmt.keyvault.models.CheckMhsmNameAvailabilityResult": "Microsoft.KeyVault.CheckMhsmNameAvailabilityResult", "azure.mgmt.keyvault.models.CheckNameAvailabilityResult": "Microsoft.KeyVault.CheckNameAvailabilityResult", "azure.mgmt.keyvault.models.CloudError": "Microsoft.KeyVault.CloudError", "azure.mgmt.keyvault.models.CloudErrorBody": "Microsoft.KeyVault.CloudErrorBody", + "azure.mgmt.keyvault.models.Resource": "Azure.ResourceManager.CommonTypes.Resource", "azure.mgmt.keyvault.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource", "azure.mgmt.keyvault.models.DeletedManagedHsm": "Microsoft.KeyVault.DeletedManagedHsm", "azure.mgmt.keyvault.models.DeletedManagedHsmProperties": "Microsoft.KeyVault.DeletedManagedHsmProperties", @@ -92,7 +92,7 @@ "azure.mgmt.keyvault.models.VaultPatchProperties": "Microsoft.KeyVault.VaultPatchProperties", "azure.mgmt.keyvault.models.VaultProperties": "Microsoft.KeyVault.VaultProperties", "azure.mgmt.keyvault.models.VirtualNetworkRule": "Microsoft.KeyVault.VirtualNetworkRule", - "azure.mgmt.keyvault.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", + "azure.mgmt.keyvault.models.IdentityType": "Azure.ResourceManager.CommonTypes.createdByType", "azure.mgmt.keyvault.models.SkuFamily": "Microsoft.KeyVault.SkuFamily", "azure.mgmt.keyvault.models.SkuName": "Microsoft.KeyVault.SkuName", "azure.mgmt.keyvault.models.KeyPermissions": "Microsoft.KeyVault.KeyPermissions", diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/__init__.py index 12996df9c26f..0e7b087fadf1 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/__init__.py @@ -16,7 +16,6 @@ from ._models import ( # type: ignore AccessPolicyEntry, Action, - ArmResource, Attributes, CheckMhsmNameAvailabilityParameters, CheckMhsmNameAvailabilityResult, @@ -83,6 +82,7 @@ PrivateLinkResourceProperties, PrivateLinkServiceConnectionState, ProxyResource, + Resource, RotationPolicy, Secret, SecretAttributes, @@ -113,9 +113,9 @@ ActivationStatus, CertificatePermissions, CreateMode, - CreatedByType, DeletionRecoveryLevel, GeoReplicationRegionProvisioningState, + IdentityType, JsonWebKeyCurveName, JsonWebKeyOperation, JsonWebKeyType, @@ -144,7 +144,6 @@ __all__ = [ "AccessPolicyEntry", "Action", - "ArmResource", "Attributes", "CheckMhsmNameAvailabilityParameters", "CheckMhsmNameAvailabilityResult", @@ -211,6 +210,7 @@ "PrivateLinkResourceProperties", "PrivateLinkServiceConnectionState", "ProxyResource", + "Resource", "RotationPolicy", "Secret", "SecretAttributes", @@ -238,9 +238,9 @@ "ActivationStatus", "CertificatePermissions", "CreateMode", - "CreatedByType", "DeletionRecoveryLevel", "GeoReplicationRegionProvisioningState", + "IdentityType", "JsonWebKeyCurveName", "JsonWebKeyOperation", "JsonWebKeyType", diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_enums.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_enums.py index 8168f266dc3d..2a21c3638735 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_enums.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_enums.py @@ -59,19 +59,6 @@ class CertificatePermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): RESTORE = "restore" -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The kind of entity that created the resource.""" - - USER = "User" - """The entity was created by a user.""" - APPLICATION = "Application" - """The entity was created by an application.""" - MANAGED_IDENTITY = "ManagedIdentity" - """The entity was created by a managed identity.""" - KEY = "Key" - """The entity was created by a key.""" - - class CreateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The vault's create mode to indicate whether the vault need to be recovered or not.""" @@ -102,6 +89,19 @@ class GeoReplicationRegionProvisioningState(str, Enum, metaclass=CaseInsensitive CLEANUP = "Cleanup" +class IdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of entity that created the resource.""" + + USER = "User" + """The entity was created by a user.""" + APPLICATION = "Application" + """The entity was created by an application.""" + MANAGED_IDENTITY = "ManagedIdentity" + """The entity was created by a managed identity.""" + KEY = "Key" + """The entity was created by a key.""" + + class JsonWebKeyCurveName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The elliptic curve name. For valid values, see JsonWebKeyCurveName. Default for EC and EC-HSM keys is P-256. diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_models.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_models.py index c31f41ca7c30..921a943cc7c9 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_models.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models/_models.py @@ -98,34 +98,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ArmResource(_Model): - """Resource. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.keyvault.models.SystemData - """ - - id: Optional[str] = rest_field(visibility=["read"]) - """Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" - name: Optional[str] = rest_field(visibility=["read"]) - """The name of the resource.""" - type: Optional[str] = rest_field(visibility=["read"]) - """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or - \"Microsoft.Storage/storageAccounts\".""" - system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"]) - """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" - - class Attributes(_Model): """The object attributes managed by the KeyVault service. @@ -315,7 +287,35 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ProxyResource(ArmResource): +class Resource(_Model): + """Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.keyvault.models.SystemData + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or + \"Microsoft.Storage/storageAccounts\".""" + system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"]) + """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" + + +class ProxyResource(Resource): """Proxy Resource. :ivar id: Fully qualified resource ID for the resource. Ex - @@ -982,7 +982,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ManagedHsm(ArmResource): +class ManagedHsm(Resource): """Resource information with extended details. :ivar id: Fully qualified resource ID for the resource. Ex - @@ -2096,7 +2096,7 @@ class MHSMPrivateEndpoint(_Model): """Full identifier of the private endpoint resource.""" -class MHSMPrivateEndpointConnection(ArmResource): +class MHSMPrivateEndpointConnection(Resource): """Private endpoint connection resource. :ivar id: Fully qualified resource ID for the resource. Ex - @@ -3528,21 +3528,21 @@ class SystemData(_Model): :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or ~azure.mgmt.keyvault.models.CreatedByType + :vartype created_by_type: str or ~azure.mgmt.keyvault.models.IdentityType :ivar created_at: The timestamp of resource creation (UTC). :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or ~azure.mgmt.keyvault.models.CreatedByType + :vartype last_modified_by_type: str or ~azure.mgmt.keyvault.models.IdentityType :ivar last_modified_at: The timestamp of resource last modification (UTC). :vartype last_modified_at: ~datetime.datetime """ created_by: Optional[str] = rest_field(name="createdBy", visibility=["read", "create", "update", "delete", "query"]) """The identity that created the resource.""" - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + created_by_type: Optional[Union[str, "_models.IdentityType"]] = rest_field( name="createdByType", visibility=["read", "create", "update", "delete", "query"] ) """The type of identity that created the resource. Known values are: \"User\", \"Application\", @@ -3555,7 +3555,7 @@ class SystemData(_Model): name="lastModifiedBy", visibility=["read", "create", "update", "delete", "query"] ) """The identity that last modified the resource.""" - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + last_modified_by_type: Optional[Union[str, "_models.IdentityType"]] = rest_field( name="lastModifiedByType", visibility=["read", "create", "update", "delete", "query"] ) """The type of identity that last modified the resource. Known values are: \"User\", @@ -3570,10 +3570,10 @@ def __init__( self, *, created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = 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.CreatedByType"]] = None, + last_modified_by_type: Optional[Union[str, "_models.IdentityType"]] = None, last_modified_at: Optional[datetime.datetime] = None, ) -> None: ... @@ -3588,7 +3588,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TrackedResource(ArmResource): +class TrackedResource(Resource): """Tracked Resource. :ivar id: Fully qualified resource ID for the resource. Ex - diff --git a/sdk/keyvault/azure-mgmt-keyvault/tsp-location.yaml b/sdk/keyvault/azure-mgmt-keyvault/tsp-location.yaml index ce32c433a482..0a0b7250d8a9 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/tsp-location.yaml +++ b/sdk/keyvault/azure-mgmt-keyvault/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/keyvault/KeyVault.Management -commit: cd9e490ce205294e81539af5b5d8dfa4da1d5240 +commit: 74db5e79837425a7723e81bca0b7576ab725c186 repo: Azure/azure-rest-api-specs additionalDirectories: From 5db4b20c57d2d063bd5778444f02975bff289f6e Mon Sep 17 00:00:00 2001 From: ChenxiJiang333 Date: Thu, 11 Dec 2025 11:37:49 +0800 Subject: [PATCH 33/34] update patch and changelog --- sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md | 35 +++++-------------- .../keyvault/aio/operations/_operations.py | 2 +- .../mgmt/keyvault/operations/_operations.py | 2 +- 3 files changed, 10 insertions(+), 29 deletions(-) diff --git a/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md b/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md index 07471518b516..b7b8ce51593e 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md +++ b/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md @@ -27,35 +27,16 @@ ### Breaking Changes - - Model `Key` deleted or renamed its instance variable `attributes` - - Model `Key` deleted or renamed its instance variable `kty` - - Model `Key` deleted or renamed its instance variable `key_ops` - - Model `Key` deleted or renamed its instance variable `key_size` - - Model `Key` deleted or renamed its instance variable `curve_name` - - Model `Key` deleted or renamed its instance variable `key_uri` - - Model `Key` deleted or renamed its instance variable `key_uri_with_version` - - Model `Key` deleted or renamed its instance variable `rotation_policy` - - Model `Key` deleted or renamed its instance variable `release_policy` - - Model `MHSMPrivateEndpointConnectionItem` deleted or renamed its instance variable `private_endpoint` - - Model `MHSMPrivateEndpointConnectionItem` deleted or renamed its instance variable `private_link_service_connection_state` - - Model `MHSMPrivateEndpointConnectionItem` deleted or renamed its instance variable `provisioning_state` - - Model `ManagedHsmKey` deleted or renamed its instance variable `attributes` - - Model `ManagedHsmKey` deleted or renamed its instance variable `kty` - - Model `ManagedHsmKey` deleted or renamed its instance variable `key_ops` - - Model `ManagedHsmKey` deleted or renamed its instance variable `key_size` - - Model `ManagedHsmKey` deleted or renamed its instance variable `curve_name` - - Model `ManagedHsmKey` deleted or renamed its instance variable `key_uri` - - Model `ManagedHsmKey` deleted or renamed its instance variable `key_uri_with_version` - - Model `ManagedHsmKey` deleted or renamed its instance variable `rotation_policy` - - Model `ManagedHsmKey` deleted or renamed its instance variable `release_policy` - - Model `Operation` deleted or renamed its instance variable `service_specification` - - Model `Permissions` deleted or renamed its instance variable `keys` - - Model `PrivateEndpointConnectionItem` deleted or renamed its instance variable `private_endpoint` - - Model `PrivateEndpointConnectionItem` deleted or renamed its instance variable `private_link_service_connection_state` - - Model `PrivateEndpointConnectionItem` deleted or renamed its instance variable `provisioning_state` + - This version introduces new hybrid models which have dual dictionary and model nature. Please follow https://aka.ms/azsdk/python/migrate/hybrid-models for migration. + - Model `Key` moved instance variable `attributes`, `kty`, `key_ops`, `key_size`, `curve_name`, `key_uri`, `key_uri_with_version`, `rotation_policy` and `release_policy` under property `properties` + - Model `MHSMPrivateEndpointConnectionItem` moved instance variable `private_endpoint`, `private_link_service_connection_state` and `provisioning_state` under property `properties` + - Model `ManagedHsmKey` moved instance variable `attributes`, `kty`, `key_ops`, `key_size`, `curve_name`, `key_uri`, `key_uri_with_version`, `rotation_policy` and `release_policy` under property `properties` + - Model `Operation` moved instance variable `service_specification` under property `operation_properties` + - Model `PrivateEndpointConnectionItem` moved instance variable `private_endpoint`, `private_link_service_connection_state` and `provisioning_state` under property `properties` + - Model `Permissions` renamed its instance variable `keys` to `keys_property` - Model `Resource` deleted or renamed its instance variable `location` - Model `Resource` deleted or renamed its instance variable `tags` - - Deleted or renamed model `ProxyResourceWithoutSystemData` + - Deleted model `ProxyResourceWithoutSystemData` which actually were not used by SDK users ## 12.1.1 (2025-10-09) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py index 73e6a82432c9..74dd06735b67 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/operations/_operations.py @@ -1444,7 +1444,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._config.api_version + _next_request_params["api-version"] = api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py index badf2081bb03..14fabbad83a0 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/operations/_operations.py @@ -2790,7 +2790,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._config.api_version + _next_request_params["api-version"] = api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) From fe4c3a275d885a1a8e963453006987eb64c903ef Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Thu, 11 Dec 2025 14:26:30 +0800 Subject: [PATCH 34/34] Update CHANGELOG.md --- sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md b/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md index b7b8ce51593e..0c333cc2c5ff 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md +++ b/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md @@ -22,7 +22,6 @@ - Model `VaultCheckNameAvailabilityParameters` added property `type` - Added model `CloudError` - Added model `OperationProperties` - - Added model `ProxyResource` - Added model `TrackedResource` ### Breaking Changes @@ -36,7 +35,7 @@ - Model `Permissions` renamed its instance variable `keys` to `keys_property` - Model `Resource` deleted or renamed its instance variable `location` - Model `Resource` deleted or renamed its instance variable `tags` - - Deleted model `ProxyResourceWithoutSystemData` which actually were not used by SDK users + - Renamed model `ProxyResourceWithoutSystemData` to `ProxyResource` ## 12.1.1 (2025-10-09)