diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/Configuration.json b/sdk/keyvault/Azure.ResourceManager.KeyVault/Configuration.json
new file mode 100644
index 000000000000..690e085f833b
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/Configuration.json
@@ -0,0 +1,13 @@
+{
+ "package-name": "Azure.ResourceManager.KeyVault",
+ "namespace": "Azure.ResourceManager.KeyVault",
+ "enable-wire-path-attribute": true,
+ "model-namespace": true,
+ "license": {
+ "name": "MIT License",
+ "company": "Microsoft Corporation",
+ "link": "https://mit-license.org",
+ "header": "Copyright (c) Microsoft Corporation. All rights reserved.\nLicensed under the MIT License.",
+ "description": "Copyright (c) Microsoft Corporation\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the “Software”), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE."
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Customization/ArmKeyVaultModelFactory.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Customization/ArmKeyVaultModelFactory.cs
deleted file mode 100644
index 48fdbad42550..000000000000
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Customization/ArmKeyVaultModelFactory.cs
+++ /dev/null
@@ -1,158 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-#nullable disable
-
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using Azure.Core;
-using Azure.ResourceManager.Models;
-
-namespace Azure.ResourceManager.KeyVault.Models
-{
- public static partial class ArmKeyVaultModelFactory
- {
- /// Initializes a new instance of .
- /// The id.
- /// The name.
- /// The resourceType.
- /// The systemData.
- /// Group identifier of private link resource.
- /// Required member names of private link resource.
- /// Required DNS zone names of the the private link resource.
- /// Azure location of the key vault resource.
- /// Tags assigned to the key vault resource.
- /// A new instance for mocking.
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static KeyVaultPrivateLinkResourceData KeyVaultPrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string groupId, IEnumerable requiredMembers, IEnumerable requiredZoneNames, AzureLocation? location, IReadOnlyDictionary tags)
- {
- return new KeyVaultPrivateLinkResourceData(
- id,
- name,
- resourceType,
- systemData,
- location,
- tags,
- groupId,
- requiredMembers.ToList(),
- requiredZoneNames.ToList(),
- serializedAdditionalRawData: null);
- }
-
- /// Initializes a new instance of .
- /// The id.
- /// The name.
- /// The resourceType.
- /// The systemData.
- /// The tags.
- /// The location.
- /// Modified whenever there is a change in the state of private endpoint connection.
- /// Properties of the private endpoint object.
- /// Approval state of the private link connection.
- /// Provisioning state of the private endpoint connection.
- /// SKU details.
- /// Managed service identity (system assigned and/or user assigned identities).
- /// A new instance for mocking.
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static ManagedHsmPrivateEndpointConnectionData ManagedHsmPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, ResourceIdentifier privateEndpointId, ManagedHsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState, ManagedHsmPrivateEndpointConnectionProvisioningState? provisioningState, ManagedHsmSku sku, ManagedServiceIdentity identity)
- {
- return new ManagedHsmPrivateEndpointConnectionData(
- id,
- name,
- resourceType,
- systemData,
- tags,
- location,
- sku,
- identity,
- etag,
- privateEndpoint: ResourceManagerModelFactory.SubResource(privateEndpointId),
- privateLinkServiceConnectionState,
- provisioningState,
- serializedAdditionalRawData: null);
- }
-
- /// Initializes a new instance of .
- /// The id.
- /// The name.
- /// The resourceType.
- /// The systemData.
- /// The tags.
- /// The location.
- /// Modified whenever there is a change in the state of private endpoint connection.
- /// Properties of the private endpoint object.
- /// Approval state of the private link connection.
- /// Provisioning state of the private endpoint connection.
- /// SKU details.
- /// A new instance for mocking.
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static ManagedHsmPrivateEndpointConnectionData ManagedHsmPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, ResourceIdentifier privateEndpointId, ManagedHsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState, ManagedHsmPrivateEndpointConnectionProvisioningState? provisioningState, ManagedHsmSku sku)
- {
- return ManagedHsmPrivateEndpointConnectionData(id, name, resourceType, systemData, tags, location, etag, privateEndpointId, privateLinkServiceConnectionState, provisioningState, sku, identity: default);
- }
-
- /// Initializes a new instance of .
- /// The id.
- /// The name.
- /// The resourceType.
- /// The systemData.
- /// The tags.
- /// The location.
- /// Group identifier of private link resource.
- /// Required member names of private link resource.
- /// Required DNS zone names of the the private link resource.
- /// SKU details.
- /// A new instance for mocking.
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static ManagedHsmPrivateLinkResourceData ManagedHsmPrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string groupId, IEnumerable requiredMembers, IEnumerable requiredZoneNames, ManagedHsmSku sku)
- {
- return ManagedHsmPrivateLinkResourceData(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, location: location, groupId: groupId, requiredMembers: requiredMembers, requiredZoneNames: requiredZoneNames, sku: sku, identity: default);
- }
-
- /// Initializes a new instance of .
- /// The id.
- /// The name.
- /// The resourceType.
- /// The systemData.
- /// Modified whenever there is a change in the state of private endpoint connection.
- /// Properties of the private endpoint object.
- /// Approval state of the private link connection.
- /// Provisioning state of the private endpoint connection.
- /// Azure location of the key vault resource.
- /// Tags assigned to the key vault resource.
- /// A new instance for mocking.
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static KeyVaultPrivateEndpointConnectionData KeyVaultPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? etag, ResourceIdentifier privateEndpointId, KeyVaultPrivateLinkServiceConnectionState connectionState, KeyVaultPrivateEndpointConnectionProvisioningState? provisioningState, AzureLocation? location, IReadOnlyDictionary tags)
- {
- return new KeyVaultPrivateEndpointConnectionData(
- id,
- name,
- resourceType,
- systemData,
- location,
- tags,
- etag,
- privateEndpoint: ResourceManagerModelFactory.SubResource(privateEndpointId),
- connectionState,
- provisioningState,
- serializedAdditionalRawData: null);
- }
-
- /// Initializes a new instance of .
- /// The id.
- /// The name.
- /// The resourceType.
- /// The systemData.
- /// The tags.
- /// The location.
- /// Properties of the managed HSM.
- /// SKU details.
- /// A new instance for mocking.
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static ManagedHsmData ManagedHsmData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedHsmProperties properties, ManagedHsmSku sku)
- {
- return ManagedHsmData(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, location: location, properties: properties, sku: sku, identity: default);
- }
- }
-}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Customization/KeyVaultPrivateEndpointConnectionResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Customization/KeyVaultPrivateEndpointConnectionResource.cs
index dcfc91548a03..a0facc971c88 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Customization/KeyVaultPrivateEndpointConnectionResource.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Customization/KeyVaultPrivateEndpointConnectionResource.cs
@@ -1,10 +1,8 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
+// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System;
using System.Collections.Generic;
-using System.Text;
-using Azure.Core;
using System.Threading.Tasks;
using System.Threading;
using System.ComponentModel;
@@ -34,24 +32,8 @@ public partial class KeyVaultPrivateEndpointConnectionResource
[EditorBrowsable(EditorBrowsableState.Never)]
public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default)
{
- Argument.AssertNotNull(key, nameof(key));
- Argument.AssertNotNull(value, nameof(value));
-
- using var scope = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionResource.AddTag");
- scope.Start();
- try
- {
- var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false);
- originalTags.Value.Data.TagValues[key] = value;
- await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false);
- var originalResponse = await _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false);
- return Response.FromValue(new KeyVaultPrivateEndpointConnectionResource(Client, originalResponse.Value), originalResponse.GetRawResponse());
- }
- catch (Exception e)
- {
- scope.Failed(e);
- throw;
- }
+ await Task.CompletedTask.ConfigureAwait(false);
+ throw new NotSupportedException("This method is obsolete and will be removed in a future release");
}
///
@@ -74,26 +56,7 @@ public virtual async Task> A
[Obsolete("This method is obsolete and will be removed in a future release", false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default)
- {
- Argument.AssertNotNull(key, nameof(key));
- Argument.AssertNotNull(value, nameof(value));
-
- using var scope = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionResource.AddTag");
- scope.Start();
- try
- {
- var originalTags = GetTagResource().Get(cancellationToken);
- originalTags.Value.Data.TagValues[key] = value;
- GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken);
- var originalResponse = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken);
- return Response.FromValue(new KeyVaultPrivateEndpointConnectionResource(Client, originalResponse.Value), originalResponse.GetRawResponse());
- }
- catch (Exception e)
- {
- scope.Failed(e);
- throw;
- }
- }
+ => throw new NotSupportedException("This method is obsolete and will be removed in a future release");
///
/// Replace the tags on the resource with the given set.
@@ -115,24 +78,8 @@ public virtual Response AddTag(string
[EditorBrowsable(EditorBrowsableState.Never)]
public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default)
{
- Argument.AssertNotNull(tags, nameof(tags));
-
- using var scope = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionResource.SetTags");
- scope.Start();
- try
- {
- await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false);
- var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false);
- originalTags.Value.Data.TagValues.ReplaceWith(tags);
- await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false);
- var originalResponse = await _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false);
- return Response.FromValue(new KeyVaultPrivateEndpointConnectionResource(Client, originalResponse.Value), originalResponse.GetRawResponse());
- }
- catch (Exception e)
- {
- scope.Failed(e);
- throw;
- }
+ await Task.CompletedTask.ConfigureAwait(false);
+ throw new NotSupportedException("This method is obsolete and will be removed in a future release");
}
///
@@ -154,26 +101,7 @@ public virtual async Task> S
[Obsolete("This method is obsolete and will be removed in a future release", false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default)
- {
- Argument.AssertNotNull(tags, nameof(tags));
-
- using var scope = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionResource.SetTags");
- scope.Start();
- try
- {
- GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken);
- var originalTags = GetTagResource().Get(cancellationToken);
- originalTags.Value.Data.TagValues.ReplaceWith(tags);
- GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken);
- var originalResponse = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken);
- return Response.FromValue(new KeyVaultPrivateEndpointConnectionResource(Client, originalResponse.Value), originalResponse.GetRawResponse());
- }
- catch (Exception e)
- {
- scope.Failed(e);
- throw;
- }
- }
+ => throw new NotSupportedException("This method is obsolete and will be removed in a future release");
///
/// Removes a tag by key from the resource.
@@ -195,23 +123,8 @@ public virtual Response SetTags(IDict
[EditorBrowsable(EditorBrowsableState.Never)]
public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default)
{
- Argument.AssertNotNull(key, nameof(key));
-
- using var scope = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionResource.RemoveTag");
- scope.Start();
- try
- {
- var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false);
- originalTags.Value.Data.TagValues.Remove(key);
- await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false);
- var originalResponse = await _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false);
- return Response.FromValue(new KeyVaultPrivateEndpointConnectionResource(Client, originalResponse.Value), originalResponse.GetRawResponse());
- }
- catch (Exception e)
- {
- scope.Failed(e);
- throw;
- }
+ await Task.CompletedTask.ConfigureAwait(false);
+ throw new NotSupportedException("This method is obsolete and will be removed in a future release");
}
///
@@ -233,24 +146,6 @@ public virtual async Task> R
[Obsolete("This method is obsolete and will be removed in a future release", false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default)
- {
- Argument.AssertNotNull(key, nameof(key));
-
- using var scope = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionResource.RemoveTag");
- scope.Start();
- try
- {
- var originalTags = GetTagResource().Get(cancellationToken);
- originalTags.Value.Data.TagValues.Remove(key);
- GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken);
- var originalResponse = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken);
- return Response.FromValue(new KeyVaultPrivateEndpointConnectionResource(Client, originalResponse.Value), originalResponse.GetRawResponse());
- }
- catch (Exception e)
- {
- scope.Failed(e);
- throw;
- }
- }
+ => throw new NotSupportedException("This method is obsolete and will be removed in a future release");
}
}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Customization/Models/ManagedHsmPrivateLinkResourceData.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Customization/Models/ManagedHsmPrivateLinkResourceData.cs
deleted file mode 100644
index 83019308c59f..000000000000
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Customization/Models/ManagedHsmPrivateLinkResourceData.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-#nullable disable
-
-using Azure.Core;
-using Azure.ResourceManager.Models;
-
-namespace Azure.ResourceManager.KeyVault.Models
-{
- [CodeGenModel(Usage = new[] { "Input" })]
- public partial class ManagedHsmPrivateLinkResourceData : TrackedResourceData
- {
- }
-}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ArmKeyVaultModelFactory.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ArmKeyVaultModelFactory.cs
index 64816895806a..46db7744e6c3 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ArmKeyVaultModelFactory.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ArmKeyVaultModelFactory.cs
@@ -7,104 +7,267 @@
using System;
using System.Collections.Generic;
-using System.ComponentModel;
using System.Linq;
+using Azure;
using Azure.Core;
+using Azure.ResourceManager.KeyVault;
using Azure.ResourceManager.Models;
namespace Azure.ResourceManager.KeyVault.Models
{
- /// Model factory for models.
+ /// A factory class for creating instances of the models for mocking.
public static partial class ArmKeyVaultModelFactory
{
- /// Initializes a new instance of .
- /// 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.
- /// The reason that a managed hsm name could not be used. The reason element is only returned if NameAvailable is false.
- /// An error message explaining the Reason value in more detail.
- /// A new instance for mocking.
- public static ManagedHsmNameAvailabilityResult ManagedHsmNameAvailabilityResult(bool? isNameAvailable = null, ManagedHsmNameUnavailableReason? reason = null, string message = null)
+ /// Resource information with extended details.
+ /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /// The name of the resource.
+ /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".
+ /// Azure Resource Manager metadata containing createdBy and modifiedBy information.
+ /// Properties of the vault.
+ /// Resource tags.
+ /// The geo-location where the resource lives.
+ /// A new instance for mocking.
+ public static KeyVaultData KeyVaultData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, KeyVaultProperties properties = default, IDictionary tags = default, AzureLocation? location = default)
{
- return new ManagedHsmNameAvailabilityResult(isNameAvailable, reason, message, serializedAdditionalRawData: null);
+ tags ??= new ChangeTrackingDictionary();
+
+ return new KeyVaultData(
+ id,
+ name,
+ resourceType,
+ systemData,
+ additionalBinaryDataProperties: null,
+ properties,
+ tags,
+ location);
}
- /// Initializes a new instance of .
- /// The vault name.
- /// The type of resource, Microsoft.KeyVault/vaults.
- /// A new instance for mocking.
- public static KeyVaultNameAvailabilityContent KeyVaultNameAvailabilityContent(string name = null, ResourceType resourceType = default)
+ /// Properties of the vault.
+ /// The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault.
+ /// SKU details.
+ /// 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.
+ /// The URI of the vault for performing operations on keys and secrets.
+ /// The resource id of HSM Pool.
+ /// Property to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from the key vault.
+ /// Property to specify whether Azure Disk Encryption is permitted to retrieve secrets from the vault and unwrap keys.
+ /// Property to specify whether Azure Resource Manager is permitted to retrieve secrets from the key vault.
+ /// 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.
+ /// softDelete data retention days. It accepts >=7 and <=90.
+ /// 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.
+ /// The vault's create mode to indicate whether the vault need to be recovered or not.
+ /// 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.
+ /// Rules governing the accessibility of the key vault from specific network locations.
+ /// Provisioning state of the vault.
+ /// List of private endpoint connections associated with the key vault.
+ /// 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.
+ /// A new instance for mocking.
+ public static KeyVaultProperties KeyVaultProperties(Guid tenantId = default, KeyVaultSku sku = default, IEnumerable accessPolicies = default, Uri vaultUri = default, string hsmPoolResourceId = default, bool? enabledForDeployment = default, bool? enabledForDiskEncryption = default, bool? enabledForTemplateDeployment = default, bool? enableSoftDelete = default, int? softDeleteRetentionInDays = default, bool? enableRbacAuthorization = default, KeyVaultCreateMode? createMode = default, bool? enablePurgeProtection = default, KeyVaultNetworkRuleSet networkRuleSet = default, KeyVaultProvisioningState? provisioningState = default, IEnumerable privateEndpointConnections = default, string publicNetworkAccess = default)
+ {
+ accessPolicies ??= new ChangeTrackingList();
+ privateEndpointConnections ??= new ChangeTrackingList();
+
+ return new KeyVaultProperties(
+ tenantId,
+ sku,
+ accessPolicies.ToList(),
+ vaultUri,
+ hsmPoolResourceId,
+ enabledForDeployment,
+ enabledForDiskEncryption,
+ enabledForTemplateDeployment,
+ enableSoftDelete,
+ softDeleteRetentionInDays,
+ enableRbacAuthorization,
+ createMode,
+ enablePurgeProtection,
+ networkRuleSet,
+ provisioningState,
+ privateEndpointConnections.ToList(),
+ publicNetworkAccess,
+ additionalBinaryDataProperties: null);
+ }
+
+ /// Permissions the identity has for keys, secrets, certificates and storage.
+ /// Permissions to keys.
+ /// Permissions to secrets.
+ /// Permissions to certificates.
+ /// Permissions to storage accounts.
+ /// A new instance for mocking.
+ public static IdentityAccessPermissions IdentityAccessPermissions(IEnumerable keys = default, IEnumerable secrets = default, IEnumerable certificates = default, IEnumerable storage = default)
{
- return new KeyVaultNameAvailabilityContent(name, resourceType, serializedAdditionalRawData: null);
+ keys ??= new ChangeTrackingList();
+ secrets ??= new ChangeTrackingList();
+ certificates ??= new ChangeTrackingList();
+ storage ??= new ChangeTrackingList();
+
+ return new IdentityAccessPermissions(keys.ToList(), secrets.ToList(), certificates.ToList(), storage.ToList(), additionalBinaryDataProperties: null);
}
- /// Initializes a new instance of .
- /// 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.
- /// The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false.
- /// An error message explaining the Reason value in more detail.
- /// A new instance for mocking.
- public static KeyVaultNameAvailabilityResult KeyVaultNameAvailabilityResult(bool? nameAvailable = null, KeyVaultNameUnavailableReason? reason = null, string message = null)
+ /// A set of rules governing the network accessibility of a vault.
+ /// Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'.
+ /// The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated.
+ /// The list of IP address rules.
+ /// The list of virtual network rules.
+ /// A new instance for mocking.
+ public static KeyVaultNetworkRuleSet KeyVaultNetworkRuleSet(KeyVaultNetworkRuleBypassOption? bypass = default, KeyVaultNetworkRuleAction? defaultAction = default, IEnumerable ipRules = default, IEnumerable virtualNetworkRules = default)
{
- return new KeyVaultNameAvailabilityResult(nameAvailable, reason, message, serializedAdditionalRawData: null);
+ ipRules ??= new ChangeTrackingList();
+ virtualNetworkRules ??= new ChangeTrackingList();
+
+ return new KeyVaultNetworkRuleSet(bypass, defaultAction, ipRules.ToList(), virtualNetworkRules.ToList(), additionalBinaryDataProperties: null);
}
- /// Initializes a new instance of .
- /// The id.
- /// The name.
- /// The resourceType.
- /// The systemData.
- /// Properties of the deleted managed HSM.
- /// A new instance for mocking.
- public static DeletedManagedHsmData DeletedManagedHsmData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DeletedManagedHsmProperties properties = null)
+ /// Id of private endpoint connection.
+ /// Modified whenever there is a change in the state of private endpoint connection.
+ /// Approval state of the private link connection.
+ /// Provisioning state of the private endpoint connection.
+ /// Full identifier of the private endpoint resource.
+ /// A new instance for mocking.
+ public static KeyVaultPrivateEndpointConnectionItemData KeyVaultPrivateEndpointConnectionItemData(string id = default, ETag? etag = default, KeyVaultPrivateLinkServiceConnectionState connectionState = default, KeyVaultPrivateEndpointConnectionProvisioningState? provisioningState = default, string privateEndpointId = default)
{
- return new DeletedManagedHsmData(
+ return new KeyVaultPrivateEndpointConnectionItemData(id, etag, connectionState is null && provisioningState is null && privateEndpointId is null ? default : new PrivateEndpointConnectionProperties(new PrivateEndpoint(privateEndpointId, null), connectionState, provisioningState, null), additionalBinaryDataProperties: null);
+ }
+
+ /// Parameters for creating or updating a vault.
+ /// The supported Azure location where the key vault should be created.
+ /// The tags that will be assigned to the key vault.
+ /// Properties of the vault.
+ /// A new instance for mocking.
+ public static VaultCreateOrUpdateParameters VaultCreateOrUpdateParameters(AzureLocation location = default, IDictionary tags = default, KeyVaultProperties properties = default)
+ {
+ tags ??= new ChangeTrackingDictionary();
+
+ return new VaultCreateOrUpdateParameters(location, tags, properties, additionalBinaryDataProperties: null);
+ }
+
+ /// Parameters for creating or updating a vault.
+ /// The tags that will be assigned to the key vault.
+ /// Properties of the vault.
+ /// A new instance for mocking.
+ public static KeyVaultPatch KeyVaultPatch(IDictionary tags = default, KeyVaultPatchProperties properties = default)
+ {
+ tags ??= new ChangeTrackingDictionary();
+
+ return new KeyVaultPatch(tags, properties, additionalBinaryDataProperties: null);
+ }
+
+ /// Properties of the vault.
+ /// The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault.
+ /// SKU details.
+ /// 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.
+ /// Property to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from the key vault.
+ /// Property to specify whether Azure Disk Encryption is permitted to retrieve secrets from the vault and unwrap keys.
+ /// Property to specify whether Azure Resource Manager is permitted to retrieve secrets from the key vault.
+ /// Property to specify whether the 'soft delete' functionality is enabled for this key vault. Once set to true, it cannot be reverted to false.
+ /// 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.
+ /// softDelete data retention days. It accepts >=7 and <=90.
+ /// The vault's create mode to indicate whether the vault need to be recovered or not.
+ /// 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.
+ /// A collection of rules governing the accessibility of the vault from specific network locations.
+ /// 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.
+ /// A new instance for mocking.
+ public static KeyVaultPatchProperties KeyVaultPatchProperties(Guid? tenantId = default, KeyVaultSku sku = default, IEnumerable accessPolicies = default, bool? enabledForDeployment = default, bool? enabledForDiskEncryption = default, bool? enabledForTemplateDeployment = default, bool? enableSoftDelete = default, bool? enableRbacAuthorization = default, int? softDeleteRetentionInDays = default, KeyVaultPatchMode? createMode = default, bool? enablePurgeProtection = default, KeyVaultNetworkRuleSet networkRuleSet = default, string publicNetworkAccess = default)
+ {
+ accessPolicies ??= new ChangeTrackingList();
+
+ return new KeyVaultPatchProperties(
+ tenantId,
+ sku,
+ accessPolicies.ToList(),
+ enabledForDeployment,
+ enabledForDiskEncryption,
+ enabledForTemplateDeployment,
+ enableSoftDelete,
+ enableRbacAuthorization,
+ softDeleteRetentionInDays,
+ createMode,
+ enablePurgeProtection,
+ networkRuleSet,
+ publicNetworkAccess,
+ additionalBinaryDataProperties: null);
+ }
+
+ /// The resource id of the access policy.
+ /// The resource name of the access policy.
+ /// The resource name of the access policy.
+ /// The resource type of the access policy.
+ /// 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.
+ /// A new instance for mocking.
+ public static KeyVaultAccessPolicyParameters KeyVaultAccessPolicyParameters(string id = default, string name = default, string @type = default, AzureLocation? location = default, IEnumerable accessPolicies = default)
+ {
+ return new KeyVaultAccessPolicyParameters(
id,
name,
- resourceType,
- systemData,
- properties,
- serializedAdditionalRawData: null);
+ @type,
+ location,
+ accessPolicies is null ? default : new KeyVaultAccessPolicyProperties((accessPolicies ?? new ChangeTrackingList()).ToList(), null),
+ additionalBinaryDataProperties: null);
}
- /// Initializes a new instance of .
- /// The resource id of the original managed HSM.
- /// The location of the original managed HSM.
- /// The deleted date.
- /// The scheduled purged date.
- /// Purge protection status of the original managed HSM.
- /// Tags of the original managed HSM.
- /// A new instance for mocking.
- public static DeletedManagedHsmProperties DeletedManagedHsmProperties(ResourceIdentifier managedHsmId = null, AzureLocation? location = null, DateTimeOffset? deletedOn = null, DateTimeOffset? scheduledPurgeOn = null, bool? purgeProtectionEnabled = null, IReadOnlyDictionary tags = null)
+ /// Properties of the vault access policy.
+ /// 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.
+ /// A new instance for mocking.
+ public static KeyVaultAccessPolicyProperties KeyVaultAccessPolicyProperties(IEnumerable accessPolicies = default)
{
- tags ??= new Dictionary();
+ accessPolicies ??= new ChangeTrackingList();
- return new DeletedManagedHsmProperties(
- managedHsmId,
+ return new KeyVaultAccessPolicyProperties(accessPolicies.ToList(), additionalBinaryDataProperties: null);
+ }
+
+ /// A list of private link resources.
+ /// Array of private link resources.
+ /// A new instance for mocking.
+ public static KeyVaultPrivateLinkResourceListResult KeyVaultPrivateLinkResourceListResult(IEnumerable value = default)
+ {
+ value ??= new ChangeTrackingList();
+
+ return new KeyVaultPrivateLinkResourceListResult(value.ToList(), additionalBinaryDataProperties: null);
+ }
+
+ /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /// The name of the resource.
+ /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".
+ /// Azure Resource Manager metadata containing createdBy and modifiedBy information.
+ /// Group identifier of private link resource.
+ /// Required member names of private link resource.
+ /// Required DNS zone names of the the private link resource.
+ /// Azure location of the key vault resource.
+ /// Tags assigned to the key vault resource.
+ /// A new instance for mocking.
+ public static KeyVaultPrivateLinkResourceData KeyVaultPrivateLinkResourceData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, string groupId = default, IEnumerable requiredMembers = default, IEnumerable requiredZoneNames = default, AzureLocation? location = default, IReadOnlyDictionary tags = default)
+ {
+ tags ??= new ChangeTrackingDictionary();
+
+ return new KeyVaultPrivateLinkResourceData(
+ id,
+ name,
+ resourceType,
+ systemData,
+ additionalBinaryDataProperties: null,
+ groupId is null && requiredMembers is null && requiredZoneNames is null ? default : new KeyVaultPrivateLinkResourceProperties(groupId, (requiredMembers ?? new ChangeTrackingList()).ToList(), (requiredZoneNames ?? new ChangeTrackingList()).ToList(), null),
location,
- deletedOn,
- scheduledPurgeOn,
- purgeProtectionEnabled,
- tags,
- serializedAdditionalRawData: null);
+ tags);
}
- /// Initializes a new instance of .
- /// The id.
- /// The name.
- /// The resourceType.
- /// The systemData.
+ /// Deleted vault information with extended details.
+ /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /// The name of the resource.
+ /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".
+ /// Azure Resource Manager metadata containing createdBy and modifiedBy information.
/// Properties of the vault.
/// A new instance for mocking.
- public static DeletedKeyVaultData DeletedKeyVaultData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DeletedKeyVaultProperties properties = null)
+ public static DeletedKeyVaultData DeletedKeyVaultData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, DeletedKeyVaultProperties properties = default)
{
return new DeletedKeyVaultData(
id,
name,
resourceType,
systemData,
- properties,
- serializedAdditionalRawData: null);
+ additionalBinaryDataProperties: null,
+ properties);
}
- /// Initializes a new instance of .
+ /// Properties of the deleted vault.
/// The resource id of the original vault.
/// The location of the original vault.
/// The deleted date.
@@ -112,9 +275,9 @@ public static DeletedKeyVaultData DeletedKeyVaultData(ResourceIdentifier id = nu
/// Tags of the original vault.
/// Purge protection status of the original vault.
/// A new instance for mocking.
- public static DeletedKeyVaultProperties DeletedKeyVaultProperties(ResourceIdentifier vaultId = null, AzureLocation? location = null, DateTimeOffset? deletedOn = null, DateTimeOffset? scheduledPurgeOn = null, IReadOnlyDictionary tags = null, bool? purgeProtectionEnabled = null)
+ public static DeletedKeyVaultProperties DeletedKeyVaultProperties(ResourceIdentifier vaultId = default, AzureLocation? location = default, DateTimeOffset? deletedOn = default, DateTimeOffset? scheduledPurgeOn = default, IReadOnlyDictionary tags = default, bool? purgeProtectionEnabled = default)
{
- tags ??= new Dictionary();
+ tags ??= new ChangeTrackingDictionary();
return new DeletedKeyVaultProperties(
vaultId,
@@ -123,38 +286,65 @@ public static DeletedKeyVaultProperties DeletedKeyVaultProperties(ResourceIdenti
scheduledPurgeOn,
tags,
purgeProtectionEnabled,
- serializedAdditionalRawData: null);
+ additionalBinaryDataProperties: null);
}
- /// Initializes a new instance of .
- /// The id.
- /// The name.
- /// The resourceType.
- /// The systemData.
- /// The tags.
- /// The location.
+ /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /// The name of the resource.
+ /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".
+ /// Azure Resource Manager metadata containing createdBy and modifiedBy information.
+ /// Approval state of the private link connection.
+ /// Provisioning state of the private endpoint connection.
+ /// Full identifier of the private endpoint resource.
+ /// Azure location of the key vault resource.
+ /// Tags assigned to the key vault resource.
+ /// Modified whenever there is a change in the state of private endpoint connection.
+ /// A new instance for mocking.
+ public static KeyVaultPrivateEndpointConnectionData KeyVaultPrivateEndpointConnectionData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, KeyVaultPrivateLinkServiceConnectionState connectionState = default, KeyVaultPrivateEndpointConnectionProvisioningState? provisioningState = default, string privateEndpointId = default, AzureLocation? location = default, IReadOnlyDictionary tags = default, ETag? etag = default)
+ {
+ tags ??= new ChangeTrackingDictionary();
+
+ return new KeyVaultPrivateEndpointConnectionData(
+ id,
+ name,
+ resourceType,
+ systemData,
+ additionalBinaryDataProperties: null,
+ connectionState is null && provisioningState is null && privateEndpointId is null ? default : new PrivateEndpointConnectionProperties(new PrivateEndpoint(privateEndpointId, null), connectionState, provisioningState, null),
+ location,
+ tags,
+ etag);
+ }
+
+ /// Resource information with extended details.
+ /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /// The name of the resource.
+ /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".
+ /// Azure Resource Manager metadata containing createdBy and modifiedBy information.
/// Properties of the managed HSM.
+ /// Resource tags.
+ /// The geo-location where the resource lives.
/// SKU details.
/// Managed service identity.
/// A new instance for mocking.
- public static ManagedHsmData ManagedHsmData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ManagedHsmProperties properties = null, ManagedHsmSku sku = null, ManagedServiceIdentity identity = null)
+ public static ManagedHsmData ManagedHsmData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, ManagedHsmProperties properties = default, IDictionary tags = default, AzureLocation? location = default, ManagedHsmSku sku = default, ManagedServiceIdentity identity = default)
{
- tags ??= new Dictionary();
+ tags ??= new ChangeTrackingDictionary();
return new ManagedHsmData(
id,
name,
resourceType,
systemData,
+ additionalBinaryDataProperties: null,
+ properties,
tags,
location,
- properties,
sku,
- identity,
- serializedAdditionalRawData: null);
+ identity);
}
- /// Initializes a new instance of .
+ /// Properties of the managed HSM Pool.
/// The Azure Active Directory tenant ID that should be used for authenticating requests to the managed HSM pool.
/// Array of initial administrators object ids for this managed hsm pool.
/// The URI of the managed hsm pool for performing operations on keys.
@@ -171,15 +361,15 @@ public static ManagedHsmData ManagedHsmData(ResourceIdentifier id = null, string
/// The scheduled purge date in UTC.
/// Managed HSM security domain properties.
/// A new instance for mocking.
- public static ManagedHsmProperties ManagedHsmProperties(Guid? tenantId = null, IEnumerable initialAdminObjectIds = null, Uri hsmUri = null, bool? enableSoftDelete = null, int? softDeleteRetentionInDays = null, bool? enablePurgeProtection = null, ManagedHsmCreateMode? createMode = null, string statusMessage = null, ManagedHsmProvisioningState? provisioningState = null, ManagedHsmNetworkRuleSet networkRuleSet = null, IEnumerable regions = null, IEnumerable privateEndpointConnections = null, ManagedHsmPublicNetworkAccess? publicNetworkAccess = null, DateTimeOffset? scheduledPurgeOn = null, ManagedHSMSecurityDomainProperties securityDomainProperties = null)
+ public static ManagedHsmProperties ManagedHsmProperties(Guid? tenantId = default, IEnumerable initialAdminObjectIds = default, Uri hsmUri = default, bool? enableSoftDelete = default, int? softDeleteRetentionInDays = default, bool? enablePurgeProtection = default, ManagedHsmCreateMode? createMode = default, string statusMessage = default, ManagedHsmProvisioningState? provisioningState = default, ManagedHsmNetworkRuleSet networkRuleSet = default, IEnumerable regions = default, IEnumerable privateEndpointConnections = default, ManagedHsmPublicNetworkAccess? publicNetworkAccess = default, DateTimeOffset? scheduledPurgeOn = default, ManagedHSMSecurityDomainProperties securityDomainProperties = default)
{
- initialAdminObjectIds ??= new List();
- regions ??= new List();
- privateEndpointConnections ??= new List();
+ initialAdminObjectIds ??= new ChangeTrackingList();
+ regions ??= new ChangeTrackingList();
+ privateEndpointConnections ??= new ChangeTrackingList();
return new ManagedHsmProperties(
tenantId,
- initialAdminObjectIds?.ToList(),
+ initialAdminObjectIds.ToList(),
hsmUri,
enableSoftDelete,
softDeleteRetentionInDays,
@@ -188,332 +378,209 @@ public static ManagedHsmProperties ManagedHsmProperties(Guid? tenantId = null, I
statusMessage,
provisioningState,
networkRuleSet,
- regions?.ToList(),
- privateEndpointConnections?.ToList(),
+ regions.ToList(),
+ privateEndpointConnections.ToList(),
publicNetworkAccess,
scheduledPurgeOn,
securityDomainProperties,
- serializedAdditionalRawData: null);
+ additionalBinaryDataProperties: null);
}
- /// Initializes a new instance of .
+ /// A set of rules governing the network accessibility of a managed hsm pool.
+ /// Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'.
+ /// The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated.
+ /// The list of IP address rules.
+ /// The list of service tags.
+ /// The list of virtual network rules.
+ /// A new instance for mocking.
+ public static ManagedHsmNetworkRuleSet ManagedHsmNetworkRuleSet(ManagedHsmNetworkRuleBypassOption? bypass = default, ManagedHsmNetworkRuleAction? defaultAction = default, IEnumerable ipRules = default, IEnumerable serviceTags = default, IEnumerable virtualNetworkRules = default)
+ {
+ ipRules ??= new ChangeTrackingList();
+ serviceTags ??= new ChangeTrackingList();
+ virtualNetworkRules ??= new ChangeTrackingList();
+
+ return new ManagedHsmNetworkRuleSet(
+ bypass,
+ defaultAction,
+ ipRules.ToList(),
+ serviceTags.ToList(),
+ virtualNetworkRules.ToList(),
+ additionalBinaryDataProperties: null);
+ }
+
+ /// A region that this managed HSM Pool has been extended to.
/// Name of the geo replicated region.
/// Provisioning state of the geo replicated region.
/// A boolean value that indicates whether the region is the primary region or a secondary region.
/// A new instance for mocking.
- public static ManagedHsmGeoReplicatedRegion ManagedHsmGeoReplicatedRegion(string name = null, ManagedHsmGeoReplicatedRegionProvisioningState? provisioningState = null, bool? isPrimary = null)
+ public static ManagedHsmGeoReplicatedRegion ManagedHsmGeoReplicatedRegion(string name = default, ManagedHsmGeoReplicatedRegionProvisioningState? provisioningState = default, bool? isPrimary = default)
{
- return new ManagedHsmGeoReplicatedRegion(name, provisioningState, isPrimary, serializedAdditionalRawData: null);
+ return new ManagedHsmGeoReplicatedRegion(name, provisioningState, isPrimary, additionalBinaryDataProperties: null);
}
- /// Initializes a new instance of .
/// Id of private endpoint connection.
/// Modified whenever there is a change in the state of private endpoint connection.
- /// Properties of the private endpoint object.
/// Approval state of the private link connection.
/// Provisioning state of the private endpoint connection.
+ /// Full identifier of the private endpoint resource.
/// A new instance for mocking.
- public static ManagedHsmPrivateEndpointConnectionItemData ManagedHsmPrivateEndpointConnectionItemData(ResourceIdentifier id = null, ETag? etag = null, ResourceIdentifier privateEndpointId = null, ManagedHsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState = null, ManagedHsmPrivateEndpointConnectionProvisioningState? provisioningState = null)
+ public static ManagedHsmPrivateEndpointConnectionItemData ManagedHsmPrivateEndpointConnectionItemData(ResourceIdentifier id = default, ETag? etag = default, ManagedHsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState = default, ManagedHsmPrivateEndpointConnectionProvisioningState? provisioningState = default, string privateEndpointId = default)
{
- return new ManagedHsmPrivateEndpointConnectionItemData(
- id,
- etag,
- privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null,
- privateLinkServiceConnectionState,
- provisioningState,
- serializedAdditionalRawData: null);
+ return new ManagedHsmPrivateEndpointConnectionItemData(id, etag, privateLinkServiceConnectionState is null && provisioningState is null && privateEndpointId is null ? default : new ManagedHsmPrivateEndpointConnectionProperties(new ManagedHsmPrivateEndpoint(privateEndpointId, null), privateLinkServiceConnectionState, provisioningState, null), additionalBinaryDataProperties: null);
}
- /// Initializes a new instance of .
+ /// The security domain properties of the managed hsm.
/// Activation Status.
/// Activation Status Message.
/// A new instance for mocking.
- public static ManagedHSMSecurityDomainProperties ManagedHSMSecurityDomainProperties(ManagedHSMSecurityDomainActivationStatus? activationStatus = null, string activationStatusMessage = null)
+ public static ManagedHSMSecurityDomainProperties ManagedHSMSecurityDomainProperties(ManagedHSMSecurityDomainActivationStatus? activationStatus = default, string activationStatusMessage = default)
{
- return new ManagedHSMSecurityDomainProperties(activationStatus, activationStatusMessage, serializedAdditionalRawData: null);
+ return new ManagedHSMSecurityDomainProperties(activationStatus, activationStatusMessage, additionalBinaryDataProperties: null);
}
- /// Initializes a new instance of .
- /// The id.
- /// The name.
- /// The resourceType.
- /// The systemData.
- /// The tags.
- /// The location.
- /// Properties of the vault.
- /// A new instance for mocking.
- public static KeyVaultData KeyVaultData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, KeyVaultProperties properties = null)
+ /// A list of private link resources.
+ /// Array of private link resources.
+ /// A new instance for mocking.
+ public static ManagedHsmPrivateLinkResourceListResult ManagedHsmPrivateLinkResourceListResult(IEnumerable value = default)
{
- tags ??= new Dictionary();
+ value ??= new ChangeTrackingList();
- return new KeyVaultData(
- id,
- name,
- resourceType,
- systemData,
- tags,
- location,
- properties,
- serializedAdditionalRawData: null);
+ return new ManagedHsmPrivateLinkResourceListResult(value.ToList(), additionalBinaryDataProperties: null);
}
- /// Initializes a new instance of .
- /// The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault.
- /// SKU details.
- /// 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.
- /// The URI of the vault for performing operations on keys and secrets.
- /// The resource id of HSM Pool.
- /// Property to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from the key vault.
- /// Property to specify whether Azure Disk Encryption is permitted to retrieve secrets from the vault and unwrap keys.
- /// Property to specify whether Azure Resource Manager is permitted to retrieve secrets from the key vault.
- /// 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.
- /// softDelete data retention days. It accepts >=7 and <=90.
- /// 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.
- /// The vault's create mode to indicate whether the vault need to be recovered or not.
- /// 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.
- /// Rules governing the accessibility of the key vault from specific network locations.
- /// Provisioning state of the vault.
- /// List of private endpoint connections associated with the key vault.
- /// 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.
- /// A new instance for mocking.
- public static KeyVaultProperties KeyVaultProperties(Guid tenantId = default, KeyVaultSku sku = null, IEnumerable accessPolicies = null, Uri vaultUri = null, string hsmPoolResourceId = null, bool? enabledForDeployment = null, bool? enabledForDiskEncryption = null, bool? enabledForTemplateDeployment = null, bool? enableSoftDelete = null, int? softDeleteRetentionInDays = null, bool? enableRbacAuthorization = null, KeyVaultCreateMode? createMode = null, bool? enablePurgeProtection = null, KeyVaultNetworkRuleSet networkRuleSet = null, KeyVaultProvisioningState? provisioningState = null, IEnumerable privateEndpointConnections = null, string publicNetworkAccess = null)
- {
- accessPolicies ??= new List();
- privateEndpointConnections ??= new List();
-
- return new KeyVaultProperties(
- tenantId,
- sku,
- accessPolicies?.ToList(),
- vaultUri,
- hsmPoolResourceId,
- enabledForDeployment,
- enabledForDiskEncryption,
- enabledForTemplateDeployment,
- enableSoftDelete,
- softDeleteRetentionInDays,
- enableRbacAuthorization,
- createMode,
- enablePurgeProtection,
- networkRuleSet,
- provisioningState,
- privateEndpointConnections?.ToList(),
- publicNetworkAccess,
- serializedAdditionalRawData: null);
- }
-
- /// Initializes a new instance of .
- /// Id of private endpoint connection.
- /// Modified whenever there is a change in the state of private endpoint connection.
- /// Properties of the private endpoint object.
- /// Approval state of the private link connection.
- /// Provisioning state of the private endpoint connection.
- /// A new instance for mocking.
- public static KeyVaultPrivateEndpointConnectionItemData KeyVaultPrivateEndpointConnectionItemData(string id = null, ETag? etag = null, ResourceIdentifier privateEndpointId = null, KeyVaultPrivateLinkServiceConnectionState connectionState = null, KeyVaultPrivateEndpointConnectionProvisioningState? provisioningState = null)
- {
- return new KeyVaultPrivateEndpointConnectionItemData(
- id,
- etag,
- privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null,
- connectionState,
- provisioningState,
- serializedAdditionalRawData: null);
- }
-
- /// Initializes a new instance of .
- /// The id.
- /// The name.
- /// The resourceType.
- /// The systemData.
- /// The tags.
- /// The location.
- /// SKU details.
- /// Managed service identity.
- /// Modified whenever there is a change in the state of private endpoint connection.
- /// Properties of the private endpoint object.
- /// Approval state of the private link connection.
- /// Provisioning state of the private endpoint connection.
- /// A new instance for mocking.
- public static ManagedHsmPrivateEndpointConnectionData ManagedHsmPrivateEndpointConnectionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ManagedHsmSku sku = null, ManagedServiceIdentity identity = null, ETag? etag = null, ResourceIdentifier privateEndpointId = null, ManagedHsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState = null, ManagedHsmPrivateEndpointConnectionProvisioningState? provisioningState = null)
- {
- tags ??= new Dictionary();
-
- return new ManagedHsmPrivateEndpointConnectionData(
- id,
- name,
- resourceType,
- systemData,
- tags,
- location,
- sku,
- identity,
- etag,
- privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null,
- privateLinkServiceConnectionState,
- provisioningState,
- serializedAdditionalRawData: null);
- }
-
- /// Initializes a new instance of .
- /// The id.
- /// The name.
- /// The resourceType.
- /// The systemData.
- /// The tags.
- /// The location.
+ /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /// The name of the resource.
+ /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".
+ /// Azure Resource Manager metadata containing createdBy and modifiedBy information.
+ /// Resource tags.
+ /// The geo-location where the resource lives.
+ /// The provisioned state of the resource.
/// Group identifier of private link resource.
/// Required member names of private link resource.
/// Required DNS zone names of the the private link resource.
/// SKU details.
/// Managed service identity (system assigned and/or user assigned identities).
/// A new instance for mocking.
- public static ManagedHsmPrivateLinkResourceData ManagedHsmPrivateLinkResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, string groupId = null, IEnumerable requiredMembers = null, IEnumerable requiredZoneNames = null, ManagedHsmSku sku = null, ManagedServiceIdentity identity = null)
+ public static ManagedHsmPrivateLinkResourceData ManagedHsmPrivateLinkResourceData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, ManagedHsmProvisioningState? provisioningState = default, string groupId = default, IEnumerable requiredMembers = default, IEnumerable requiredZoneNames = default, ManagedHsmSku sku = default, ManagedServiceIdentity identity = default)
{
- tags ??= new Dictionary();
- requiredMembers ??= new List();
- requiredZoneNames ??= new List();
+ tags ??= new ChangeTrackingDictionary();
return new ManagedHsmPrivateLinkResourceData(
id,
name,
resourceType,
systemData,
+ additionalBinaryDataProperties: null,
tags,
location,
- groupId,
- requiredMembers?.ToList(),
- requiredZoneNames?.ToList(),
+ provisioningState is null && groupId is null && requiredMembers is null && requiredZoneNames is null ? default : new MhsmPrivateLinkResourceProperties(provisioningState, groupId, (requiredMembers ?? new ChangeTrackingList()).ToList(), (requiredZoneNames ?? new ChangeTrackingList()).ToList(), null),
sku,
- identity,
- serializedAdditionalRawData: null);
- }
-
- /// Initializes a new instance of .
- /// The supported Azure location where the key vault should be created.
- /// The tags that will be assigned to the key vault.
- /// Properties of the vault.
- /// A new instance for mocking.
- public static KeyVaultCreateOrUpdateContent KeyVaultCreateOrUpdateContent(AzureLocation location = default, IDictionary tags = null, KeyVaultProperties properties = null)
- {
- tags ??= new Dictionary();
-
- return new KeyVaultCreateOrUpdateContent(location, tags, properties, serializedAdditionalRawData: null);
+ identity);
}
- /// Initializes a new instance of .
- /// The id.
- /// The name.
- /// The resourceType.
- /// The systemData.
- /// The resource type of the access policy.
- /// Properties of the access policy.
- /// A new instance for mocking.
- public static KeyVaultAccessPolicyParameters KeyVaultAccessPolicyParameters(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AzureLocation? location = null, IEnumerable accessPolicies = null)
+ /// Concrete proxy resource types can be created by aliasing this type using a specific property type.
+ /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /// The name of the resource.
+ /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".
+ /// Azure Resource Manager metadata containing createdBy and modifiedBy information.
+ /// Properties of the deleted managed HSM.
+ /// A new instance for mocking.
+ public static DeletedManagedHsmData DeletedManagedHsmData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, DeletedManagedHsmProperties properties = default)
{
- accessPolicies ??= new List();
-
- return new KeyVaultAccessPolicyParameters(
+ return new DeletedManagedHsmData(
id,
name,
resourceType,
systemData,
- location,
- accessPolicies != null ? new KeyVaultAccessPolicyProperties(accessPolicies?.ToList(), serializedAdditionalRawData: null) : null,
- serializedAdditionalRawData: null);
+ additionalBinaryDataProperties: null,
+ properties);
}
- /// Initializes a new instance of .
- /// The id.
- /// The name.
- /// The resourceType.
- /// The systemData.
- /// Azure location of the key vault resource.
- /// Tags assigned to the key vault resource.
- /// Modified whenever there is a change in the state of private endpoint connection.
- /// Properties of the private endpoint object.
- /// Approval state of the private link connection.
- /// Provisioning state of the private endpoint connection.
- /// A new instance for mocking.
- public static KeyVaultPrivateEndpointConnectionData KeyVaultPrivateEndpointConnectionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AzureLocation? location = null, IReadOnlyDictionary tags = null, ETag? etag = null, ResourceIdentifier privateEndpointId = null, KeyVaultPrivateLinkServiceConnectionState connectionState = null, KeyVaultPrivateEndpointConnectionProvisioningState? provisioningState = null)
+ /// Properties of the deleted managed HSM.
+ /// The resource id of the original managed HSM.
+ /// The location of the original managed HSM.
+ /// The deleted date.
+ /// The scheduled purged date.
+ /// Purge protection status of the original managed HSM.
+ /// Tags of the original managed HSM.
+ /// A new instance for mocking.
+ public static DeletedManagedHsmProperties DeletedManagedHsmProperties(ResourceIdentifier managedHsmId = default, AzureLocation? location = default, DateTimeOffset? deletedOn = default, DateTimeOffset? scheduledPurgeOn = default, bool? purgeProtectionEnabled = default, IReadOnlyDictionary tags = default)
{
- tags ??= new Dictionary();
+ tags ??= new ChangeTrackingDictionary();
- return new KeyVaultPrivateEndpointConnectionData(
- id,
- name,
- resourceType,
- systemData,
+ return new DeletedManagedHsmProperties(
+ managedHsmId,
location,
+ deletedOn,
+ scheduledPurgeOn,
+ purgeProtectionEnabled,
tags,
- etag,
- privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null,
- connectionState,
- provisioningState,
- serializedAdditionalRawData: null);
+ additionalBinaryDataProperties: null);
}
- /// Initializes a new instance of .
- /// The id.
- /// The name.
- /// The resourceType.
- /// The systemData.
- /// Azure location of the key vault resource.
- /// Tags assigned to the key vault resource.
- /// Group identifier of private link resource.
- /// Required member names of private link resource.
- /// Required DNS zone names of the the private link resource.
- /// A new instance for mocking.
- public static KeyVaultPrivateLinkResourceData KeyVaultPrivateLinkResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AzureLocation? location = null, IReadOnlyDictionary tags = null, string groupId = null, IEnumerable requiredMembers = null, IEnumerable requiredZoneNames = null)
+ /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /// The name of the resource.
+ /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".
+ /// Azure Resource Manager metadata containing createdBy and modifiedBy information.
+ /// Approval state of the private link connection.
+ /// Provisioning state of the private endpoint connection.
+ /// Full identifier of the private endpoint resource.
+ /// Resource tags.
+ /// The geo-location where the resource lives.
+ /// SKU details.
+ /// Managed service identity.
+ /// Modified whenever there is a change in the state of private endpoint connection.
+ /// A new instance for mocking.
+ public static ManagedHsmPrivateEndpointConnectionData ManagedHsmPrivateEndpointConnectionData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, ManagedHsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState = default, ManagedHsmPrivateEndpointConnectionProvisioningState? provisioningState = default, string privateEndpointId = default, IDictionary tags = default, AzureLocation? location = default, ManagedHsmSku sku = default, ManagedServiceIdentity identity = default, ETag? etag = default)
{
- tags ??= new Dictionary();
- requiredMembers ??= new List();
- requiredZoneNames ??= new List();
+ tags ??= new ChangeTrackingDictionary();
- return new KeyVaultPrivateLinkResourceData(
+ return new ManagedHsmPrivateEndpointConnectionData(
id,
name,
resourceType,
systemData,
- location,
+ additionalBinaryDataProperties: null,
+ privateLinkServiceConnectionState is null && provisioningState is null && privateEndpointId is null ? default : new ManagedHsmPrivateEndpointConnectionProperties(new ManagedHsmPrivateEndpoint(privateEndpointId, null), privateLinkServiceConnectionState, provisioningState, null),
tags,
- groupId,
- requiredMembers?.ToList(),
- requiredZoneNames?.ToList(),
- serializedAdditionalRawData: null);
+ location,
+ sku,
+ identity,
+ etag);
}
- /// Initializes a new instance of .
- /// The id.
- /// The name.
- /// The resourceType.
- /// The systemData.
+ /// Resource information with extended details.
+ /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /// The name of the resource.
+ /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".
+ /// Azure Resource Manager metadata containing createdBy and modifiedBy information.
/// Properties of the secret.
/// Azure location of the key vault resource.
/// Tags assigned to the key vault resource.
/// A new instance for mocking.
- public static KeyVaultSecretData KeyVaultSecretData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, SecretProperties properties = null, AzureLocation? location = null, IReadOnlyDictionary tags = null)
+ public static KeyVaultSecretData KeyVaultSecretData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, SecretProperties properties = default, AzureLocation? location = default, IReadOnlyDictionary tags = default)
{
- tags ??= new Dictionary();
+ tags ??= new ChangeTrackingDictionary();
return new KeyVaultSecretData(
id,
name,
resourceType,
systemData,
+ additionalBinaryDataProperties: null,
properties,
location,
- tags,
- serializedAdditionalRawData: null);
+ tags);
}
- /// Initializes a new instance of .
+ /// Properties of the secret.
/// 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.
/// The content type of the secret.
/// The attributes of the secret.
/// The URI to retrieve the current version of the secret.
/// The URI to retrieve the specific version of the secret.
/// A new instance for mocking.
- public static SecretProperties SecretProperties(string value = null, string contentType = null, SecretAttributes attributes = null, Uri secretUri = null, string secretUriWithVersion = null)
+ public static SecretProperties SecretProperties(string value = default, string contentType = default, SecretAttributes attributes = default, Uri secretUri = default, string secretUriWithVersion = default)
{
return new SecretProperties(
value,
@@ -521,17 +588,17 @@ public static SecretProperties SecretProperties(string value = null, string cont
attributes,
secretUri,
secretUriWithVersion,
- serializedAdditionalRawData: null);
+ additionalBinaryDataProperties: null);
}
- /// Initializes a new instance of .
+ /// The secret management attributes.
/// Determines whether the object is enabled.
/// Not before date in seconds since 1970-01-01T00:00:00Z.
/// Expiry date in seconds since 1970-01-01T00:00:00Z.
/// Creation time in seconds since 1970-01-01T00:00:00Z.
/// Last updated time in seconds since 1970-01-01T00:00:00Z.
/// A new instance for mocking.
- public static SecretAttributes SecretAttributes(bool? enabled = null, DateTimeOffset? notBefore = null, DateTimeOffset? expires = null, DateTimeOffset? created = null, DateTimeOffset? updated = null)
+ public static SecretAttributes SecretAttributes(bool? enabled = default, DateTimeOffset? notBefore = default, DateTimeOffset? expires = default, DateTimeOffset? created = default, DateTimeOffset? updated = default)
{
return new SecretAttributes(
enabled,
@@ -539,17 +606,17 @@ public static SecretAttributes SecretAttributes(bool? enabled = null, DateTimeOf
expires,
created,
updated,
- serializedAdditionalRawData: null);
+ additionalBinaryDataProperties: null);
}
- /// Initializes a new instance of .
+ /// The object attributes managed by the KeyVault service.
/// Determines whether the object is enabled.
/// Not before date in seconds since 1970-01-01T00:00:00Z.
/// Expiry date in seconds since 1970-01-01T00:00:00Z.
/// Creation time in seconds since 1970-01-01T00:00:00Z.
/// Last updated time in seconds since 1970-01-01T00:00:00Z.
/// A new instance for mocking.
- public static SecretBaseAttributes SecretBaseAttributes(bool? enabled = null, DateTimeOffset? notBefore = null, DateTimeOffset? expires = null, DateTimeOffset? created = null, DateTimeOffset? updated = null)
+ public static SecretBaseAttributes SecretBaseAttributes(bool? enabled = default, DateTimeOffset? notBefore = default, DateTimeOffset? expires = default, DateTimeOffset? created = default, DateTimeOffset? updated = default)
{
return new SecretBaseAttributes(
enabled,
@@ -557,18 +624,66 @@ public static SecretBaseAttributes SecretBaseAttributes(bool? enabled = null, Da
expires,
created,
updated,
- serializedAdditionalRawData: null);
+ additionalBinaryDataProperties: null);
+ }
+
+ /// Parameters for creating or updating a secret.
+ /// The tags that will be assigned to the secret.
+ /// Properties of the secret.
+ /// A new instance for mocking.
+ public static SecretCreateOrUpdateParameters SecretCreateOrUpdateParameters(IDictionary tags = default, SecretProperties properties = default)
+ {
+ tags ??= new ChangeTrackingDictionary();
+
+ return new SecretCreateOrUpdateParameters(tags, properties, additionalBinaryDataProperties: null);
}
- /// Initializes a new instance of .
+ /// Parameters for patching a secret.
/// The tags that will be assigned to the secret.
/// Properties of the secret.
- /// A new instance for mocking.
- public static KeyVaultSecretCreateOrUpdateContent KeyVaultSecretCreateOrUpdateContent(IDictionary tags = null, SecretProperties properties = null)
+ /// A new instance for mocking.
+ public static KeyVaultSecretPatch KeyVaultSecretPatch(IDictionary tags = default, SecretPatchProperties properties = default)
+ {
+ tags ??= new ChangeTrackingDictionary();
+
+ return new KeyVaultSecretPatch(tags, properties, additionalBinaryDataProperties: null);
+ }
+
+ /// The parameters used to check the availability of the vault name.
+ /// The vault name.
+ /// The type of resource, Microsoft.KeyVault/vaults.
+ /// A new instance for mocking.
+ public static KeyVaultNameAvailabilityContent KeyVaultNameAvailabilityContent(string name = default, ResourceType resourceType = default)
{
- tags ??= new Dictionary();
+ return new KeyVaultNameAvailabilityContent(name, resourceType, additionalBinaryDataProperties: null);
+ }
- return new KeyVaultSecretCreateOrUpdateContent(tags, properties, serializedAdditionalRawData: null);
+ /// The CheckNameAvailability operation response.
+ /// 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.
+ /// The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false.
+ /// An error message explaining the Reason value in more detail.
+ /// A new instance for mocking.
+ public static KeyVaultNameAvailabilityResult KeyVaultNameAvailabilityResult(bool? nameAvailable = default, KeyVaultNameUnavailableReason? reason = default, string message = default)
+ {
+ return new KeyVaultNameAvailabilityResult(nameAvailable, reason, message, additionalBinaryDataProperties: null);
+ }
+
+ /// The parameters used to check the availability of the managed hsm name.
+ /// The managed hsm name.
+ /// A new instance for mocking.
+ public static ManagedHsmNameAvailabilityParameters ManagedHsmNameAvailabilityParameters(string name = default)
+ {
+ return new ManagedHsmNameAvailabilityParameters(name, additionalBinaryDataProperties: null);
+ }
+
+ /// The CheckMhsmNameAvailability operation response.
+ /// 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.
+ /// The reason that a managed hsm name could not be used. The reason element is only returned if NameAvailable is false.
+ /// An error message explaining the Reason value in more detail.
+ /// A new instance for mocking.
+ public static ManagedHsmNameAvailabilityResult ManagedHsmNameAvailabilityResult(bool? isNameAvailable = default, ManagedHsmNameUnavailableReason? reason = default, string message = default)
+ {
+ return new ManagedHsmNameAvailabilityResult(isNameAvailable, reason, message, additionalBinaryDataProperties: null);
}
}
}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultCollection.cs
index 046bf57e3925..f3f65b3c9050 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultCollection.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultCollection.cs
@@ -6,86 +6,94 @@
#nullable disable
using System;
-using System.Globalization;
+using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
+using Azure;
using Azure.Core;
using Azure.Core.Pipeline;
+using Azure.ResourceManager;
using Azure.ResourceManager.Resources;
namespace Azure.ResourceManager.KeyVault
{
///
/// A class representing a collection of and their operations.
- /// Each in the collection will belong to the same instance of .
- /// To get a instance call the GetDeletedKeyVaults method from an instance of .
+ /// Each in the collection will belong to the same instance of a parent resource (TODO: add parent resource information).
+ /// To get a instance call the GetDeletedKeyVaults method from an instance of the parent resource.
///
public partial class DeletedKeyVaultCollection : ArmCollection
{
- private readonly ClientDiagnostics _deletedKeyVaultVaultsClientDiagnostics;
- private readonly VaultsRestOperations _deletedKeyVaultVaultsRestClient;
+ private readonly ClientDiagnostics _deletedVaultsClientDiagnostics;
+ private readonly DeletedVaults _deletedVaultsRestClient;
- /// Initializes a new instance of the class for mocking.
+ /// Initializes a new instance of DeletedKeyVaultCollection for mocking.
protected DeletedKeyVaultCollection()
{
}
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of class.
/// The client parameters to use in these operations.
- /// The identifier of the parent resource that is the target of operations.
+ /// The identifier of the resource that is the target of operations.
internal DeletedKeyVaultCollection(ArmClient client, ResourceIdentifier id) : base(client, id)
{
- _deletedKeyVaultVaultsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", DeletedKeyVaultResource.ResourceType.Namespace, Diagnostics);
- TryGetApiVersion(DeletedKeyVaultResource.ResourceType, out string deletedKeyVaultVaultsApiVersion);
- _deletedKeyVaultVaultsRestClient = new VaultsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, deletedKeyVaultVaultsApiVersion);
-#if DEBUG
- ValidateResourceId(Id);
-#endif
+ TryGetApiVersion(DeletedKeyVaultResource.ResourceType, out string deletedKeyVaultApiVersion);
+ _deletedVaultsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", DeletedKeyVaultResource.ResourceType.Namespace, Diagnostics);
+ _deletedVaultsRestClient = new DeletedVaults(_deletedVaultsClientDiagnostics, Pipeline, Endpoint, deletedKeyVaultApiVersion ?? "2025-05-01");
+ ValidateResourceId(id);
}
+ ///
+ [Conditional("DEBUG")]
internal static void ValidateResourceId(ResourceIdentifier id)
{
if (id.ResourceType != SubscriptionResource.ResourceType)
- throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, SubscriptionResource.ResourceType), nameof(id));
+ {
+ throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, SubscriptionResource.ResourceType), id);
+ }
}
///
/// Gets the deleted Azure key vault.
///
/// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}
- ///
- /// -
- /// Operation Id
- /// Vaults_GetDeleted
+ /// Request Path.
+ /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}.
///
/// -
- /// Default Api Version
- /// 2025-05-01
+ /// Operation Id.
+ /// DeletedVaults_GetDeleted.
///
/// -
- /// Resource
- ///
+ /// Default Api Version.
+ /// 2025-05-01.
///
///
///
/// The name of the Azure region.
/// The name of the vault.
/// The cancellation token to use.
- /// is an empty string, and was expected to be non-empty.
/// is null.
- public virtual async Task> GetAsync(AzureLocation location, string vaultName, CancellationToken cancellationToken = default)
+ /// is an empty string, and was expected to be non-empty.
+ public virtual async Task> GetDeletedAsync(AzureLocation location, string vaultName, CancellationToken cancellationToken = default)
{
Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName));
- using var scope = _deletedKeyVaultVaultsClientDiagnostics.CreateScope("DeletedKeyVaultCollection.Get");
+ using DiagnosticScope scope = _deletedVaultsClientDiagnostics.CreateScope("DeletedKeyVaultCollection.GetDeleted");
scope.Start();
try
{
- var response = await _deletedKeyVaultVaultsRestClient.GetDeletedAsync(Id.SubscriptionId, location, vaultName, cancellationToken).ConfigureAwait(false);
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ HttpMessage message = _deletedVaultsRestClient.CreateGetDeletedRequest(Guid.Parse(Id.SubscriptionId), location, vaultName, context);
+ Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ Response response = Response.FromValue(DeletedKeyVaultData.FromResponse(result), result);
if (response.Value == null)
+ {
throw new RequestFailedException(response.GetRawResponse());
+ }
return Response.FromValue(new DeletedKeyVaultResource(Client, response.Value), response.GetRawResponse());
}
catch (Exception e)
@@ -99,39 +107,43 @@ public virtual async Task> GetAsync(AzureLocat
/// Gets the deleted Azure key vault.
///
/// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}
- ///
- /// -
- /// Operation Id
- /// Vaults_GetDeleted
+ /// Request Path.
+ /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}.
///
/// -
- /// Default Api Version
- /// 2025-05-01
+ /// Operation Id.
+ /// DeletedVaults_GetDeleted.
///
/// -
- /// Resource
- ///
+ /// Default Api Version.
+ /// 2025-05-01.
///
///
///
/// The name of the Azure region.
/// The name of the vault.
/// The cancellation token to use.
- /// is an empty string, and was expected to be non-empty.
/// is null.
- public virtual Response Get(AzureLocation location, string vaultName, CancellationToken cancellationToken = default)
+ /// is an empty string, and was expected to be non-empty.
+ public virtual Response GetDeleted(AzureLocation location, string vaultName, CancellationToken cancellationToken = default)
{
Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName));
- using var scope = _deletedKeyVaultVaultsClientDiagnostics.CreateScope("DeletedKeyVaultCollection.Get");
+ using DiagnosticScope scope = _deletedVaultsClientDiagnostics.CreateScope("DeletedKeyVaultCollection.GetDeleted");
scope.Start();
try
{
- var response = _deletedKeyVaultVaultsRestClient.GetDeleted(Id.SubscriptionId, location, vaultName, cancellationToken);
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ HttpMessage message = _deletedVaultsRestClient.CreateGetDeletedRequest(Guid.Parse(Id.SubscriptionId), location, vaultName, context);
+ Response result = Pipeline.ProcessMessage(message, context);
+ Response response = Response.FromValue(DeletedKeyVaultData.FromResponse(result), result);
if (response.Value == null)
+ {
throw new RequestFailedException(response.GetRawResponse());
+ }
return Response.FromValue(new DeletedKeyVaultResource(Client, response.Value), response.GetRawResponse());
}
catch (Exception e)
@@ -142,40 +154,54 @@ public virtual Response Get(AzureLocation location, str
}
///
- /// Checks to see if the resource exists in azure.
+ /// Gets the deleted Azure key vault.
///
/// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}
+ /// Request Path.
+ /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}.
///
/// -
- /// Operation Id
- /// Vaults_GetDeleted
+ /// Operation Id.
+ /// DeletedVaults_GetDeleted.
///
/// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
+ /// Default Api Version.
+ /// 2025-05-01.
///
///
///
/// The name of the Azure region.
/// The name of the vault.
/// The cancellation token to use.
- /// is an empty string, and was expected to be non-empty.
/// is null.
+ /// is an empty string, and was expected to be non-empty.
public virtual async Task> ExistsAsync(AzureLocation location, string vaultName, CancellationToken cancellationToken = default)
{
Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName));
- using var scope = _deletedKeyVaultVaultsClientDiagnostics.CreateScope("DeletedKeyVaultCollection.Exists");
+ using DiagnosticScope scope = _deletedVaultsClientDiagnostics.CreateScope("DeletedKeyVaultCollection.Exists");
scope.Start();
try
{
- var response = await _deletedKeyVaultVaultsRestClient.GetDeletedAsync(Id.SubscriptionId, location, vaultName, cancellationToken: cancellationToken).ConfigureAwait(false);
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ HttpMessage message = _deletedVaultsRestClient.CreateGetDeletedRequest(Guid.Parse(Id.SubscriptionId), location, vaultName, context);
+ await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false);
+ Response result = message.Response;
+ Response response = default;
+ switch (result.Status)
+ {
+ case 200:
+ response = Response.FromValue(DeletedKeyVaultData.FromResponse(result), result);
+ break;
+ case 404:
+ response = Response.FromValue((DeletedKeyVaultData)null, result);
+ break;
+ default:
+ throw new RequestFailedException(result);
+ }
return Response.FromValue(response.Value != null, response.GetRawResponse());
}
catch (Exception e)
@@ -186,40 +212,54 @@ public virtual async Task> ExistsAsync(AzureLocation location, st
}
///
- /// Checks to see if the resource exists in azure.
+ /// Gets the deleted Azure key vault.
///
/// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}
- ///
- /// -
- /// Operation Id
- /// Vaults_GetDeleted
+ /// Request Path.
+ /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}.
///
/// -
- /// Default Api Version
- /// 2025-05-01
+ /// Operation Id.
+ /// DeletedVaults_GetDeleted.
///
/// -
- /// Resource
- ///
+ /// Default Api Version.
+ /// 2025-05-01.
///
///
///
/// The name of the Azure region.
/// The name of the vault.
/// The cancellation token to use.
- /// is an empty string, and was expected to be non-empty.
/// is null.
+ /// is an empty string, and was expected to be non-empty.
public virtual Response Exists(AzureLocation location, string vaultName, CancellationToken cancellationToken = default)
{
Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName));
- using var scope = _deletedKeyVaultVaultsClientDiagnostics.CreateScope("DeletedKeyVaultCollection.Exists");
+ using DiagnosticScope scope = _deletedVaultsClientDiagnostics.CreateScope("DeletedKeyVaultCollection.Exists");
scope.Start();
try
{
- var response = _deletedKeyVaultVaultsRestClient.GetDeleted(Id.SubscriptionId, location, vaultName, cancellationToken: cancellationToken);
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ HttpMessage message = _deletedVaultsRestClient.CreateGetDeletedRequest(Guid.Parse(Id.SubscriptionId), location, vaultName, context);
+ Pipeline.Send(message, context.CancellationToken);
+ Response result = message.Response;
+ Response response = default;
+ switch (result.Status)
+ {
+ case 200:
+ response = Response.FromValue(DeletedKeyVaultData.FromResponse(result), result);
+ break;
+ case 404:
+ response = Response.FromValue((DeletedKeyVaultData)null, result);
+ break;
+ default:
+ throw new RequestFailedException(result);
+ }
return Response.FromValue(response.Value != null, response.GetRawResponse());
}
catch (Exception e)
@@ -230,42 +270,58 @@ public virtual Response Exists(AzureLocation location, string vaultName, C
}
///
- /// Tries to get details for this resource from the service.
+ /// Gets the deleted Azure key vault.
///
/// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}
- ///
- /// -
- /// Operation Id
- /// Vaults_GetDeleted
+ /// Request Path.
+ /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}.
///
/// -
- /// Default Api Version
- /// 2025-05-01
+ /// Operation Id.
+ /// DeletedVaults_GetDeleted.
///
/// -
- /// Resource
- ///
+ /// Default Api Version.
+ /// 2025-05-01.
///
///
///
/// The name of the Azure region.
/// The name of the vault.
/// The cancellation token to use.
- /// is an empty string, and was expected to be non-empty.
/// is null.
+ /// is an empty string, and was expected to be non-empty.
public virtual async Task> GetIfExistsAsync(AzureLocation location, string vaultName, CancellationToken cancellationToken = default)
{
Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName));
- using var scope = _deletedKeyVaultVaultsClientDiagnostics.CreateScope("DeletedKeyVaultCollection.GetIfExists");
+ using DiagnosticScope scope = _deletedVaultsClientDiagnostics.CreateScope("DeletedKeyVaultCollection.GetIfExists");
scope.Start();
try
{
- var response = await _deletedKeyVaultVaultsRestClient.GetDeletedAsync(Id.SubscriptionId, location, vaultName, cancellationToken: cancellationToken).ConfigureAwait(false);
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ HttpMessage message = _deletedVaultsRestClient.CreateGetDeletedRequest(Guid.Parse(Id.SubscriptionId), location, vaultName, context);
+ await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false);
+ Response result = message.Response;
+ Response response = default;
+ switch (result.Status)
+ {
+ case 200:
+ response = Response.FromValue(DeletedKeyVaultData.FromResponse(result), result);
+ break;
+ case 404:
+ response = Response.FromValue((DeletedKeyVaultData)null, result);
+ break;
+ default:
+ throw new RequestFailedException(result);
+ }
if (response.Value == null)
+ {
return new NoValueResponse(response.GetRawResponse());
+ }
return Response.FromValue(new DeletedKeyVaultResource(Client, response.Value), response.GetRawResponse());
}
catch (Exception e)
@@ -276,42 +332,58 @@ public virtual async Task> GetIfExists
}
///
- /// Tries to get details for this resource from the service.
+ /// Gets the deleted Azure key vault.
///
/// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}
+ /// Request Path.
+ /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}.
///
/// -
- /// Operation Id
- /// Vaults_GetDeleted
+ /// Operation Id.
+ /// DeletedVaults_GetDeleted.
///
/// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
+ /// Default Api Version.
+ /// 2025-05-01.
///
///
///
/// The name of the Azure region.
/// The name of the vault.
/// The cancellation token to use.
- /// is an empty string, and was expected to be non-empty.
/// is null.
+ /// is an empty string, and was expected to be non-empty.
public virtual NullableResponse GetIfExists(AzureLocation location, string vaultName, CancellationToken cancellationToken = default)
{
Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName));
- using var scope = _deletedKeyVaultVaultsClientDiagnostics.CreateScope("DeletedKeyVaultCollection.GetIfExists");
+ using DiagnosticScope scope = _deletedVaultsClientDiagnostics.CreateScope("DeletedKeyVaultCollection.GetIfExists");
scope.Start();
try
{
- var response = _deletedKeyVaultVaultsRestClient.GetDeleted(Id.SubscriptionId, location, vaultName, cancellationToken: cancellationToken);
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ HttpMessage message = _deletedVaultsRestClient.CreateGetDeletedRequest(Guid.Parse(Id.SubscriptionId), location, vaultName, context);
+ Pipeline.Send(message, context.CancellationToken);
+ Response result = message.Response;
+ Response response = default;
+ switch (result.Status)
+ {
+ case 200:
+ response = Response.FromValue(DeletedKeyVaultData.FromResponse(result), result);
+ break;
+ case 404:
+ response = Response.FromValue((DeletedKeyVaultData)null, result);
+ break;
+ default:
+ throw new RequestFailedException(result);
+ }
if (response.Value == null)
+ {
return new NoValueResponse(response.GetRawResponse());
+ }
return Response.FromValue(new DeletedKeyVaultResource(Client, response.Value), response.GetRawResponse());
}
catch (Exception e)
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultData.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultData.Serialization.cs
index c84c818136be..58d9d2b1f7bb 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultData.Serialization.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultData.Serialization.cs
@@ -10,16 +10,18 @@
using System.Collections.Generic;
using System.Text;
using System.Text.Json;
+using Azure;
using Azure.Core;
using Azure.ResourceManager.KeyVault.Models;
using Azure.ResourceManager.Models;
namespace Azure.ResourceManager.KeyVault
{
- public partial class DeletedKeyVaultData : IUtf8JsonSerializable, IJsonModel
+ /// Deleted vault information with extended details.
+ public partial class DeletedKeyVaultData : ResourceData, IJsonModel
{
- void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
-
+ /// The JSON writer.
+ /// The client options for reading and writing models.
void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
{
writer.WriteStartObject();
@@ -31,12 +33,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri
/// The client options for reading and writing models.
protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options)
{
- var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
if (format != "J")
{
throw new FormatException($"The model {nameof(DeletedKeyVaultData)} does not support writing '{format}' format.");
}
-
base.JsonModelWriteCore(writer, options);
if (Optional.IsDefined(Properties))
{
@@ -45,190 +46,124 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri
}
}
- DeletedKeyVaultData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ /// The JSON reader.
+ /// The client options for reading and writing models.
+ DeletedKeyVaultData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DeletedKeyVaultData)JsonModelCreateCore(ref reader, options);
+
+ /// The JSON reader.
+ /// The client options for reading and writing models.
+ protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
{
- var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
if (format != "J")
{
throw new FormatException($"The model {nameof(DeletedKeyVaultData)} does not support reading '{format}' format.");
}
-
using JsonDocument document = JsonDocument.ParseValue(ref reader);
return DeserializeDeletedKeyVaultData(document.RootElement, options);
}
- internal static DeletedKeyVaultData DeserializeDeletedKeyVaultData(JsonElement element, ModelReaderWriterOptions options = null)
+ /// The JSON element to deserialize.
+ /// The client options for reading and writing models.
+ internal static DeletedKeyVaultData DeserializeDeletedKeyVaultData(JsonElement element, ModelReaderWriterOptions options)
{
- options ??= ModelSerializationExtensions.WireOptions;
-
if (element.ValueKind == JsonValueKind.Null)
{
return null;
}
- DeletedKeyVaultProperties properties = default;
ResourceIdentifier id = default;
string name = default;
- ResourceType type = default;
+ ResourceType resourceType = default;
SystemData systemData = default;
- IDictionary serializedAdditionalRawData = default;
- Dictionary rawDataDictionary = new Dictionary();
- foreach (var property in element.EnumerateObject())
+ IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary();
+ DeletedKeyVaultProperties properties = default;
+ foreach (var prop in element.EnumerateObject())
{
- if (property.NameEquals("properties"u8))
+ if (prop.NameEquals("id"u8))
{
- if (property.Value.ValueKind == JsonValueKind.Null)
+ if (prop.Value.ValueKind == JsonValueKind.Null)
{
continue;
}
- properties = DeletedKeyVaultProperties.DeserializeDeletedKeyVaultProperties(property.Value, options);
+ id = new ResourceIdentifier(prop.Value.GetString());
continue;
}
- if (property.NameEquals("id"u8))
+ if (prop.NameEquals("name"u8))
{
- id = new ResourceIdentifier(property.Value.GetString());
+ name = prop.Value.GetString();
continue;
}
- if (property.NameEquals("name"u8))
+ if (prop.NameEquals("type"u8))
{
- name = property.Value.GetString();
+ if (prop.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ resourceType = new ResourceType(prop.Value.GetString());
continue;
}
- if (property.NameEquals("type"u8))
+ if (prop.NameEquals("systemData"u8))
{
- type = new ResourceType(property.Value.GetString());
+ if (prop.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerKeyVaultContext.Default);
continue;
}
- if (property.NameEquals("systemData"u8))
+ if (prop.NameEquals("properties"u8))
{
- if (property.Value.ValueKind == JsonValueKind.Null)
+ if (prop.Value.ValueKind == JsonValueKind.Null)
{
continue;
}
- systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerKeyVaultContext.Default);
+ properties = DeletedKeyVaultProperties.DeserializeDeletedKeyVaultProperties(prop.Value, options);
continue;
}
if (options.Format != "W")
{
- rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText()));
}
}
- serializedAdditionalRawData = rawDataDictionary;
return new DeletedKeyVaultData(
id,
name,
- type,
+ resourceType,
systemData,
- properties,
- serializedAdditionalRawData);
+ additionalBinaryDataProperties,
+ properties);
}
- private BinaryData SerializeBicep(ModelReaderWriterOptions options)
- {
- StringBuilder builder = new StringBuilder();
- BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
- IDictionary propertyOverrides = null;
- bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides);
- bool hasPropertyOverride = false;
- string propertyOverride = null;
-
- builder.AppendLine("{");
-
- hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride);
- if (hasPropertyOverride)
- {
- builder.Append(" name: ");
- builder.AppendLine(propertyOverride);
- }
- else
- {
- if (Optional.IsDefined(Name))
- {
- builder.Append(" name: ");
- if (Name.Contains(Environment.NewLine))
- {
- builder.AppendLine("'''");
- builder.AppendLine($"{Name}'''");
- }
- else
- {
- builder.AppendLine($"'{Name}'");
- }
- }
- }
-
- hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride);
- if (hasPropertyOverride)
- {
- builder.Append(" properties: ");
- builder.AppendLine(propertyOverride);
- }
- else
- {
- if (Optional.IsDefined(Properties))
- {
- builder.Append(" properties: ");
- BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: ");
- }
- }
-
- hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride);
- if (hasPropertyOverride)
- {
- builder.Append(" id: ");
- builder.AppendLine(propertyOverride);
- }
- else
- {
- if (Optional.IsDefined(Id))
- {
- builder.Append(" id: ");
- builder.AppendLine($"'{Id.ToString()}'");
- }
- }
-
- hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride);
- if (hasPropertyOverride)
- {
- builder.Append(" systemData: ");
- builder.AppendLine(propertyOverride);
- }
- else
- {
- if (Optional.IsDefined(SystemData))
- {
- builder.Append(" systemData: ");
- builder.AppendLine($"'{SystemData.ToString()}'");
- }
- }
-
- builder.AppendLine("}");
- return BinaryData.FromString(builder.ToString());
- }
+ /// The client options for reading and writing models.
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options);
- BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ /// The client options for reading and writing models.
+ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options)
{
- var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
-
+ string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
switch (format)
{
case "J":
return ModelReaderWriter.Write(this, options, AzureResourceManagerKeyVaultContext.Default);
- case "bicep":
- return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(DeletedKeyVaultData)} does not support writing '{options.Format}' format.");
}
}
- DeletedKeyVaultData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
- {
- var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ /// The data to parse.
+ /// The client options for reading and writing models.
+ DeletedKeyVaultData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DeletedKeyVaultData)PersistableModelCreateCore(data, options);
+ /// The data to parse.
+ /// The client options for reading and writing models.
+ protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options)
+ {
+ string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
switch (format)
{
case "J":
+ using (JsonDocument document = JsonDocument.Parse(data))
{
- using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions);
return DeserializeDeletedKeyVaultData(document.RootElement, options);
}
default:
@@ -236,6 +171,15 @@ DeletedKeyVaultData IPersistableModel.Create(BinaryData dat
}
}
+ /// The client options for reading and writing models.
string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// The to deserialize the from.
+ internal static DeletedKeyVaultData FromResponse(Response result)
+ {
+ using Response response = result;
+ using JsonDocument document = JsonDocument.Parse(response.Content);
+ return DeserializeDeletedKeyVaultData(document.RootElement, ModelSerializationExtensions.WireOptions);
+ }
}
}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultData.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultData.cs
index 394aa898d839..50c5e65a6c22 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultData.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultData.cs
@@ -13,43 +13,11 @@
namespace Azure.ResourceManager.KeyVault
{
- ///
- /// A class representing the DeletedKeyVault data model.
- /// Deleted vault information with extended details.
- ///
+ /// Deleted vault information with extended details.
public partial class DeletedKeyVaultData : ResourceData
{
- ///
- /// Keeps track of any properties unknown to the library.
- ///
- /// To assign an object to the value of this property use .
- ///
- ///
- /// To assign an already formatted json string to this property use .
- ///
- ///
- /// Examples:
- ///
- /// -
- /// BinaryData.FromObjectAsJson("foo")
- /// Creates a payload of "foo".
- ///
- /// -
- /// BinaryData.FromString("\"foo\"")
- /// Creates a payload of "foo".
- ///
- /// -
- /// BinaryData.FromObjectAsJson(new { key = "value" })
- /// Creates a payload of { "key": "value" }.
- ///
- /// -
- /// BinaryData.FromString("{\"key\": \"value\"}")
- /// Creates a payload of { "key": "value" }.
- ///
- ///
- ///
- ///
- private IDictionary _serializedAdditionalRawData;
+ /// Keeps track of any properties unknown to the library.
+ private protected readonly IDictionary _additionalBinaryDataProperties;
/// Initializes a new instance of .
internal DeletedKeyVaultData()
@@ -57,16 +25,16 @@ internal DeletedKeyVaultData()
}
/// Initializes a new instance of .
- /// The id.
- /// The name.
- /// The resourceType.
- /// The systemData.
+ /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /// The name of the resource.
+ /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".
+ /// Azure Resource Manager metadata containing createdBy and modifiedBy information.
+ /// Keeps track of any properties unknown to the library.
/// Properties of the vault.
- /// Keeps track of any properties unknown to the library.
- internal DeletedKeyVaultData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DeletedKeyVaultProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData)
+ internal DeletedKeyVaultData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, DeletedKeyVaultProperties properties) : base(id, name, resourceType, systemData)
{
+ _additionalBinaryDataProperties = additionalBinaryDataProperties;
Properties = properties;
- _serializedAdditionalRawData = serializedAdditionalRawData;
}
/// Properties of the vault.
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultResource.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultResource.Serialization.cs
index c2777d97ad2a..573c5abbdbce 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultResource.Serialization.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultResource.Serialization.cs
@@ -11,19 +11,29 @@
namespace Azure.ResourceManager.KeyVault
{
+ ///
public partial class DeletedKeyVaultResource : IJsonModel
{
- private static DeletedKeyVaultData s_dataDeserializationInstance;
- private static DeletedKeyVaultData DataDeserializationInstance => s_dataDeserializationInstance ??= new();
+ private static IJsonModel s_dataDeserializationInstance;
+ private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new DeletedKeyVaultData();
+
+ /// The writer to serialize the model to.
+ /// The client options for reading and writing models.
void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options);
- DeletedKeyVaultData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)DataDeserializationInstance).Create(ref reader, options);
+ /// The reader for deserializing the model.
+ /// The client options for reading and writing models.
+ DeletedKeyVaultData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options);
+ /// The client options for reading and writing models.
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerKeyVaultContext.Default);
+ /// The binary data to be processed.
+ /// The client options for reading and writing models.
DeletedKeyVaultData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerKeyVaultContext.Default);
- string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)DataDeserializationInstance).GetFormatFromOptions(options);
+ /// The client options for reading and writing models.
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options);
}
}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultResource.cs
index 23c208f85218..d9c8e1ac589e 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultResource.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultResource.cs
@@ -6,46 +6,36 @@
#nullable disable
using System;
-using System.Globalization;
+using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
+using Azure;
using Azure.Core;
using Azure.Core.Pipeline;
+using Azure.ResourceManager;
using Azure.ResourceManager.Resources;
namespace Azure.ResourceManager.KeyVault
{
///
- /// A Class representing a DeletedKeyVault along with the instance operations that can be performed on it.
- /// If you have a you can construct a
- /// from an instance of using the GetDeletedKeyVaultResource method.
- /// Otherwise you can get one from its parent resource using the GetDeletedKeyVault method.
+ /// A class representing a DeletedKeyVault along with the instance operations that can be performed on it.
+ /// If you have a you can construct a from an instance of using the GetResource method.
+ /// Otherwise you can get one from its parent resource using the GetDeletedKeyVaults method.
///
public partial class DeletedKeyVaultResource : ArmResource
{
- /// Generate the resource identifier of a instance.
- /// The subscriptionId.
- /// The location.
- /// The vaultName.
- public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location, string vaultName)
- {
- var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}";
- return new ResourceIdentifier(resourceId);
- }
-
- private readonly ClientDiagnostics _deletedKeyVaultVaultsClientDiagnostics;
- private readonly VaultsRestOperations _deletedKeyVaultVaultsRestClient;
+ private readonly ClientDiagnostics _deletedVaultsClientDiagnostics;
+ private readonly DeletedVaults _deletedVaultsRestClient;
private readonly DeletedKeyVaultData _data;
-
/// Gets the resource type for the operations.
public static readonly ResourceType ResourceType = "Microsoft.KeyVault/locations/deletedVaults";
- /// Initializes a new instance of the class for mocking.
+ /// Initializes a new instance of DeletedKeyVaultResource for mocking.
protected DeletedKeyVaultResource()
{
}
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of class.
/// The client parameters to use in these operations.
/// The resource that is the target of operations.
internal DeletedKeyVaultResource(ArmClient client, DeletedKeyVaultData data) : this(client, data.Id)
@@ -54,71 +44,92 @@ internal DeletedKeyVaultResource(ArmClient client, DeletedKeyVaultData data) : t
_data = data;
}
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of class.
/// The client parameters to use in these operations.
/// The identifier of the resource that is the target of operations.
internal DeletedKeyVaultResource(ArmClient client, ResourceIdentifier id) : base(client, id)
{
- _deletedKeyVaultVaultsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", ResourceType.Namespace, Diagnostics);
- TryGetApiVersion(ResourceType, out string deletedKeyVaultVaultsApiVersion);
- _deletedKeyVaultVaultsRestClient = new VaultsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, deletedKeyVaultVaultsApiVersion);
-#if DEBUG
- ValidateResourceId(Id);
-#endif
+ TryGetApiVersion(ResourceType, out string deletedKeyVaultApiVersion);
+ _deletedVaultsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", ResourceType.Namespace, Diagnostics);
+ _deletedVaultsRestClient = new DeletedVaults(_deletedVaultsClientDiagnostics, Pipeline, Endpoint, deletedKeyVaultApiVersion ?? "2025-05-01");
+ ValidateResourceId(id);
}
/// Gets whether or not the current instance has data.
public virtual bool HasData { get; }
/// Gets the data representing this Feature.
- /// Throws if there is no data loaded in the current instance.
public virtual DeletedKeyVaultData Data
{
get
{
if (!HasData)
+ {
throw new InvalidOperationException("The current instance does not have data, you must call Get first.");
+ }
return _data;
}
}
+ /// Generate the resource identifier for this resource.
+ /// The subscriptionId.
+ /// The location.
+ /// The vaultName.
+ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location, string vaultName)
+ {
+ string resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}";
+ return new ResourceIdentifier(resourceId);
+ }
+
+ ///
+ [Conditional("DEBUG")]
internal static void ValidateResourceId(ResourceIdentifier id)
{
if (id.ResourceType != ResourceType)
- throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id));
+ {
+ throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id);
+ }
}
///
/// Gets the deleted Azure key vault.
///
/// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}
+ /// Request Path.
+ /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}.
///
/// -
- /// Operation Id
- /// Vaults_GetDeleted
+ /// Operation Id.
+ /// DeletedVaults_GetDeleted.
///
/// -
- /// Default Api Version
- /// 2025-05-01
+ /// Default Api Version.
+ /// 2025-05-01.
///
/// -
- /// Resource
- ///
+ /// Resource.
+ /// .
///
///
///
/// The cancellation token to use.
- public virtual async Task> GetAsync(CancellationToken cancellationToken = default)
+ public virtual async Task> GetDeletedAsync(CancellationToken cancellationToken = default)
{
- using var scope = _deletedKeyVaultVaultsClientDiagnostics.CreateScope("DeletedKeyVaultResource.Get");
+ using DiagnosticScope scope = _deletedVaultsClientDiagnostics.CreateScope("DeletedKeyVaultResource.GetDeleted");
scope.Start();
try
{
- var response = await _deletedKeyVaultVaultsRestClient.GetDeletedAsync(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken).ConfigureAwait(false);
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ HttpMessage message = _deletedVaultsRestClient.CreateGetDeletedRequest(Guid.Parse(Id.SubscriptionId), Id.Parent.Name, Id.Name, context);
+ Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ Response response = Response.FromValue(DeletedKeyVaultData.FromResponse(result), result);
if (response.Value == null)
+ {
throw new RequestFailedException(response.GetRawResponse());
+ }
return Response.FromValue(new DeletedKeyVaultResource(Client, response.Value), response.GetRawResponse());
}
catch (Exception e)
@@ -132,33 +143,41 @@ public virtual async Task> GetAsync(Cancellati
/// Gets the deleted Azure key vault.
///
/// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}
+ /// Request Path.
+ /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}.
///
/// -
- /// Operation Id
- /// Vaults_GetDeleted
+ /// Operation Id.
+ /// DeletedVaults_GetDeleted.
///
/// -
- /// Default Api Version
- /// 2025-05-01
+ /// Default Api Version.
+ /// 2025-05-01.
///
/// -
- /// Resource
- ///
+ /// Resource.
+ /// .
///
///
///
/// The cancellation token to use.
- public virtual Response Get(CancellationToken cancellationToken = default)
+ public virtual Response GetDeleted(CancellationToken cancellationToken = default)
{
- using var scope = _deletedKeyVaultVaultsClientDiagnostics.CreateScope("DeletedKeyVaultResource.Get");
+ using DiagnosticScope scope = _deletedVaultsClientDiagnostics.CreateScope("DeletedKeyVaultResource.GetDeleted");
scope.Start();
try
{
- var response = _deletedKeyVaultVaultsRestClient.GetDeleted(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken);
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ HttpMessage message = _deletedVaultsRestClient.CreateGetDeletedRequest(Guid.Parse(Id.SubscriptionId), Id.Parent.Name, Id.Name, context);
+ Response result = Pipeline.ProcessMessage(message, context);
+ Response response = Response.FromValue(DeletedKeyVaultData.FromResponse(result), result);
if (response.Value == null)
+ {
throw new RequestFailedException(response.GetRawResponse());
+ }
return Response.FromValue(new DeletedKeyVaultResource(Client, response.Value), response.GetRawResponse());
}
catch (Exception e)
@@ -172,20 +191,20 @@ public virtual Response Get(CancellationToken cancellat
/// Permanently deletes the specified vault. aka Purges the deleted Azure key vault.
///
/// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge
+ /// Request Path.
+ /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge.
///
/// -
- /// Operation Id
- /// Vaults_PurgeDeleted
+ /// Operation Id.
+ /// DeletedVaults_PurgeDeleted.
///
/// -
- /// Default Api Version
- /// 2025-05-01
+ /// Default Api Version.
+ /// 2025-05-01.
///
/// -
- /// Resource
- ///
+ /// Resource.
+ /// .
///
///
///
@@ -193,14 +212,21 @@ public virtual Response Get(CancellationToken cancellat
/// The cancellation token to use.
public virtual async Task PurgeDeletedAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default)
{
- using var scope = _deletedKeyVaultVaultsClientDiagnostics.CreateScope("DeletedKeyVaultResource.PurgeDeleted");
+ using DiagnosticScope scope = _deletedVaultsClientDiagnostics.CreateScope("DeletedKeyVaultResource.PurgeDeleted");
scope.Start();
try
{
- var response = await _deletedKeyVaultVaultsRestClient.PurgeDeletedAsync(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken).ConfigureAwait(false);
- var operation = new KeyVaultArmOperation(_deletedKeyVaultVaultsClientDiagnostics, Pipeline, _deletedKeyVaultVaultsRestClient.CreatePurgeDeletedRequest(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name).Request, response, OperationFinalStateVia.Location);
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ HttpMessage message = _deletedVaultsRestClient.CreatePurgeDeletedRequest(Guid.Parse(Id.SubscriptionId), Id.Parent.Name, Id.Name, context);
+ Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ KeyVaultArmOperation operation = new KeyVaultArmOperation(_deletedVaultsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location);
if (waitUntil == WaitUntil.Completed)
+ {
await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false);
+ }
return operation;
}
catch (Exception e)
@@ -214,20 +240,20 @@ public virtual async Task PurgeDeletedAsync(WaitUntil waitUntil, C
/// Permanently deletes the specified vault. aka Purges the deleted Azure key vault.
///
/// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge
+ /// Request Path.
+ /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge.
///
/// -
- /// Operation Id
- /// Vaults_PurgeDeleted
+ /// Operation Id.
+ /// DeletedVaults_PurgeDeleted.
///
/// -
- /// Default Api Version
- /// 2025-05-01
+ /// Default Api Version.
+ /// 2025-05-01.
///
/// -
- /// Resource
- ///
+ /// Resource.
+ /// .
///
///
///
@@ -235,14 +261,21 @@ public virtual async Task PurgeDeletedAsync(WaitUntil waitUntil, C
/// The cancellation token to use.
public virtual ArmOperation PurgeDeleted(WaitUntil waitUntil, CancellationToken cancellationToken = default)
{
- using var scope = _deletedKeyVaultVaultsClientDiagnostics.CreateScope("DeletedKeyVaultResource.PurgeDeleted");
+ using DiagnosticScope scope = _deletedVaultsClientDiagnostics.CreateScope("DeletedKeyVaultResource.PurgeDeleted");
scope.Start();
try
{
- var response = _deletedKeyVaultVaultsRestClient.PurgeDeleted(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken);
- var operation = new KeyVaultArmOperation(_deletedKeyVaultVaultsClientDiagnostics, Pipeline, _deletedKeyVaultVaultsRestClient.CreatePurgeDeletedRequest(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name).Request, response, OperationFinalStateVia.Location);
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ HttpMessage message = _deletedVaultsRestClient.CreatePurgeDeletedRequest(Guid.Parse(Id.SubscriptionId), Id.Parent.Name, Id.Name, context);
+ Response response = Pipeline.ProcessMessage(message, context);
+ KeyVaultArmOperation operation = new KeyVaultArmOperation(_deletedVaultsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location);
if (waitUntil == WaitUntil.Completed)
+ {
operation.WaitForCompletionResponse(cancellationToken);
+ }
return operation;
}
catch (Exception e)
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmCollection.cs
index 9a8f9ca6c929..b63da6fe80f6 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmCollection.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmCollection.cs
@@ -6,86 +6,94 @@
#nullable disable
using System;
-using System.Globalization;
+using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
+using Azure;
using Azure.Core;
using Azure.Core.Pipeline;
+using Azure.ResourceManager;
using Azure.ResourceManager.Resources;
namespace Azure.ResourceManager.KeyVault
{
///
/// A class representing a collection of and their operations.
- /// Each in the collection will belong to the same instance of .
- /// To get a instance call the GetDeletedManagedHsms method from an instance of .
+ /// Each in the collection will belong to the same instance of a parent resource (TODO: add parent resource information).
+ /// To get a instance call the GetDeletedManagedHsms method from an instance of the parent resource.
///
public partial class DeletedManagedHsmCollection : ArmCollection
{
- private readonly ClientDiagnostics _deletedManagedHsmManagedHsmsClientDiagnostics;
- private readonly ManagedHsmsRestOperations _deletedManagedHsmManagedHsmsRestClient;
+ private readonly ClientDiagnostics _deletedManagedHsmsClientDiagnostics;
+ private readonly DeletedManagedHsms _deletedManagedHsmsRestClient;
- /// Initializes a new instance of the class for mocking.
+ /// Initializes a new instance of DeletedManagedHsmCollection for mocking.
protected DeletedManagedHsmCollection()
{
}
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of class.
/// The client parameters to use in these operations.
- /// The identifier of the parent resource that is the target of operations.
+ /// The identifier of the resource that is the target of operations.
internal DeletedManagedHsmCollection(ArmClient client, ResourceIdentifier id) : base(client, id)
{
- _deletedManagedHsmManagedHsmsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", DeletedManagedHsmResource.ResourceType.Namespace, Diagnostics);
- TryGetApiVersion(DeletedManagedHsmResource.ResourceType, out string deletedManagedHsmManagedHsmsApiVersion);
- _deletedManagedHsmManagedHsmsRestClient = new ManagedHsmsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, deletedManagedHsmManagedHsmsApiVersion);
-#if DEBUG
- ValidateResourceId(Id);
-#endif
+ TryGetApiVersion(DeletedManagedHsmResource.ResourceType, out string deletedManagedHsmApiVersion);
+ _deletedManagedHsmsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", DeletedManagedHsmResource.ResourceType.Namespace, Diagnostics);
+ _deletedManagedHsmsRestClient = new DeletedManagedHsms(_deletedManagedHsmsClientDiagnostics, Pipeline, Endpoint, deletedManagedHsmApiVersion ?? "2025-05-01");
+ ValidateResourceId(id);
}
+ ///
+ [Conditional("DEBUG")]
internal static void ValidateResourceId(ResourceIdentifier id)
{
if (id.ResourceType != SubscriptionResource.ResourceType)
- throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, SubscriptionResource.ResourceType), nameof(id));
+ {
+ throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, SubscriptionResource.ResourceType), id);
+ }
}
///
/// Gets the specified deleted managed HSM.
///
/// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}
- ///
- /// -
- /// Operation Id
- /// ManagedHsms_GetDeleted
+ /// Request Path.
+ /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}.
///
/// -
- /// Default Api Version
- /// 2025-05-01
+ /// Operation Id.
+ /// DeletedManagedHsms_GetDeleted.
///
/// -
- /// Resource
- ///
+ /// Default Api Version.
+ /// 2025-05-01.
///
///
///
/// The name of the Azure region.
/// The name of the deleted managed HSM.
/// The cancellation token to use.
- /// is an empty string, and was expected to be non-empty.
/// is null.
- public virtual async Task> GetAsync(AzureLocation location, string name, CancellationToken cancellationToken = default)
+ /// is an empty string, and was expected to be non-empty.
+ public virtual async Task> GetDeletedAsync(AzureLocation location, string name, CancellationToken cancellationToken = default)
{
Argument.AssertNotNullOrEmpty(name, nameof(name));
- using var scope = _deletedManagedHsmManagedHsmsClientDiagnostics.CreateScope("DeletedManagedHsmCollection.Get");
+ using DiagnosticScope scope = _deletedManagedHsmsClientDiagnostics.CreateScope("DeletedManagedHsmCollection.GetDeleted");
scope.Start();
try
{
- var response = await _deletedManagedHsmManagedHsmsRestClient.GetDeletedAsync(Id.SubscriptionId, location, name, cancellationToken).ConfigureAwait(false);
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ HttpMessage message = _deletedManagedHsmsRestClient.CreateGetDeletedRequest(Guid.Parse(Id.SubscriptionId), location, name, context);
+ Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ Response response = Response.FromValue(DeletedManagedHsmData.FromResponse(result), result);
if (response.Value == null)
+ {
throw new RequestFailedException(response.GetRawResponse());
+ }
return Response.FromValue(new DeletedManagedHsmResource(Client, response.Value), response.GetRawResponse());
}
catch (Exception e)
@@ -99,39 +107,43 @@ public virtual async Task> GetAsync(AzureLoc
/// Gets the specified deleted managed HSM.
///
/// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}
- ///
- /// -
- /// Operation Id
- /// ManagedHsms_GetDeleted
+ /// Request Path.
+ /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}.
///
/// -
- /// Default Api Version
- /// 2025-05-01
+ /// Operation Id.
+ /// DeletedManagedHsms_GetDeleted.
///
/// -
- /// Resource
- ///
+ /// Default Api Version.
+ /// 2025-05-01.
///
///
///
/// The name of the Azure region.
/// The name of the deleted managed HSM.
/// The cancellation token to use.
- /// is an empty string, and was expected to be non-empty.
/// is null.
- public virtual Response Get(AzureLocation location, string name, CancellationToken cancellationToken = default)
+ /// is an empty string, and was expected to be non-empty.
+ public virtual Response GetDeleted(AzureLocation location, string name, CancellationToken cancellationToken = default)
{
Argument.AssertNotNullOrEmpty(name, nameof(name));
- using var scope = _deletedManagedHsmManagedHsmsClientDiagnostics.CreateScope("DeletedManagedHsmCollection.Get");
+ using DiagnosticScope scope = _deletedManagedHsmsClientDiagnostics.CreateScope("DeletedManagedHsmCollection.GetDeleted");
scope.Start();
try
{
- var response = _deletedManagedHsmManagedHsmsRestClient.GetDeleted(Id.SubscriptionId, location, name, cancellationToken);
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ HttpMessage message = _deletedManagedHsmsRestClient.CreateGetDeletedRequest(Guid.Parse(Id.SubscriptionId), location, name, context);
+ Response result = Pipeline.ProcessMessage(message, context);
+ Response response = Response.FromValue(DeletedManagedHsmData.FromResponse(result), result);
if (response.Value == null)
+ {
throw new RequestFailedException(response.GetRawResponse());
+ }
return Response.FromValue(new DeletedManagedHsmResource(Client, response.Value), response.GetRawResponse());
}
catch (Exception e)
@@ -142,40 +154,54 @@ public virtual Response Get(AzureLocation location, s
}
///
- /// Checks to see if the resource exists in azure.
+ /// Gets the specified deleted managed HSM.
///
/// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}
+ /// Request Path.
+ /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}.
///
/// -
- /// Operation Id
- /// ManagedHsms_GetDeleted
+ /// Operation Id.
+ /// DeletedManagedHsms_GetDeleted.
///
/// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
+ /// Default Api Version.
+ /// 2025-05-01.
///
///
///
/// The name of the Azure region.
/// The name of the deleted managed HSM.
/// The cancellation token to use.
- /// is an empty string, and was expected to be non-empty.
/// is null.
+ /// is an empty string, and was expected to be non-empty.
public virtual async Task> ExistsAsync(AzureLocation location, string name, CancellationToken cancellationToken = default)
{
Argument.AssertNotNullOrEmpty(name, nameof(name));
- using var scope = _deletedManagedHsmManagedHsmsClientDiagnostics.CreateScope("DeletedManagedHsmCollection.Exists");
+ using DiagnosticScope scope = _deletedManagedHsmsClientDiagnostics.CreateScope("DeletedManagedHsmCollection.Exists");
scope.Start();
try
{
- var response = await _deletedManagedHsmManagedHsmsRestClient.GetDeletedAsync(Id.SubscriptionId, location, name, cancellationToken: cancellationToken).ConfigureAwait(false);
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ HttpMessage message = _deletedManagedHsmsRestClient.CreateGetDeletedRequest(Guid.Parse(Id.SubscriptionId), location, name, context);
+ await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false);
+ Response result = message.Response;
+ Response response = default;
+ switch (result.Status)
+ {
+ case 200:
+ response = Response.FromValue(DeletedManagedHsmData.FromResponse(result), result);
+ break;
+ case 404:
+ response = Response.FromValue((DeletedManagedHsmData)null, result);
+ break;
+ default:
+ throw new RequestFailedException(result);
+ }
return Response.FromValue(response.Value != null, response.GetRawResponse());
}
catch (Exception e)
@@ -186,40 +212,54 @@ public virtual async Task> ExistsAsync(AzureLocation location, st
}
///
- /// Checks to see if the resource exists in azure.
+ /// Gets the specified deleted managed HSM.
///
/// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}
- ///
- /// -
- /// Operation Id
- /// ManagedHsms_GetDeleted
+ /// Request Path.
+ /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}.
///
/// -
- /// Default Api Version
- /// 2025-05-01
+ /// Operation Id.
+ /// DeletedManagedHsms_GetDeleted.
///
/// -
- /// Resource
- ///
+ /// Default Api Version.
+ /// 2025-05-01.
///
///
///
/// The name of the Azure region.
/// The name of the deleted managed HSM.
/// The cancellation token to use.
- /// is an empty string, and was expected to be non-empty.
/// is null.
+ /// is an empty string, and was expected to be non-empty.
public virtual Response Exists(AzureLocation location, string name, CancellationToken cancellationToken = default)
{
Argument.AssertNotNullOrEmpty(name, nameof(name));
- using var scope = _deletedManagedHsmManagedHsmsClientDiagnostics.CreateScope("DeletedManagedHsmCollection.Exists");
+ using DiagnosticScope scope = _deletedManagedHsmsClientDiagnostics.CreateScope("DeletedManagedHsmCollection.Exists");
scope.Start();
try
{
- var response = _deletedManagedHsmManagedHsmsRestClient.GetDeleted(Id.SubscriptionId, location, name, cancellationToken: cancellationToken);
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ HttpMessage message = _deletedManagedHsmsRestClient.CreateGetDeletedRequest(Guid.Parse(Id.SubscriptionId), location, name, context);
+ Pipeline.Send(message, context.CancellationToken);
+ Response result = message.Response;
+ Response response = default;
+ switch (result.Status)
+ {
+ case 200:
+ response = Response.FromValue(DeletedManagedHsmData.FromResponse(result), result);
+ break;
+ case 404:
+ response = Response.FromValue((DeletedManagedHsmData)null, result);
+ break;
+ default:
+ throw new RequestFailedException(result);
+ }
return Response.FromValue(response.Value != null, response.GetRawResponse());
}
catch (Exception e)
@@ -230,42 +270,58 @@ public virtual Response Exists(AzureLocation location, string name, Cancel
}
///
- /// Tries to get details for this resource from the service.
+ /// Gets the specified deleted managed HSM.
///
/// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}
- ///
- /// -
- /// Operation Id
- /// ManagedHsms_GetDeleted
+ /// Request Path.
+ /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}.
///
/// -
- /// Default Api Version
- /// 2025-05-01
+ /// Operation Id.
+ /// DeletedManagedHsms_GetDeleted.
///
/// -
- /// Resource
- ///
+ /// Default Api Version.
+ /// 2025-05-01.
///
///
///
/// The name of the Azure region.
/// The name of the deleted managed HSM.
/// The cancellation token to use.
- /// is an empty string, and was expected to be non-empty.
/// is null.
+ /// is an empty string, and was expected to be non-empty.
public virtual async Task> GetIfExistsAsync(AzureLocation location, string name, CancellationToken cancellationToken = default)
{
Argument.AssertNotNullOrEmpty(name, nameof(name));
- using var scope = _deletedManagedHsmManagedHsmsClientDiagnostics.CreateScope("DeletedManagedHsmCollection.GetIfExists");
+ using DiagnosticScope scope = _deletedManagedHsmsClientDiagnostics.CreateScope("DeletedManagedHsmCollection.GetIfExists");
scope.Start();
try
{
- var response = await _deletedManagedHsmManagedHsmsRestClient.GetDeletedAsync(Id.SubscriptionId, location, name, cancellationToken: cancellationToken).ConfigureAwait(false);
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ HttpMessage message = _deletedManagedHsmsRestClient.CreateGetDeletedRequest(Guid.Parse(Id.SubscriptionId), location, name, context);
+ await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false);
+ Response result = message.Response;
+ Response response = default;
+ switch (result.Status)
+ {
+ case 200:
+ response = Response.FromValue(DeletedManagedHsmData.FromResponse(result), result);
+ break;
+ case 404:
+ response = Response.FromValue((DeletedManagedHsmData)null, result);
+ break;
+ default:
+ throw new RequestFailedException(result);
+ }
if (response.Value == null)
+ {
return new NoValueResponse(response.GetRawResponse());
+ }
return Response.FromValue(new DeletedManagedHsmResource(Client, response.Value), response.GetRawResponse());
}
catch (Exception e)
@@ -276,42 +332,58 @@ public virtual async Task> GetIfExis
}
///
- /// Tries to get details for this resource from the service.
+ /// Gets the specified deleted managed HSM.
///
/// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}
+ /// Request Path.
+ /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}.
///
/// -
- /// Operation Id
- /// ManagedHsms_GetDeleted
+ /// Operation Id.
+ /// DeletedManagedHsms_GetDeleted.
///
/// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
+ /// Default Api Version.
+ /// 2025-05-01.
///
///
///
/// The name of the Azure region.
/// The name of the deleted managed HSM.
/// The cancellation token to use.
- /// is an empty string, and was expected to be non-empty.
/// is null.
+ /// is an empty string, and was expected to be non-empty.
public virtual NullableResponse GetIfExists(AzureLocation location, string name, CancellationToken cancellationToken = default)
{
Argument.AssertNotNullOrEmpty(name, nameof(name));
- using var scope = _deletedManagedHsmManagedHsmsClientDiagnostics.CreateScope("DeletedManagedHsmCollection.GetIfExists");
+ using DiagnosticScope scope = _deletedManagedHsmsClientDiagnostics.CreateScope("DeletedManagedHsmCollection.GetIfExists");
scope.Start();
try
{
- var response = _deletedManagedHsmManagedHsmsRestClient.GetDeleted(Id.SubscriptionId, location, name, cancellationToken: cancellationToken);
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ HttpMessage message = _deletedManagedHsmsRestClient.CreateGetDeletedRequest(Guid.Parse(Id.SubscriptionId), location, name, context);
+ Pipeline.Send(message, context.CancellationToken);
+ Response result = message.Response;
+ Response response = default;
+ switch (result.Status)
+ {
+ case 200:
+ response = Response.FromValue(DeletedManagedHsmData.FromResponse(result), result);
+ break;
+ case 404:
+ response = Response.FromValue((DeletedManagedHsmData)null, result);
+ break;
+ default:
+ throw new RequestFailedException(result);
+ }
if (response.Value == null)
+ {
return new NoValueResponse(response.GetRawResponse());
+ }
return Response.FromValue(new DeletedManagedHsmResource(Client, response.Value), response.GetRawResponse());
}
catch (Exception e)
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmData.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmData.Serialization.cs
index 97638f1c1f4a..f43b3a1ec5d1 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmData.Serialization.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmData.Serialization.cs
@@ -10,16 +10,18 @@
using System.Collections.Generic;
using System.Text;
using System.Text.Json;
+using Azure;
using Azure.Core;
using Azure.ResourceManager.KeyVault.Models;
using Azure.ResourceManager.Models;
namespace Azure.ResourceManager.KeyVault
{
- public partial class DeletedManagedHsmData : IUtf8JsonSerializable, IJsonModel
+ /// Concrete proxy resource types can be created by aliasing this type using a specific property type.
+ public partial class DeletedManagedHsmData : ResourceData, IJsonModel
{
- void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
-
+ /// The JSON writer.
+ /// The client options for reading and writing models.
void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
{
writer.WriteStartObject();
@@ -31,12 +33,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW
/// The client options for reading and writing models.
protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options)
{
- var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
if (format != "J")
{
throw new FormatException($"The model {nameof(DeletedManagedHsmData)} does not support writing '{format}' format.");
}
-
base.JsonModelWriteCore(writer, options);
if (Optional.IsDefined(Properties))
{
@@ -45,190 +46,124 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri
}
}
- DeletedManagedHsmData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ /// The JSON reader.
+ /// The client options for reading and writing models.
+ DeletedManagedHsmData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DeletedManagedHsmData)JsonModelCreateCore(ref reader, options);
+
+ /// The JSON reader.
+ /// The client options for reading and writing models.
+ protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
{
- var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
if (format != "J")
{
throw new FormatException($"The model {nameof(DeletedManagedHsmData)} does not support reading '{format}' format.");
}
-
using JsonDocument document = JsonDocument.ParseValue(ref reader);
return DeserializeDeletedManagedHsmData(document.RootElement, options);
}
- internal static DeletedManagedHsmData DeserializeDeletedManagedHsmData(JsonElement element, ModelReaderWriterOptions options = null)
+ /// The JSON element to deserialize.
+ /// The client options for reading and writing models.
+ internal static DeletedManagedHsmData DeserializeDeletedManagedHsmData(JsonElement element, ModelReaderWriterOptions options)
{
- options ??= ModelSerializationExtensions.WireOptions;
-
if (element.ValueKind == JsonValueKind.Null)
{
return null;
}
- DeletedManagedHsmProperties properties = default;
ResourceIdentifier id = default;
string name = default;
- ResourceType type = default;
+ ResourceType resourceType = default;
SystemData systemData = default;
- IDictionary serializedAdditionalRawData = default;
- Dictionary rawDataDictionary = new Dictionary();
- foreach (var property in element.EnumerateObject())
+ IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary();
+ DeletedManagedHsmProperties properties = default;
+ foreach (var prop in element.EnumerateObject())
{
- if (property.NameEquals("properties"u8))
+ if (prop.NameEquals("id"u8))
{
- if (property.Value.ValueKind == JsonValueKind.Null)
+ if (prop.Value.ValueKind == JsonValueKind.Null)
{
continue;
}
- properties = DeletedManagedHsmProperties.DeserializeDeletedManagedHsmProperties(property.Value, options);
+ id = new ResourceIdentifier(prop.Value.GetString());
continue;
}
- if (property.NameEquals("id"u8))
+ if (prop.NameEquals("name"u8))
{
- id = new ResourceIdentifier(property.Value.GetString());
+ name = prop.Value.GetString();
continue;
}
- if (property.NameEquals("name"u8))
+ if (prop.NameEquals("type"u8))
{
- name = property.Value.GetString();
+ if (prop.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ resourceType = new ResourceType(prop.Value.GetString());
continue;
}
- if (property.NameEquals("type"u8))
+ if (prop.NameEquals("systemData"u8))
{
- type = new ResourceType(property.Value.GetString());
+ if (prop.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerKeyVaultContext.Default);
continue;
}
- if (property.NameEquals("systemData"u8))
+ if (prop.NameEquals("properties"u8))
{
- if (property.Value.ValueKind == JsonValueKind.Null)
+ if (prop.Value.ValueKind == JsonValueKind.Null)
{
continue;
}
- systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerKeyVaultContext.Default);
+ properties = DeletedManagedHsmProperties.DeserializeDeletedManagedHsmProperties(prop.Value, options);
continue;
}
if (options.Format != "W")
{
- rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText()));
}
}
- serializedAdditionalRawData = rawDataDictionary;
return new DeletedManagedHsmData(
id,
name,
- type,
+ resourceType,
systemData,
- properties,
- serializedAdditionalRawData);
+ additionalBinaryDataProperties,
+ properties);
}
- private BinaryData SerializeBicep(ModelReaderWriterOptions options)
- {
- StringBuilder builder = new StringBuilder();
- BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
- IDictionary propertyOverrides = null;
- bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides);
- bool hasPropertyOverride = false;
- string propertyOverride = null;
-
- builder.AppendLine("{");
-
- hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride);
- if (hasPropertyOverride)
- {
- builder.Append(" name: ");
- builder.AppendLine(propertyOverride);
- }
- else
- {
- if (Optional.IsDefined(Name))
- {
- builder.Append(" name: ");
- if (Name.Contains(Environment.NewLine))
- {
- builder.AppendLine("'''");
- builder.AppendLine($"{Name}'''");
- }
- else
- {
- builder.AppendLine($"'{Name}'");
- }
- }
- }
-
- hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride);
- if (hasPropertyOverride)
- {
- builder.Append(" properties: ");
- builder.AppendLine(propertyOverride);
- }
- else
- {
- if (Optional.IsDefined(Properties))
- {
- builder.Append(" properties: ");
- BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: ");
- }
- }
-
- hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride);
- if (hasPropertyOverride)
- {
- builder.Append(" id: ");
- builder.AppendLine(propertyOverride);
- }
- else
- {
- if (Optional.IsDefined(Id))
- {
- builder.Append(" id: ");
- builder.AppendLine($"'{Id.ToString()}'");
- }
- }
-
- hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride);
- if (hasPropertyOverride)
- {
- builder.Append(" systemData: ");
- builder.AppendLine(propertyOverride);
- }
- else
- {
- if (Optional.IsDefined(SystemData))
- {
- builder.Append(" systemData: ");
- builder.AppendLine($"'{SystemData.ToString()}'");
- }
- }
-
- builder.AppendLine("}");
- return BinaryData.FromString(builder.ToString());
- }
+ /// The client options for reading and writing models.
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options);
- BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ /// The client options for reading and writing models.
+ protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options)
{
- var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
-
+ string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
switch (format)
{
case "J":
return ModelReaderWriter.Write(this, options, AzureResourceManagerKeyVaultContext.Default);
- case "bicep":
- return SerializeBicep(options);
default:
throw new FormatException($"The model {nameof(DeletedManagedHsmData)} does not support writing '{options.Format}' format.");
}
}
- DeletedManagedHsmData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
- {
- var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ /// The data to parse.
+ /// The client options for reading and writing models.
+ DeletedManagedHsmData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DeletedManagedHsmData)PersistableModelCreateCore(data, options);
+ /// The data to parse.
+ /// The client options for reading and writing models.
+ protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options)
+ {
+ string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
switch (format)
{
case "J":
+ using (JsonDocument document = JsonDocument.Parse(data))
{
- using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions);
return DeserializeDeletedManagedHsmData(document.RootElement, options);
}
default:
@@ -236,6 +171,15 @@ DeletedManagedHsmData IPersistableModel.Create(BinaryData
}
}
+ /// The client options for reading and writing models.
string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// The to deserialize the from.
+ internal static DeletedManagedHsmData FromResponse(Response result)
+ {
+ using Response response = result;
+ using JsonDocument document = JsonDocument.Parse(response.Content);
+ return DeserializeDeletedManagedHsmData(document.RootElement, ModelSerializationExtensions.WireOptions);
+ }
}
}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmData.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmData.cs
index 64e9675594da..0673210baccd 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmData.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmData.cs
@@ -13,43 +13,11 @@
namespace Azure.ResourceManager.KeyVault
{
- ///
- /// A class representing the DeletedManagedHsm data model.
- /// Concrete proxy resource types can be created by aliasing this type using a specific property type.
- ///
+ /// Concrete proxy resource types can be created by aliasing this type using a specific property type.
public partial class DeletedManagedHsmData : ResourceData
{
- ///
- /// Keeps track of any properties unknown to the library.
- ///
- /// To assign an object to the value of this property use .
- ///
- ///
- /// To assign an already formatted json string to this property use .
- ///
- ///
- /// Examples:
- ///
- /// -
- /// BinaryData.FromObjectAsJson("foo")
- /// Creates a payload of "foo".
- ///
- /// -
- /// BinaryData.FromString("\"foo\"")
- /// Creates a payload of "foo".
- ///
- /// -
- /// BinaryData.FromObjectAsJson(new { key = "value" })
- /// Creates a payload of { "key": "value" }.
- ///
- /// -
- /// BinaryData.FromString("{\"key\": \"value\"}")
- /// Creates a payload of { "key": "value" }.
- ///
- ///
- ///
- ///
- private IDictionary _serializedAdditionalRawData;
+ /// Keeps track of any properties unknown to the library.
+ private protected readonly IDictionary _additionalBinaryDataProperties;
/// Initializes a new instance of .
internal DeletedManagedHsmData()
@@ -57,16 +25,16 @@ internal DeletedManagedHsmData()
}
/// Initializes a new instance of .
- /// The id.
- /// The name.
- /// The resourceType.
- /// The systemData.
+ /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
+ /// The name of the resource.
+ /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".
+ /// Azure Resource Manager metadata containing createdBy and modifiedBy information.
+ /// Keeps track of any properties unknown to the library.
/// Properties of the deleted managed HSM.
- /// Keeps track of any properties unknown to the library.
- internal DeletedManagedHsmData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DeletedManagedHsmProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData)
+ internal DeletedManagedHsmData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, DeletedManagedHsmProperties properties) : base(id, name, resourceType, systemData)
{
+ _additionalBinaryDataProperties = additionalBinaryDataProperties;
Properties = properties;
- _serializedAdditionalRawData = serializedAdditionalRawData;
}
/// Properties of the deleted managed HSM.
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmResource.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmResource.Serialization.cs
index 102d5b4c325b..d89ab24c2fa9 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmResource.Serialization.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmResource.Serialization.cs
@@ -11,19 +11,29 @@
namespace Azure.ResourceManager.KeyVault
{
+ ///
public partial class DeletedManagedHsmResource : IJsonModel
{
- private static DeletedManagedHsmData s_dataDeserializationInstance;
- private static DeletedManagedHsmData DataDeserializationInstance => s_dataDeserializationInstance ??= new();
+ private static IJsonModel s_dataDeserializationInstance;
+ private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new DeletedManagedHsmData();
+
+ /// The writer to serialize the model to.
+ /// The client options for reading and writing models.
void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options);
- DeletedManagedHsmData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)DataDeserializationInstance).Create(ref reader, options);
+ /// The reader for deserializing the model.
+ /// The client options for reading and writing models.
+ DeletedManagedHsmData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options);
+ /// The client options for reading and writing models.
BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerKeyVaultContext.Default);
+ /// The binary data to be processed.
+ /// The client options for reading and writing models.
DeletedManagedHsmData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerKeyVaultContext.Default);
- string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)DataDeserializationInstance).GetFormatFromOptions(options);
+ /// The client options for reading and writing models.
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options);
}
}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmResource.cs
index abfe33176efd..a0c2ae013efc 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmResource.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmResource.cs
@@ -6,46 +6,36 @@
#nullable disable
using System;
-using System.Globalization;
+using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
+using Azure;
using Azure.Core;
using Azure.Core.Pipeline;
+using Azure.ResourceManager;
using Azure.ResourceManager.Resources;
namespace Azure.ResourceManager.KeyVault
{
///
- /// A Class representing a DeletedManagedHsm along with the instance operations that can be performed on it.
- /// If you have a you can construct a
- /// from an instance of using the GetDeletedManagedHsmResource method.
- /// Otherwise you can get one from its parent resource using the GetDeletedManagedHsm method.
+ /// A class representing a DeletedManagedHsm along with the instance operations that can be performed on it.
+ /// If you have a you can construct a from an instance of using the GetResource method.
+ /// Otherwise you can get one from its parent resource using the GetDeletedManagedHsms method.
///
public partial class DeletedManagedHsmResource : ArmResource
{
- /// Generate the resource identifier of a instance.
- /// The subscriptionId.
- /// The location.
- /// The name.
- public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location, string name)
- {
- var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}";
- return new ResourceIdentifier(resourceId);
- }
-
- private readonly ClientDiagnostics _deletedManagedHsmManagedHsmsClientDiagnostics;
- private readonly ManagedHsmsRestOperations _deletedManagedHsmManagedHsmsRestClient;
+ private readonly ClientDiagnostics _deletedManagedHsmsClientDiagnostics;
+ private readonly DeletedManagedHsms _deletedManagedHsmsRestClient;
private readonly DeletedManagedHsmData _data;
-
/// Gets the resource type for the operations.
public static readonly ResourceType ResourceType = "Microsoft.KeyVault/locations/deletedManagedHSMs";
- /// Initializes a new instance of the class for mocking.
+ /// Initializes a new instance of DeletedManagedHsmResource for mocking.
protected DeletedManagedHsmResource()
{
}
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of class.
/// The client parameters to use in these operations.
/// The resource that is the target of operations.
internal DeletedManagedHsmResource(ArmClient client, DeletedManagedHsmData data) : this(client, data.Id)
@@ -54,71 +44,92 @@ internal DeletedManagedHsmResource(ArmClient client, DeletedManagedHsmData data)
_data = data;
}
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of class.
/// The client parameters to use in these operations.
/// The identifier of the resource that is the target of operations.
internal DeletedManagedHsmResource(ArmClient client, ResourceIdentifier id) : base(client, id)
{
- _deletedManagedHsmManagedHsmsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", ResourceType.Namespace, Diagnostics);
- TryGetApiVersion(ResourceType, out string deletedManagedHsmManagedHsmsApiVersion);
- _deletedManagedHsmManagedHsmsRestClient = new ManagedHsmsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, deletedManagedHsmManagedHsmsApiVersion);
-#if DEBUG
- ValidateResourceId(Id);
-#endif
+ TryGetApiVersion(ResourceType, out string deletedManagedHsmApiVersion);
+ _deletedManagedHsmsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", ResourceType.Namespace, Diagnostics);
+ _deletedManagedHsmsRestClient = new DeletedManagedHsms(_deletedManagedHsmsClientDiagnostics, Pipeline, Endpoint, deletedManagedHsmApiVersion ?? "2025-05-01");
+ ValidateResourceId(id);
}
/// Gets whether or not the current instance has data.
public virtual bool HasData { get; }
/// Gets the data representing this Feature.
- /// Throws if there is no data loaded in the current instance.
public virtual DeletedManagedHsmData Data
{
get
{
if (!HasData)
+ {
throw new InvalidOperationException("The current instance does not have data, you must call Get first.");
+ }
return _data;
}
}
+ /// Generate the resource identifier for this resource.
+ /// The subscriptionId.
+ /// The location.
+ /// The name.
+ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location, string name)
+ {
+ string resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}";
+ return new ResourceIdentifier(resourceId);
+ }
+
+ ///
+ [Conditional("DEBUG")]
internal static void ValidateResourceId(ResourceIdentifier id)
{
if (id.ResourceType != ResourceType)
- throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id));
+ {
+ throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id);
+ }
}
///
/// Gets the specified deleted managed HSM.
///
/// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}
+ /// Request Path.
+ /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}.
///
/// -
- /// Operation Id
- /// ManagedHsms_GetDeleted
+ /// Operation Id.
+ /// DeletedManagedHsms_GetDeleted.
///
/// -
- /// Default Api Version
- /// 2025-05-01
+ /// Default Api Version.
+ /// 2025-05-01.
///
/// -
- /// Resource
- ///
+ /// Resource.
+ /// .
///
///
///
/// The cancellation token to use.
- public virtual async Task> GetAsync(CancellationToken cancellationToken = default)
+ public virtual async Task> GetDeletedAsync(CancellationToken cancellationToken = default)
{
- using var scope = _deletedManagedHsmManagedHsmsClientDiagnostics.CreateScope("DeletedManagedHsmResource.Get");
+ using DiagnosticScope scope = _deletedManagedHsmsClientDiagnostics.CreateScope("DeletedManagedHsmResource.GetDeleted");
scope.Start();
try
{
- var response = await _deletedManagedHsmManagedHsmsRestClient.GetDeletedAsync(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken).ConfigureAwait(false);
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ HttpMessage message = _deletedManagedHsmsRestClient.CreateGetDeletedRequest(Guid.Parse(Id.SubscriptionId), Id.Parent.Name, Id.Name, context);
+ Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ Response response = Response.FromValue(DeletedManagedHsmData.FromResponse(result), result);
if (response.Value == null)
+ {
throw new RequestFailedException(response.GetRawResponse());
+ }
return Response.FromValue(new DeletedManagedHsmResource(Client, response.Value), response.GetRawResponse());
}
catch (Exception e)
@@ -132,33 +143,41 @@ public virtual async Task> GetAsync(Cancella
/// Gets the specified deleted managed HSM.
///
/// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}
+ /// Request Path.
+ /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}.
///
/// -
- /// Operation Id
- /// ManagedHsms_GetDeleted
+ /// Operation Id.
+ /// DeletedManagedHsms_GetDeleted.
///
/// -
- /// Default Api Version
- /// 2025-05-01
+ /// Default Api Version.
+ /// 2025-05-01.
///
/// -
- /// Resource
- ///
+ /// Resource.
+ /// .
///
///
///
/// The cancellation token to use.
- public virtual Response Get(CancellationToken cancellationToken = default)
+ public virtual Response GetDeleted(CancellationToken cancellationToken = default)
{
- using var scope = _deletedManagedHsmManagedHsmsClientDiagnostics.CreateScope("DeletedManagedHsmResource.Get");
+ using DiagnosticScope scope = _deletedManagedHsmsClientDiagnostics.CreateScope("DeletedManagedHsmResource.GetDeleted");
scope.Start();
try
{
- var response = _deletedManagedHsmManagedHsmsRestClient.GetDeleted(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken);
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ HttpMessage message = _deletedManagedHsmsRestClient.CreateGetDeletedRequest(Guid.Parse(Id.SubscriptionId), Id.Parent.Name, Id.Name, context);
+ Response result = Pipeline.ProcessMessage(message, context);
+ Response response = Response.FromValue(DeletedManagedHsmData.FromResponse(result), result);
if (response.Value == null)
+ {
throw new RequestFailedException(response.GetRawResponse());
+ }
return Response.FromValue(new DeletedManagedHsmResource(Client, response.Value), response.GetRawResponse());
}
catch (Exception e)
@@ -172,20 +191,20 @@ public virtual Response Get(CancellationToken cancell
/// Permanently deletes the specified managed HSM.
///
/// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}/purge
+ /// Request Path.
+ /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}/purge.
///
/// -
- /// Operation Id
- /// ManagedHsms_PurgeDeleted
+ /// Operation Id.
+ /// DeletedManagedHsms_PurgeDeleted.
///
/// -
- /// Default Api Version
- /// 2025-05-01
+ /// Default Api Version.
+ /// 2025-05-01.
///
/// -
- /// Resource
- ///
+ /// Resource.
+ /// .
///
///
///
@@ -193,14 +212,21 @@ public virtual Response Get(CancellationToken cancell
/// The cancellation token to use.
public virtual async Task PurgeDeletedAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default)
{
- using var scope = _deletedManagedHsmManagedHsmsClientDiagnostics.CreateScope("DeletedManagedHsmResource.PurgeDeleted");
+ using DiagnosticScope scope = _deletedManagedHsmsClientDiagnostics.CreateScope("DeletedManagedHsmResource.PurgeDeleted");
scope.Start();
try
{
- var response = await _deletedManagedHsmManagedHsmsRestClient.PurgeDeletedAsync(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken).ConfigureAwait(false);
- var operation = new KeyVaultArmOperation(_deletedManagedHsmManagedHsmsClientDiagnostics, Pipeline, _deletedManagedHsmManagedHsmsRestClient.CreatePurgeDeletedRequest(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name).Request, response, OperationFinalStateVia.Location);
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ HttpMessage message = _deletedManagedHsmsRestClient.CreatePurgeDeletedRequest(Guid.Parse(Id.SubscriptionId), Id.Parent.Name, Id.Name, context);
+ Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ KeyVaultArmOperation operation = new KeyVaultArmOperation(_deletedManagedHsmsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location);
if (waitUntil == WaitUntil.Completed)
+ {
await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false);
+ }
return operation;
}
catch (Exception e)
@@ -214,20 +240,20 @@ public virtual async Task PurgeDeletedAsync(WaitUntil waitUntil, C
/// Permanently deletes the specified managed HSM.
///
/// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}/purge
+ /// Request Path.
+ /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}/purge.
///
/// -
- /// Operation Id
- /// ManagedHsms_PurgeDeleted
+ /// Operation Id.
+ /// DeletedManagedHsms_PurgeDeleted.
///
/// -
- /// Default Api Version
- /// 2025-05-01
+ /// Default Api Version.
+ /// 2025-05-01.
///
/// -
- /// Resource
- ///
+ /// Resource.
+ /// .
///
///
///
@@ -235,14 +261,21 @@ public virtual async Task PurgeDeletedAsync(WaitUntil waitUntil, C
/// The cancellation token to use.
public virtual ArmOperation PurgeDeleted(WaitUntil waitUntil, CancellationToken cancellationToken = default)
{
- using var scope = _deletedManagedHsmManagedHsmsClientDiagnostics.CreateScope("DeletedManagedHsmResource.PurgeDeleted");
+ using DiagnosticScope scope = _deletedManagedHsmsClientDiagnostics.CreateScope("DeletedManagedHsmResource.PurgeDeleted");
scope.Start();
try
{
- var response = _deletedManagedHsmManagedHsmsRestClient.PurgeDeleted(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken);
- var operation = new KeyVaultArmOperation(_deletedManagedHsmManagedHsmsClientDiagnostics, Pipeline, _deletedManagedHsmManagedHsmsRestClient.CreatePurgeDeletedRequest(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name).Request, response, OperationFinalStateVia.Location);
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ HttpMessage message = _deletedManagedHsmsRestClient.CreatePurgeDeletedRequest(Guid.Parse(Id.SubscriptionId), Id.Parent.Name, Id.Name, context);
+ Response response = Pipeline.ProcessMessage(message, context);
+ KeyVaultArmOperation operation = new KeyVaultArmOperation(_deletedManagedHsmsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location);
if (waitUntil == WaitUntil.Completed)
+ {
operation.WaitForCompletionResponse(cancellationToken);
+ }
return operation;
}
catch (Exception e)
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/KeyVaultExtensions.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/KeyVaultExtensions.cs
index e1f7a6579499..da72020ae7e0 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/KeyVaultExtensions.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/KeyVaultExtensions.cs
@@ -8,7 +8,9 @@
using System;
using System.Threading;
using System.Threading.Tasks;
+using Azure;
using Azure.Core;
+using Azure.ResourceManager;
using Azure.ResourceManager.KeyVault.Mocking;
using Azure.ResourceManager.KeyVault.Models;
using Azure.ResourceManager.Resources;
@@ -18,144 +20,98 @@ namespace Azure.ResourceManager.KeyVault
/// A class to add extension methods to Azure.ResourceManager.KeyVault.
public static partial class KeyVaultExtensions
{
+ ///
private static MockableKeyVaultArmClient GetMockableKeyVaultArmClient(ArmClient client)
{
- return client.GetCachedClient(client0 => new MockableKeyVaultArmClient(client0));
+ return client.GetCachedClient(client0 => new MockableKeyVaultArmClient(client0, ResourceIdentifier.Root));
}
- private static MockableKeyVaultResourceGroupResource GetMockableKeyVaultResourceGroupResource(ArmResource resource)
+ ///
+ private static MockableKeyVaultResourceGroupResource GetMockableKeyVaultResourceGroupResource(ResourceGroupResource resourceGroupResource)
{
- return resource.GetCachedClient(client => new MockableKeyVaultResourceGroupResource(client, resource.Id));
+ return resourceGroupResource.GetCachedClient(client => new MockableKeyVaultResourceGroupResource(client, resourceGroupResource.Id));
}
- private static MockableKeyVaultSubscriptionResource GetMockableKeyVaultSubscriptionResource(ArmResource resource)
+ ///
+ private static MockableKeyVaultSubscriptionResource GetMockableKeyVaultSubscriptionResource(SubscriptionResource subscriptionResource)
{
- return resource.GetCachedClient(client => new MockableKeyVaultSubscriptionResource(client, resource.Id));
+ return subscriptionResource.GetCachedClient(client => new MockableKeyVaultSubscriptionResource(client, subscriptionResource.Id));
}
- ///
- /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
- /// You can use to create a from its components.
- /// -
- /// Mocking
- /// To mock this method, please mock instead.
- ///
- ///
- /// The instance the method will execute against.
+ /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
+ /// The the method will execute against.
/// The resource ID of the resource to get.
/// is null.
- /// Returns a object.
- public static DeletedManagedHsmResource GetDeletedManagedHsmResource(this ArmClient client, ResourceIdentifier id)
+ /// Returns a object.
+ public static KeyVaultResource GetKeyVaultResource(this ArmClient client, ResourceIdentifier id)
{
Argument.AssertNotNull(client, nameof(client));
- return GetMockableKeyVaultArmClient(client).GetDeletedManagedHsmResource(id);
+ return GetMockableKeyVaultArmClient(client).GetKeyVaultResource(id);
}
- ///
- /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
- /// You can use to create a from its components.
- /// -
- /// Mocking
- /// To mock this method, please mock instead.
- ///
- ///
- /// The instance the method will execute against.
+ /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
+ /// The the method will execute against.
/// The resource ID of the resource to get.
/// is null.
- /// Returns a object.
- public static ManagedHsmResource GetManagedHsmResource(this ArmClient client, ResourceIdentifier id)
+ /// Returns a object.
+ public static DeletedKeyVaultResource GetDeletedKeyVaultResource(this ArmClient client, ResourceIdentifier id)
{
Argument.AssertNotNull(client, nameof(client));
- return GetMockableKeyVaultArmClient(client).GetManagedHsmResource(id);
+ return GetMockableKeyVaultArmClient(client).GetDeletedKeyVaultResource(id);
}
- ///
- /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
- /// You can use to create a from its components.
- /// -
- /// Mocking
- /// To mock this method, please mock instead.
- ///
- ///
- /// The instance the method will execute against.
+ /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
+ /// The the method will execute against.
/// The resource ID of the resource to get.
/// is null.
- /// Returns a object.
- public static DeletedKeyVaultResource GetDeletedKeyVaultResource(this ArmClient client, ResourceIdentifier id)
+ /// Returns a object.
+ public static KeyVaultPrivateEndpointConnectionResource GetKeyVaultPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id)
{
Argument.AssertNotNull(client, nameof(client));
- return GetMockableKeyVaultArmClient(client).GetDeletedKeyVaultResource(id);
+ return GetMockableKeyVaultArmClient(client).GetKeyVaultPrivateEndpointConnectionResource(id);
}
- ///
- /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
- /// You can use to create a from its components.
- /// -
- /// Mocking
- /// To mock this method, please mock instead.
- ///
- ///
- /// The instance the method will execute against.
+ /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
+ /// The the method will execute against.
/// The resource ID of the resource to get.
/// is null.
- /// Returns a object.
- public static KeyVaultResource GetKeyVaultResource(this ArmClient client, ResourceIdentifier id)
+ /// Returns a object.
+ public static ManagedHsmResource GetManagedHsmResource(this ArmClient client, ResourceIdentifier id)
{
Argument.AssertNotNull(client, nameof(client));
- return GetMockableKeyVaultArmClient(client).GetKeyVaultResource(id);
+ return GetMockableKeyVaultArmClient(client).GetManagedHsmResource(id);
}
- ///
- /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
- /// You can use to create a from its components.
- /// -
- /// Mocking
- /// To mock this method, please mock instead.
- ///
- ///
- /// The instance the method will execute against.
+ /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
+ /// The the method will execute against.
/// The resource ID of the resource to get.
/// is null.
- /// Returns a object.
- public static ManagedHsmPrivateEndpointConnectionResource GetManagedHsmPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id)
+ /// Returns a object.
+ public static DeletedManagedHsmResource GetDeletedManagedHsmResource(this ArmClient client, ResourceIdentifier id)
{
Argument.AssertNotNull(client, nameof(client));
- return GetMockableKeyVaultArmClient(client).GetManagedHsmPrivateEndpointConnectionResource(id);
+ return GetMockableKeyVaultArmClient(client).GetDeletedManagedHsmResource(id);
}
- ///
- /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
- /// You can use to create a from its components.
- /// -
- /// Mocking
- /// To mock this method, please mock instead.
- ///
- ///
- /// The instance the method will execute against.
+ /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
+ /// The the method will execute against.
/// The resource ID of the resource to get.
/// is null.
- /// Returns a object.
- public static KeyVaultPrivateEndpointConnectionResource GetKeyVaultPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id)
+ /// Returns a object.
+ public static ManagedHsmPrivateEndpointConnectionResource GetManagedHsmPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id)
{
Argument.AssertNotNull(client, nameof(client));
- return GetMockableKeyVaultArmClient(client).GetKeyVaultPrivateEndpointConnectionResource(id);
+ return GetMockableKeyVaultArmClient(client).GetManagedHsmPrivateEndpointConnectionResource(id);
}
- ///
- /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
- /// You can use to create a from its components.
- /// -
- /// Mocking
- /// To mock this method, please mock instead.
- ///
- ///
- /// The instance the method will execute against.
+ /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
+ /// The the method will execute against.
/// The resource ID of the resource to get.
/// is null.
/// Returns a object.
@@ -166,297 +122,112 @@ public static KeyVaultSecretResource GetKeyVaultSecretResource(this ArmClient cl
return GetMockableKeyVaultArmClient(client).GetKeyVaultSecretResource(id);
}
- ///
- /// Gets a collection of ManagedHsmResources in the ResourceGroupResource.
- /// -
- /// Mocking
- /// To mock this method, please mock instead.
- ///
- ///
- /// The instance the method will execute against.
+ /// Gets a collection of KeyVaults in the .
+ /// The the method will execute against.
/// is null.
- /// An object representing collection of ManagedHsmResources and their operations over a ManagedHsmResource.
- public static ManagedHsmCollection GetManagedHsms(this ResourceGroupResource resourceGroupResource)
+ /// An object representing collection of KeyVaults and their operations over a KeyVaultResource.
+ public static KeyVaultCollection GetKeyVaults(this ResourceGroupResource resourceGroupResource)
{
Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource));
- return GetMockableKeyVaultResourceGroupResource(resourceGroupResource).GetManagedHsms();
+ return GetMockableKeyVaultResourceGroupResource(resourceGroupResource).GetKeyVaults();
}
- ///
- /// Gets the specified managed HSM Pool.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}
- ///
- /// -
- /// Operation Id
- /// ManagedHsms_Get
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
- ///
- ///
- /// -
- /// Mocking
- /// To mock this method, please mock instead.
- ///
- ///
- /// The instance the method will execute against.
- /// The name of the managed HSM Pool.
+ /// Gets the specified Azure key vault.
+ /// The the method will execute against.
+ /// The name of the vault.
/// The cancellation token to use.
- /// or is null.
- /// is an empty string, and was expected to be non-empty.
+ /// is null.
[ForwardsClientCalls]
- public static async Task> GetManagedHsmAsync(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default)
+ public static async Task> GetKeyVaultAsync(this ResourceGroupResource resourceGroupResource, string vaultName, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource));
- return await GetMockableKeyVaultResourceGroupResource(resourceGroupResource).GetManagedHsmAsync(name, cancellationToken).ConfigureAwait(false);
+ return await GetMockableKeyVaultResourceGroupResource(resourceGroupResource).GetKeyVaultAsync(vaultName, cancellationToken).ConfigureAwait(false);
}
- ///
- /// Gets the specified managed HSM Pool.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}
- ///
- /// -
- /// Operation Id
- /// ManagedHsms_Get
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
- ///
- ///
- /// -
- /// Mocking
- /// To mock this method, please mock instead.
- ///
- ///
- /// The instance the method will execute against.
- /// The name of the managed HSM Pool.
+ /// Gets the specified Azure key vault.
+ /// The the method will execute against.
+ /// The name of the vault.
/// The cancellation token to use.
- /// or is null.
- /// is an empty string, and was expected to be non-empty.
+ /// is null.
[ForwardsClientCalls]
- public static Response GetManagedHsm(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default)
+ public static Response GetKeyVault(this ResourceGroupResource resourceGroupResource, string vaultName, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource));
- return GetMockableKeyVaultResourceGroupResource(resourceGroupResource).GetManagedHsm(name, cancellationToken);
+ return GetMockableKeyVaultResourceGroupResource(resourceGroupResource).GetKeyVault(vaultName, cancellationToken);
}
- ///
- /// Gets a collection of KeyVaultResources in the ResourceGroupResource.
- /// -
- /// Mocking
- /// To mock this method, please mock instead.
- ///
- ///
- /// The instance the method will execute against.
+ /// Gets a collection of ManagedHsms in the .
+ /// The the method will execute against.
/// is null.
- /// An object representing collection of KeyVaultResources and their operations over a KeyVaultResource.
- public static KeyVaultCollection GetKeyVaults(this ResourceGroupResource resourceGroupResource)
+ /// An object representing collection of ManagedHsms and their operations over a ManagedHsmResource.
+ public static ManagedHsmCollection GetManagedHsms(this ResourceGroupResource resourceGroupResource)
{
Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource));
- return GetMockableKeyVaultResourceGroupResource(resourceGroupResource).GetKeyVaults();
+ return GetMockableKeyVaultResourceGroupResource(resourceGroupResource).GetManagedHsms();
}
- ///
- /// Gets the specified Azure key vault.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}
- ///
- /// -
- /// Operation Id
- /// Vaults_Get
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
- ///
- ///
- /// -
- /// Mocking
- /// To mock this method, please mock instead.
- ///
- ///
- /// The instance the method will execute against.
- /// The name of the vault.
+ /// Gets the specified managed HSM Pool.
+ /// The the method will execute against.
+ /// The name of the managed HSM Pool.
/// The cancellation token to use.
- /// or is null.
- /// is an empty string, and was expected to be non-empty.
+ /// is null.
[ForwardsClientCalls]
- public static async Task> GetKeyVaultAsync(this ResourceGroupResource resourceGroupResource, string vaultName, CancellationToken cancellationToken = default)
+ public static async Task> GetManagedHsmAsync(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource));
- return await GetMockableKeyVaultResourceGroupResource(resourceGroupResource).GetKeyVaultAsync(vaultName, cancellationToken).ConfigureAwait(false);
+ return await GetMockableKeyVaultResourceGroupResource(resourceGroupResource).GetManagedHsmAsync(name, cancellationToken).ConfigureAwait(false);
}
- ///
- /// Gets the specified Azure key vault.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}
- ///
- /// -
- /// Operation Id
- /// Vaults_Get
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
- ///
- ///
- /// -
- /// Mocking
- /// To mock this method, please mock instead.
- ///
- ///
- /// The instance the method will execute against.
- /// The name of the vault.
+ /// Gets the specified managed HSM Pool.
+ /// The the method will execute against.
+ /// The name of the managed HSM Pool.
/// The cancellation token to use.
- /// or is null.
- /// is an empty string, and was expected to be non-empty.
+ /// is null.
[ForwardsClientCalls]
- public static Response GetKeyVault(this ResourceGroupResource resourceGroupResource, string vaultName, CancellationToken cancellationToken = default)
+ public static Response GetManagedHsm(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource));
- return GetMockableKeyVaultResourceGroupResource(resourceGroupResource).GetKeyVault(vaultName, cancellationToken);
+ return GetMockableKeyVaultResourceGroupResource(resourceGroupResource).GetManagedHsm(name, cancellationToken);
}
- ///
- /// Gets a collection of DeletedManagedHsmResources in the SubscriptionResource.
- /// -
- /// Mocking
- /// To mock this method, please mock instead.
- ///
- ///
- /// The instance the method will execute against.
- /// is null.
- /// An object representing collection of DeletedManagedHsmResources and their operations over a DeletedManagedHsmResource.
- public static DeletedManagedHsmCollection GetDeletedManagedHsms(this SubscriptionResource subscriptionResource)
+ /// Update access policies in a key vault in the specified subscription.
+ /// The the method will execute against.
+ /// Name of the vault.
+ /// Name of the operation.
+ /// Access policy to merge into the vault.
+ /// The cancellation token to use.
+ /// is null.
+ public static async Task> UpdateAccessPolicyAsync(this ResourceGroupResource resourceGroupResource, string vaultName, AccessPolicyUpdateKind operationKind, KeyVaultAccessPolicyParameters content, CancellationToken cancellationToken = default)
{
- Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource));
+ Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource));
- return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetDeletedManagedHsms();
+ return await GetMockableKeyVaultResourceGroupResource(resourceGroupResource).UpdateAccessPolicyAsync(vaultName, operationKind, content, cancellationToken).ConfigureAwait(false);
}
- ///
- /// Gets the specified deleted managed HSM.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}
- ///
- /// -
- /// Operation Id
- /// ManagedHsms_GetDeleted
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
- ///
- ///
- /// -
- /// Mocking
- /// To mock this method, please mock instead.
- ///
- ///
- /// The instance the method will execute against.
- /// The name of the Azure region.
- /// The name of the deleted managed HSM.
- /// The cancellation token to use.
- /// or is null.
- /// is an empty string, and was expected to be non-empty.
- [ForwardsClientCalls]
- public static async Task> GetDeletedManagedHsmAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string name, CancellationToken cancellationToken = default)
- {
- Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource));
-
- return await GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetDeletedManagedHsmAsync(location, name, cancellationToken).ConfigureAwait(false);
- }
-
- ///
- /// Gets the specified deleted managed HSM.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}
- ///
- /// -
- /// Operation Id
- /// ManagedHsms_GetDeleted
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
- ///
- ///
- /// -
- /// Mocking
- /// To mock this method, please mock instead.
- ///
- ///
- /// The instance the method will execute against.
- /// The name of the Azure region.
- /// The name of the deleted managed HSM.
+ /// Update access policies in a key vault in the specified subscription.
+ /// The the method will execute against.
+ /// Name of the vault.
+ /// Name of the operation.
+ /// Access policy to merge into the vault.
/// The cancellation token to use.
- /// or is null.
- /// is an empty string, and was expected to be non-empty.
- [ForwardsClientCalls]
- public static Response GetDeletedManagedHsm(this SubscriptionResource subscriptionResource, AzureLocation location, string name, CancellationToken cancellationToken = default)
+ /// is null.
+ public static Response UpdateAccessPolicy(this ResourceGroupResource resourceGroupResource, string vaultName, AccessPolicyUpdateKind operationKind, KeyVaultAccessPolicyParameters content, CancellationToken cancellationToken = default)
{
- Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource));
+ Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource));
- return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetDeletedManagedHsm(location, name, cancellationToken);
+ return GetMockableKeyVaultResourceGroupResource(resourceGroupResource).UpdateAccessPolicy(vaultName, operationKind, content, cancellationToken);
}
- ///
- /// Gets a collection of DeletedKeyVaultResources in the SubscriptionResource.
- /// -
- /// Mocking
- /// To mock this method, please mock instead.
- ///
- ///
- /// The instance the method will execute against.
+ /// Gets a collection of DeletedKeyVaults in the .
+ /// The the method will execute against.
/// is null.
- /// An object representing collection of DeletedKeyVaultResources and their operations over a DeletedKeyVaultResource.
+ /// An object representing collection of DeletedKeyVaults and their operations over a DeletedKeyVaultResource.
public static DeletedKeyVaultCollection GetDeletedKeyVaults(this SubscriptionResource subscriptionResource)
{
Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource));
@@ -464,323 +235,98 @@ public static DeletedKeyVaultCollection GetDeletedKeyVaults(this SubscriptionRes
return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetDeletedKeyVaults();
}
- ///
- /// Gets the deleted Azure key vault.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}
- ///
- /// -
- /// Operation Id
- /// Vaults_GetDeleted
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
- ///
- ///
- /// -
- /// Mocking
- /// To mock this method, please mock instead.
- ///
- ///
- /// The instance the method will execute against.
- /// The name of the Azure region.
- /// The name of the vault.
- /// The cancellation token to use.
- /// or is null.
- /// is an empty string, and was expected to be non-empty.
- [ForwardsClientCalls]
- public static async Task> GetDeletedKeyVaultAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string vaultName, CancellationToken cancellationToken = default)
+ /// Gets a collection of DeletedManagedHsms in the .
+ /// The the method will execute against.
+ /// is null.
+ /// An object representing collection of DeletedManagedHsms and their operations over a DeletedManagedHsmResource.
+ public static DeletedManagedHsmCollection GetDeletedManagedHsms(this SubscriptionResource subscriptionResource)
{
Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource));
- return await GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetDeletedKeyVaultAsync(location, vaultName, cancellationToken).ConfigureAwait(false);
- }
-
- ///
- /// Gets the deleted Azure key vault.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}
- ///
- /// -
- /// Operation Id
- /// Vaults_GetDeleted
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
- ///
- ///
- /// -
- /// Mocking
- /// To mock this method, please mock instead.
- ///
- ///
- /// The instance the method will execute against.
- /// The name of the Azure region.
- /// The name of the vault.
- /// The cancellation token to use.
- /// or is null.
- /// is an empty string, and was expected to be non-empty.
- [ForwardsClientCalls]
- public static Response GetDeletedKeyVault(this SubscriptionResource subscriptionResource, AzureLocation location, string vaultName, CancellationToken cancellationToken = default)
- {
- Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource));
+ return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetDeletedManagedHsms();
+ }
- return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetDeletedKeyVault(location, vaultName, cancellationToken);
- }
-
- ///
- /// Checks that the managed hsm name is valid and is not already in use.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkMhsmNameAvailability
- ///
- /// -
- /// Operation Id
- /// ManagedHsms_CheckManagedHsmNameAvailability
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
- ///
- ///
- /// -
- /// Mocking
- /// To mock this method, please mock instead.
- ///
- ///
- /// The instance the method will execute against.
- /// The request body.
+ /// The List operation gets information about the vaults associated with the subscription.
+ /// The the method will execute against.
+ /// Maximum number of results to return.
/// The cancellation token to use.
- /// or is null.
- public static async Task> CheckManagedHsmNameAvailabilityAsync(this SubscriptionResource subscriptionResource, ManagedHsmNameAvailabilityContent content, CancellationToken cancellationToken = default)
+ /// is null.
+ /// A collection of that may take multiple service requests to iterate over.
+ public static AsyncPageable GetKeyVaultsAsync(this SubscriptionResource subscriptionResource, int? top = default, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource));
- return await GetMockableKeyVaultSubscriptionResource(subscriptionResource).CheckManagedHsmNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false);
+ return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetKeyVaultsAsync(top, cancellationToken);
}
- ///
- /// Checks that the managed hsm name is valid and is not already in use.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkMhsmNameAvailability
- ///
- /// -
- /// Operation Id
- /// ManagedHsms_CheckManagedHsmNameAvailability
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
- ///
- ///
- /// -
- /// Mocking
- /// To mock this method, please mock instead.
- ///
- ///
- /// The instance the method will execute against.
- /// The request body.
+ /// The List operation gets information about the vaults associated with the subscription.
+ /// The the method will execute against.
+ /// Maximum number of results to return.
/// The cancellation token to use.
- /// or is null.
- public static Response CheckManagedHsmNameAvailability(this SubscriptionResource subscriptionResource, ManagedHsmNameAvailabilityContent content, CancellationToken cancellationToken = default)
+ /// is null.
+ /// A collection of that may take multiple service requests to iterate over.
+ public static Pageable GetKeyVaults(this SubscriptionResource subscriptionResource, int? top = default, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource));
- return GetMockableKeyVaultSubscriptionResource(subscriptionResource).CheckManagedHsmNameAvailability(content, cancellationToken);
+ return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetKeyVaults(top, cancellationToken);
}
- ///
- /// The List operation gets information about the deleted managed HSMs associated with the subscription.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedManagedHSMs
- ///
- /// -
- /// Operation Id
- /// ManagedHsms_ListDeleted
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- ///
- /// -
- /// Mocking
- /// To mock this method, please mock instead.
- ///
- ///
- /// The instance the method will execute against.
+ /// The List operation gets information about the managed HSM Pools associated with the subscription.
+ /// The the method will execute against.
+ /// Maximum number of results to return.
/// The cancellation token to use.
/// is null.
- /// An async collection of that may take multiple service requests to iterate over.
- public static AsyncPageable GetDeletedManagedHsmsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default)
+ /// A collection of that may take multiple service requests to iterate over.
+ public static AsyncPageable GetManagedHsmsAsync(this SubscriptionResource subscriptionResource, int? top = default, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource));
- return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetDeletedManagedHsmsAsync(cancellationToken);
+ return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetManagedHsmsAsync(top, cancellationToken);
}
- ///
- /// The List operation gets information about the deleted managed HSMs associated with the subscription.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedManagedHSMs
- ///
- /// -
- /// Operation Id
- /// ManagedHsms_ListDeleted
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- ///
- /// -
- /// Mocking
- /// To mock this method, please mock instead.
- ///
- ///
- /// The instance the method will execute against.
+ /// The List operation gets information about the managed HSM Pools associated with the subscription.
+ /// The the method will execute against.
+ /// Maximum number of results to return.
/// The cancellation token to use.
/// is null.
- /// A collection of that may take multiple service requests to iterate over.
- public static Pageable GetDeletedManagedHsms(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default)
+ /// A collection of that may take multiple service requests to iterate over.
+ public static Pageable GetManagedHsms(this SubscriptionResource subscriptionResource, int? top = default, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource));
- return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetDeletedManagedHsms(cancellationToken);
+ return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetManagedHsms(top, cancellationToken);
}
- ///
- /// The List operation gets information about the managed HSM Pools associated with the subscription.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/managedHSMs
- ///
- /// -
- /// Operation Id
- /// ManagedHsms_ListBySubscription
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
- ///
- ///
- /// -
- /// Mocking
- /// To mock this method, please mock instead.
- ///
- ///
- /// The instance the method will execute against.
- /// Maximum number of results to return.
+ /// Gets information about the deleted vaults in a subscription.
+ /// The the method will execute against.
/// The cancellation token to use.
/// is null.
- /// An async collection of that may take multiple service requests to iterate over.
- public static AsyncPageable GetManagedHsmsAsync(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default)
+ /// A collection of that may take multiple service requests to iterate over.
+ public static AsyncPageable GetDeletedKeyVaultsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource));
- return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetManagedHsmsAsync(top, cancellationToken);
+ return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetDeletedKeyVaultsAsync(cancellationToken);
}
- ///
- /// The List operation gets information about the managed HSM Pools associated with the subscription.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/managedHSMs
- ///
- /// -
- /// Operation Id
- /// ManagedHsms_ListBySubscription
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
- ///
- ///
- /// -
- /// Mocking
- /// To mock this method, please mock instead.
- ///
- ///
- /// The instance the method will execute against.
- /// Maximum number of results to return.
+ /// Gets information about the deleted vaults in a subscription.
+ /// The the method will execute against.
/// The cancellation token to use.
/// is null.
- /// A collection of that may take multiple service requests to iterate over.
- public static Pageable GetManagedHsms(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default)
+ /// A collection of that may take multiple service requests to iterate over.
+ public static Pageable GetDeletedKeyVaults(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource));
- return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetManagedHsms(top, cancellationToken);
+ return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetDeletedKeyVaults(cancellationToken);
}
- ///
- /// Checks that the vault name is valid and is not already in use.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability
- ///
- /// -
- /// Operation Id
- /// Vaults_CheckNameAvailability
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
- ///
- ///
- /// -
- /// Mocking
- /// To mock this method, please mock instead.
- ///
- ///
- /// The instance the method will execute against.
+ /// Checks that the vault name is valid and is not already in use.
+ /// The the method will execute against.
/// The name of the vault.
/// The cancellation token to use.
- /// or is null.
+ /// is null.
public static async Task> CheckKeyVaultNameAvailabilityAsync(this SubscriptionResource subscriptionResource, KeyVaultNameAvailabilityContent content, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource));
@@ -788,35 +334,11 @@ public static async Task> CheckKeyVault
return await GetMockableKeyVaultSubscriptionResource(subscriptionResource).CheckKeyVaultNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false);
}
- ///
- /// Checks that the vault name is valid and is not already in use.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability
- ///
- /// -
- /// Operation Id
- /// Vaults_CheckNameAvailability
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
- ///
- ///
- /// -
- /// Mocking
- /// To mock this method, please mock instead.
- ///
- ///
- /// The instance the method will execute against.
+ /// Checks that the vault name is valid and is not already in use.
+ /// The the method will execute against.
/// The name of the vault.
/// The cancellation token to use.
- /// or is null.
+ /// is null.
public static Response CheckKeyVaultNameAvailability(this SubscriptionResource subscriptionResource, KeyVaultNameAvailabilityContent content, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource));
@@ -824,142 +346,52 @@ public static Response CheckKeyVaultNameAvailabi
return GetMockableKeyVaultSubscriptionResource(subscriptionResource).CheckKeyVaultNameAvailability(content, cancellationToken);
}
- ///
- /// Gets information about the deleted vaults in a subscription.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults
- ///
- /// -
- /// Operation Id
- /// Vaults_ListDeleted
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- ///
- /// -
- /// Mocking
- /// To mock this method, please mock instead.
- ///
- ///
- /// The instance the method will execute against.
+ /// The List operation gets information about the deleted managed HSMs associated with the subscription.
+ /// The the method will execute against.
/// The cancellation token to use.
/// is null.
- /// An async collection of that may take multiple service requests to iterate over.
- public static AsyncPageable GetDeletedKeyVaultsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default)
+ /// A collection of that may take multiple service requests to iterate over.
+ public static AsyncPageable GetDeletedManagedHsmsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource));
- return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetDeletedKeyVaultsAsync(cancellationToken);
+ return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetDeletedManagedHsmsAsync(cancellationToken);
}
- ///
- /// Gets information about the deleted vaults in a subscription.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults
- ///
- /// -
- /// Operation Id
- /// Vaults_ListDeleted
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- ///
- /// -
- /// Mocking
- /// To mock this method, please mock instead.
- ///
- ///
- /// The instance the method will execute against.
+ /// The List operation gets information about the deleted managed HSMs associated with the subscription.
+ /// The the method will execute against.
/// The cancellation token to use.
/// is null.
- /// A collection of that may take multiple service requests to iterate over.
- public static Pageable GetDeletedKeyVaults(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default)
+ /// A collection of that may take multiple service requests to iterate over.
+ public static Pageable GetDeletedManagedHsms(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource));
- return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetDeletedKeyVaults(cancellationToken);
+ return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetDeletedManagedHsms(cancellationToken);
}
- ///
- /// The List operation gets information about the vaults associated with the subscription.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults
- ///
- /// -
- /// Operation Id
- /// Vaults_ListBySubscription
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
- ///
- ///
- /// -
- /// Mocking
- /// To mock this method, please mock instead.
- ///
- ///
- /// The instance the method will execute against.
- /// Maximum number of results to return.
+ /// Checks that the managed hsm name is valid and is not already in use.
+ /// The the method will execute against.
+ /// The request body.
/// The cancellation token to use.
/// is null.
- /// An async collection of that may take multiple service requests to iterate over.
- public static AsyncPageable GetKeyVaultsAsync(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default)
+ public static async Task> CheckManagedHsmNameAvailabilityAsync(this SubscriptionResource subscriptionResource, ManagedHsmNameAvailabilityParameters content, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource));
- return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetKeyVaultsAsync(top, cancellationToken);
+ return await GetMockableKeyVaultSubscriptionResource(subscriptionResource).CheckManagedHsmNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false);
}
- ///
- /// The List operation gets information about the vaults associated with the subscription.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults
- ///
- /// -
- /// Operation Id
- /// Vaults_ListBySubscription
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
- ///
- ///
- /// -
- /// Mocking
- /// To mock this method, please mock instead.
- ///
- ///
- /// The instance the method will execute against.
- /// Maximum number of results to return.
+ /// Checks that the managed hsm name is valid and is not already in use.
+ /// The the method will execute against.
+ /// The request body.
/// The cancellation token to use.
/// is null.
- /// A collection of that may take multiple service requests to iterate over.
- public static Pageable GetKeyVaults(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default)
+ public static Response CheckManagedHsmNameAvailability(this SubscriptionResource subscriptionResource, ManagedHsmNameAvailabilityParameters content, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource));
- return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetKeyVaults(top, cancellationToken);
+ return GetMockableKeyVaultSubscriptionResource(subscriptionResource).CheckManagedHsmNameAvailability(content, cancellationToken);
}
}
}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultArmClient.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultArmClient.cs
index efff015ab328..e0f28bedb84b 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultArmClient.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultArmClient.cs
@@ -6,50 +6,54 @@
#nullable disable
using Azure.Core;
+using Azure.ResourceManager;
+using Azure.ResourceManager.KeyVault;
namespace Azure.ResourceManager.KeyVault.Mocking
{
- /// A class to add extension methods to ArmClient.
+ /// A class to add extension methods to .
public partial class MockableKeyVaultArmClient : ArmResource
{
- /// Initializes a new instance of the class for mocking.
+ /// Initializes a new instance of MockableKeyVaultArmClient for mocking.
protected MockableKeyVaultArmClient()
{
}
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of class.
/// The client parameters to use in these operations.
/// The identifier of the resource that is the target of operations.
internal MockableKeyVaultArmClient(ArmClient client, ResourceIdentifier id) : base(client, id)
{
}
- internal MockableKeyVaultArmClient(ArmClient client) : this(client, ResourceIdentifier.Root)
+ /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
+ /// The resource ID of the resource to get.
+ /// Returns a object.
+ public virtual KeyVaultResource GetKeyVaultResource(ResourceIdentifier id)
{
+ KeyVaultResource.ValidateResourceId(id);
+ return new KeyVaultResource(Client, id);
}
- private string GetApiVersionOrNull(ResourceType resourceType)
+ /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
+ /// The resource ID of the resource to get.
+ /// Returns a object.
+ public virtual DeletedKeyVaultResource GetDeletedKeyVaultResource(ResourceIdentifier id)
{
- TryGetApiVersion(resourceType, out string apiVersion);
- return apiVersion;
+ DeletedKeyVaultResource.ValidateResourceId(id);
+ return new DeletedKeyVaultResource(Client, id);
}
- ///
- /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
- /// You can use to create a from its components.
- ///
+ /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
/// The resource ID of the resource to get.
- /// Returns a object.
- public virtual DeletedManagedHsmResource GetDeletedManagedHsmResource(ResourceIdentifier id)
+ /// Returns a object.
+ public virtual KeyVaultPrivateEndpointConnectionResource GetKeyVaultPrivateEndpointConnectionResource(ResourceIdentifier id)
{
- DeletedManagedHsmResource.ValidateResourceId(id);
- return new DeletedManagedHsmResource(Client, id);
+ KeyVaultPrivateEndpointConnectionResource.ValidateResourceId(id);
+ return new KeyVaultPrivateEndpointConnectionResource(Client, id);
}
- ///
- /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
- /// You can use to create a from its components.
- ///
+ /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
/// The resource ID of the resource to get.
/// Returns a object.
public virtual ManagedHsmResource GetManagedHsmResource(ResourceIdentifier id)
@@ -58,34 +62,16 @@ public virtual ManagedHsmResource GetManagedHsmResource(ResourceIdentifier id)
return new ManagedHsmResource(Client, id);
}
- ///
- /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
- /// You can use to create a from its components.
- ///
- /// The resource ID of the resource to get.
- /// Returns a object.
- public virtual DeletedKeyVaultResource GetDeletedKeyVaultResource(ResourceIdentifier id)
- {
- DeletedKeyVaultResource.ValidateResourceId(id);
- return new DeletedKeyVaultResource(Client, id);
- }
-
- ///
- /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
- /// You can use to create a from its components.
- ///
+ /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
/// The resource ID of the resource to get.
- /// Returns a object.
- public virtual KeyVaultResource GetKeyVaultResource(ResourceIdentifier id)
+ /// Returns a object.
+ public virtual DeletedManagedHsmResource GetDeletedManagedHsmResource(ResourceIdentifier id)
{
- KeyVaultResource.ValidateResourceId(id);
- return new KeyVaultResource(Client, id);
+ DeletedManagedHsmResource.ValidateResourceId(id);
+ return new DeletedManagedHsmResource(Client, id);
}
- ///
- /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
- /// You can use to create a from its components.
- ///
+ /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
/// The resource ID of the resource to get.
/// Returns a object.
public virtual ManagedHsmPrivateEndpointConnectionResource GetManagedHsmPrivateEndpointConnectionResource(ResourceIdentifier id)
@@ -94,22 +80,7 @@ public virtual ManagedHsmPrivateEndpointConnectionResource GetManagedHsmPrivateE
return new ManagedHsmPrivateEndpointConnectionResource(Client, id);
}
- ///
- /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
- /// You can use to create a from its components.
- ///
- /// The resource ID of the resource to get.
- /// Returns a object.
- public virtual KeyVaultPrivateEndpointConnectionResource GetKeyVaultPrivateEndpointConnectionResource(ResourceIdentifier id)
- {
- KeyVaultPrivateEndpointConnectionResource.ValidateResourceId(id);
- return new KeyVaultPrivateEndpointConnectionResource(Client, id);
- }
-
- ///
- /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
- /// You can use to create a from its components.
- ///
+ /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
/// The resource ID of the resource to get.
/// Returns a object.
public virtual KeyVaultSecretResource GetKeyVaultSecretResource(ResourceIdentifier id)
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultResourceGroupResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultResourceGroupResource.cs
index 2b70a498f5c2..def9cf172bd7 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultResourceGroupResource.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultResourceGroupResource.cs
@@ -8,167 +8,238 @@
using System;
using System.Threading;
using System.Threading.Tasks;
+using Azure;
using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager;
+using Azure.ResourceManager.KeyVault;
+using Azure.ResourceManager.KeyVault.Models;
+using Azure.ResourceManager.Resources;
namespace Azure.ResourceManager.KeyVault.Mocking
{
- /// A class to add extension methods to ResourceGroupResource.
+ /// A class to add extension methods to .
public partial class MockableKeyVaultResourceGroupResource : ArmResource
{
- /// Initializes a new instance of the class for mocking.
+ private ClientDiagnostics _vaultsClientDiagnostics;
+ private Vaults _vaultsRestClient;
+
+ /// Initializes a new instance of MockableKeyVaultResourceGroupResource for mocking.
protected MockableKeyVaultResourceGroupResource()
{
}
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of class.
/// The client parameters to use in these operations.
/// The identifier of the resource that is the target of operations.
internal MockableKeyVaultResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id)
{
}
- private string GetApiVersionOrNull(ResourceType resourceType)
- {
- TryGetApiVersion(resourceType, out string apiVersion);
- return apiVersion;
- }
+ private ClientDiagnostics VaultsClientDiagnostics => _vaultsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.KeyVault.Mocking", ProviderConstants.DefaultProviderNamespace, Diagnostics);
- /// Gets a collection of ManagedHsmResources in the ResourceGroupResource.
- /// An object representing collection of ManagedHsmResources and their operations over a ManagedHsmResource.
- public virtual ManagedHsmCollection GetManagedHsms()
+ private Vaults VaultsRestClient => _vaultsRestClient ??= new Vaults(VaultsClientDiagnostics, Pipeline, Endpoint, "2025-05-01");
+
+ /// Gets a collection of KeyVaults in the .
+ /// An object representing collection of KeyVaults and their operations over a KeyVaultResource.
+ public virtual KeyVaultCollection GetKeyVaults()
{
- return GetCachedClient(client => new ManagedHsmCollection(client, Id));
+ return GetCachedClient(client => new KeyVaultCollection(client, Id));
}
///
- /// Gets the specified managed HSM Pool.
+ /// Gets the specified Azure key vault.
///
/// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}
+ /// Request Path.
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}.
///
/// -
- /// Operation Id
- /// ManagedHsms_Get
+ /// Operation Id.
+ /// Vaults_Get.
///
/// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
+ /// Default Api Version.
+ /// 2025-05-01.
///
///
///
- /// The name of the managed HSM Pool.
+ /// The name of the vault.
/// The cancellation token to use.
- /// is null.
- /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
[ForwardsClientCalls]
- public virtual async Task> GetManagedHsmAsync(string name, CancellationToken cancellationToken = default)
+ public virtual async Task> GetKeyVaultAsync(string vaultName, CancellationToken cancellationToken = default)
{
- return await GetManagedHsms().GetAsync(name, cancellationToken).ConfigureAwait(false);
+ Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName));
+
+ return await GetKeyVaults().GetAsync(vaultName, cancellationToken).ConfigureAwait(false);
}
///
- /// Gets the specified managed HSM Pool.
+ /// Gets the specified Azure key vault.
///
/// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}
- ///
- /// -
- /// Operation Id
- /// ManagedHsms_Get
+ /// Request Path.
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}.
///
/// -
- /// Default Api Version
- /// 2025-05-01
+ /// Operation Id.
+ /// Vaults_Get.
///
/// -
- /// Resource
- ///
+ /// Default Api Version.
+ /// 2025-05-01.
///
///
///
- /// The name of the managed HSM Pool.
+ /// The name of the vault.
/// The cancellation token to use.
- /// is null.
- /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
[ForwardsClientCalls]
- public virtual Response GetManagedHsm(string name, CancellationToken cancellationToken = default)
+ public virtual Response GetKeyVault(string vaultName, CancellationToken cancellationToken = default)
{
- return GetManagedHsms().Get(name, cancellationToken);
+ Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName));
+
+ return GetKeyVaults().Get(vaultName, cancellationToken);
}
- /// Gets a collection of KeyVaultResources in the ResourceGroupResource.
- /// An object representing collection of KeyVaultResources and their operations over a KeyVaultResource.
- public virtual KeyVaultCollection GetKeyVaults()
+ /// Gets a collection of ManagedHsms in the .
+ /// An object representing collection of ManagedHsms and their operations over a ManagedHsmResource.
+ public virtual ManagedHsmCollection GetManagedHsms()
{
- return GetCachedClient(client => new KeyVaultCollection(client, Id));
+ return GetCachedClient(client => new ManagedHsmCollection(client, Id));
}
///
- /// Gets the specified Azure key vault.
+ /// Gets the specified managed HSM Pool.
///
/// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}
- ///
- /// -
- /// Operation Id
- /// Vaults_Get
+ /// Request Path.
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}.
///
/// -
- /// Default Api Version
- /// 2025-05-01
+ /// Operation Id.
+ /// ManagedHsms_Get.
///
/// -
- /// Resource
- ///
+ /// Default Api Version.
+ /// 2025-05-01.
///
///
///
- /// The name of the vault.
+ /// The name of the managed HSM Pool.
/// The cancellation token to use.
- /// is null.
- /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
[ForwardsClientCalls]
- public virtual async Task> GetKeyVaultAsync(string vaultName, CancellationToken cancellationToken = default)
+ public virtual async Task> GetManagedHsmAsync(string name, CancellationToken cancellationToken = default)
{
- return await GetKeyVaults().GetAsync(vaultName, cancellationToken).ConfigureAwait(false);
+ Argument.AssertNotNullOrEmpty(name, nameof(name));
+
+ return await GetManagedHsms().GetAsync(name, cancellationToken).ConfigureAwait(false);
}
///
- /// Gets the specified Azure key vault.
+ /// Gets the specified managed HSM Pool.
///
/// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}
- ///
- /// -
- /// Operation Id
- /// Vaults_Get
+ /// Request Path.
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}.
///
/// -
- /// Default Api Version
- /// 2025-05-01
+ /// Operation Id.
+ /// ManagedHsms_Get.
///
/// -
- /// Resource
- ///
+ /// Default Api Version.
+ /// 2025-05-01.
///
///
///
- /// The name of the vault.
+ /// The name of the managed HSM Pool.
/// The cancellation token to use.
- /// is null.
- /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
[ForwardsClientCalls]
- public virtual Response GetKeyVault(string vaultName, CancellationToken cancellationToken = default)
+ public virtual Response GetManagedHsm(string name, CancellationToken cancellationToken = default)
{
- return GetKeyVaults().Get(vaultName, cancellationToken);
+ Argument.AssertNotNullOrEmpty(name, nameof(name));
+
+ return GetManagedHsms().Get(name, cancellationToken);
+ }
+
+ /// Update access policies in a key vault in the specified subscription.
+ /// Name of the vault.
+ /// Name of the operation.
+ /// Access policy to merge into the vault.
+ /// The cancellation token to use.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual async Task> UpdateAccessPolicyAsync(string vaultName, AccessPolicyUpdateKind operationKind, KeyVaultAccessPolicyParameters keyVaultAccessPolicyParameters, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName));
+ Argument.AssertNotNull(keyVaultAccessPolicyParameters, nameof(keyVaultAccessPolicyParameters));
+
+ using DiagnosticScope scope = VaultsClientDiagnostics.CreateScope("MockableKeyVaultResourceGroupResource.UpdateAccessPolicy");
+ scope.Start();
+ try
+ {
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ HttpMessage message = VaultsRestClient.CreateUpdateAccessPolicyRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, vaultName, operationKind.ToString(), KeyVaultAccessPolicyParameters.ToRequestContent(keyVaultAccessPolicyParameters), context);
+ Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ Response response = Response.FromValue(KeyVaultAccessPolicyParameters.FromResponse(result), result);
+ if (response.Value == null)
+ {
+ throw new RequestFailedException(response.GetRawResponse());
+ }
+ return response;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Update access policies in a key vault in the specified subscription.
+ /// Name of the vault.
+ /// Name of the operation.
+ /// Access policy to merge into the vault.
+ /// The cancellation token to use.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ public virtual Response UpdateAccessPolicy(string vaultName, AccessPolicyUpdateKind operationKind, KeyVaultAccessPolicyParameters keyVaultAccessPolicyParameters, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName));
+ Argument.AssertNotNull(keyVaultAccessPolicyParameters, nameof(keyVaultAccessPolicyParameters));
+
+ using DiagnosticScope scope = VaultsClientDiagnostics.CreateScope("MockableKeyVaultResourceGroupResource.UpdateAccessPolicy");
+ scope.Start();
+ try
+ {
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ HttpMessage message = VaultsRestClient.CreateUpdateAccessPolicyRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, vaultName, operationKind.ToString(), KeyVaultAccessPolicyParameters.ToRequestContent(keyVaultAccessPolicyParameters), context);
+ Response result = Pipeline.ProcessMessage(message, context);
+ Response response = Response.FromValue(KeyVaultAccessPolicyParameters.FromResponse(result), result);
+ if (response.Value == null)
+ {
+ throw new RequestFailedException(response.GetRawResponse());
+ }
+ return response;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
}
}
}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultSubscriptionResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultSubscriptionResource.cs
index 8aaeeb5530f0..eea0fad58c45 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultSubscriptionResource.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultSubscriptionResource.cs
@@ -8,227 +8,169 @@
using System;
using System.Threading;
using System.Threading.Tasks;
-using Autorest.CSharp.Core;
+using Azure;
using Azure.Core;
using Azure.Core.Pipeline;
+using Azure.ResourceManager;
+using Azure.ResourceManager.KeyVault;
using Azure.ResourceManager.KeyVault.Models;
+using Azure.ResourceManager.Resources;
namespace Azure.ResourceManager.KeyVault.Mocking
{
- /// A class to add extension methods to SubscriptionResource.
+ /// A class to add extension methods to .
public partial class MockableKeyVaultSubscriptionResource : ArmResource
{
- private ClientDiagnostics _managedHsmClientDiagnostics;
- private ManagedHsmsRestOperations _managedHsmRestClient;
- private ClientDiagnostics _managedHsmsClientDiagnostics;
- private ManagedHsmsRestOperations _managedHsmsRestClient;
- private ClientDiagnostics _keyVaultVaultsClientDiagnostics;
- private VaultsRestOperations _keyVaultVaultsRestClient;
private ClientDiagnostics _vaultsClientDiagnostics;
- private VaultsRestOperations _vaultsRestClient;
+ private Vaults _vaultsRestClient;
+ private ClientDiagnostics _managedHsmsClientDiagnostics;
+ private ManagedHsms _managedHsmsRestClient;
+ private ClientDiagnostics _vaultsOperationGroupClientDiagnostics;
+ private VaultsOperationGroup _vaultsOperationGroupRestClient;
+ private ClientDiagnostics _managedHsmsOperationGroupClientDiagnostics;
+ private ManagedHsmsOperationGroup _managedHsmsOperationGroupRestClient;
- /// Initializes a new instance of the class for mocking.
+ /// Initializes a new instance of MockableKeyVaultSubscriptionResource for mocking.
protected MockableKeyVaultSubscriptionResource()
{
}
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of class.
/// The client parameters to use in these operations.
/// The identifier of the resource that is the target of operations.
internal MockableKeyVaultSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id)
{
}
- private ClientDiagnostics ManagedHsmClientDiagnostics => _managedHsmClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.KeyVault", ManagedHsmResource.ResourceType.Namespace, Diagnostics);
- private ManagedHsmsRestOperations ManagedHsmRestClient => _managedHsmRestClient ??= new ManagedHsmsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ManagedHsmResource.ResourceType));
- private ClientDiagnostics ManagedHsmsClientDiagnostics => _managedHsmsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.KeyVault", ProviderConstants.DefaultProviderNamespace, Diagnostics);
- private ManagedHsmsRestOperations ManagedHsmsRestClient => _managedHsmsRestClient ??= new ManagedHsmsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint);
- private ClientDiagnostics KeyVaultVaultsClientDiagnostics => _keyVaultVaultsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.KeyVault", KeyVaultResource.ResourceType.Namespace, Diagnostics);
- private VaultsRestOperations KeyVaultVaultsRestClient => _keyVaultVaultsRestClient ??= new VaultsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(KeyVaultResource.ResourceType));
- private ClientDiagnostics VaultsClientDiagnostics => _vaultsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.KeyVault", ProviderConstants.DefaultProviderNamespace, Diagnostics);
- private VaultsRestOperations VaultsRestClient => _vaultsRestClient ??= new VaultsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint);
+ private ClientDiagnostics VaultsClientDiagnostics => _vaultsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.KeyVault.Mocking", ProviderConstants.DefaultProviderNamespace, Diagnostics);
+
+ private Vaults VaultsRestClient => _vaultsRestClient ??= new Vaults(VaultsClientDiagnostics, Pipeline, Endpoint, "2025-05-01");
+
+ private ClientDiagnostics ManagedHsmsClientDiagnostics => _managedHsmsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.KeyVault.Mocking", ProviderConstants.DefaultProviderNamespace, Diagnostics);
+
+ private ManagedHsms ManagedHsmsRestClient => _managedHsmsRestClient ??= new ManagedHsms(ManagedHsmsClientDiagnostics, Pipeline, Endpoint, "2025-05-01");
+
+ private ClientDiagnostics VaultsOperationGroupClientDiagnostics => _vaultsOperationGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.KeyVault.Mocking", ProviderConstants.DefaultProviderNamespace, Diagnostics);
- private string GetApiVersionOrNull(ResourceType resourceType)
+ private VaultsOperationGroup VaultsOperationGroupRestClient => _vaultsOperationGroupRestClient ??= new VaultsOperationGroup(VaultsOperationGroupClientDiagnostics, Pipeline, Endpoint, "2025-05-01");
+
+ private ClientDiagnostics ManagedHsmsOperationGroupClientDiagnostics => _managedHsmsOperationGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.KeyVault.Mocking", ProviderConstants.DefaultProviderNamespace, Diagnostics);
+
+ private ManagedHsmsOperationGroup ManagedHsmsOperationGroupRestClient => _managedHsmsOperationGroupRestClient ??= new ManagedHsmsOperationGroup(ManagedHsmsOperationGroupClientDiagnostics, Pipeline, Endpoint, "2025-05-01");
+
+ /// Gets a collection of DeletedKeyVaults in the .
+ /// An object representing collection of DeletedKeyVaults and their operations over a DeletedKeyVaultResource.
+ public virtual DeletedKeyVaultCollection GetDeletedKeyVaults()
{
- TryGetApiVersion(resourceType, out string apiVersion);
- return apiVersion;
+ return GetCachedClient(client => new DeletedKeyVaultCollection(client, Id));
}
- /// Gets a collection of DeletedManagedHsmResources in the SubscriptionResource.
- /// An object representing collection of DeletedManagedHsmResources and their operations over a DeletedManagedHsmResource.
+ /// Gets a collection of DeletedManagedHsms in the .
+ /// An object representing collection of DeletedManagedHsms and their operations over a DeletedManagedHsmResource.
public virtual DeletedManagedHsmCollection GetDeletedManagedHsms()
{
return GetCachedClient(client => new DeletedManagedHsmCollection(client, Id));
}
- ///
- /// Gets the specified deleted managed HSM.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}
- ///
- /// -
- /// Operation Id
- /// ManagedHsms_GetDeleted
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
- ///
- ///
- ///
- /// The name of the Azure region.
- /// The name of the deleted managed HSM.
+ /// The List operation gets information about the vaults associated with the subscription.
+ /// Maximum number of results to return.
/// The cancellation token to use.
- /// is null.
- /// is an empty string, and was expected to be non-empty.
- [ForwardsClientCalls]
- public virtual async Task> GetDeletedManagedHsmAsync(AzureLocation location, string name, CancellationToken cancellationToken = default)
+ /// A collection of that may take multiple service requests to iterate over.
+ public virtual AsyncPageable GetKeyVaultsAsync(int? top = default, CancellationToken cancellationToken = default)
{
- return await GetDeletedManagedHsms().GetAsync(location, name, cancellationToken).ConfigureAwait(false);
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ return new AsyncPageableWrapper(new VaultsGetBySubscriptionAsyncCollectionResultOfT(VaultsRestClient, Guid.Parse(Id.SubscriptionId), top, context), data => new KeyVaultResource(Client, data));
}
- ///
- /// Gets the specified deleted managed HSM.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}
- ///
- /// -
- /// Operation Id
- /// ManagedHsms_GetDeleted
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
- ///
- ///
- ///
- /// The name of the Azure region.
- /// The name of the deleted managed HSM.
+ /// The List operation gets information about the vaults associated with the subscription.
+ /// Maximum number of results to return.
/// The cancellation token to use.
- /// is null.
- /// is an empty string, and was expected to be non-empty.
- [ForwardsClientCalls]
- public virtual Response GetDeletedManagedHsm(AzureLocation location, string name, CancellationToken cancellationToken = default)
+ /// A collection of that may take multiple service requests to iterate over.
+ public virtual Pageable GetKeyVaults(int? top = default, CancellationToken cancellationToken = default)
{
- return GetDeletedManagedHsms().Get(location, name, cancellationToken);
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ return new PageableWrapper(new VaultsGetBySubscriptionCollectionResultOfT(VaultsRestClient, Guid.Parse(Id.SubscriptionId), top, context), data => new KeyVaultResource(Client, data));
}
- /// Gets a collection of DeletedKeyVaultResources in the SubscriptionResource.
- /// An object representing collection of DeletedKeyVaultResources and their operations over a DeletedKeyVaultResource.
- public virtual DeletedKeyVaultCollection GetDeletedKeyVaults()
+ /// The List operation gets information about the managed HSM Pools associated with the subscription.
+ /// Maximum number of results to return.
+ /// The cancellation token to use.
+ /// A collection of that may take multiple service requests to iterate over.
+ public virtual AsyncPageable GetManagedHsmsAsync(int? top = default, CancellationToken cancellationToken = default)
{
- return GetCachedClient(client => new DeletedKeyVaultCollection(client, Id));
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ return new AsyncPageableWrapper(new ManagedHsmsGetBySubscriptionAsyncCollectionResultOfT(ManagedHsmsRestClient, Guid.Parse(Id.SubscriptionId), top, context), data => new ManagedHsmResource(Client, data));
}
- ///
- /// Gets the deleted Azure key vault.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}
- ///
- /// -
- /// Operation Id
- /// Vaults_GetDeleted
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
- ///
- ///
- ///
- /// The name of the Azure region.
- /// The name of the vault.
+ /// The List operation gets information about the managed HSM Pools associated with the subscription.
+ /// Maximum number of results to return.
/// The cancellation token to use.
- /// is null.
- /// is an empty string, and was expected to be non-empty.
- [ForwardsClientCalls]
- public virtual async Task> GetDeletedKeyVaultAsync(AzureLocation location, string vaultName, CancellationToken cancellationToken = default)
+ /// A collection of that may take multiple service requests to iterate over.
+ public virtual Pageable GetManagedHsms(int? top = default, CancellationToken cancellationToken = default)
{
- return await GetDeletedKeyVaults().GetAsync(location, vaultName, cancellationToken).ConfigureAwait(false);
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ return new PageableWrapper(new ManagedHsmsGetBySubscriptionCollectionResultOfT(ManagedHsmsRestClient, Guid.Parse(Id.SubscriptionId), top, context), data => new ManagedHsmResource(Client, data));
}
- ///
- /// Gets the deleted Azure key vault.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}
- ///
- /// -
- /// Operation Id
- /// Vaults_GetDeleted
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
- ///
- ///
- ///
- /// The name of the Azure region.
- /// The name of the vault.
+ /// Gets information about the deleted vaults in a subscription.
/// The cancellation token to use.
- /// is null.
- /// is an empty string, and was expected to be non-empty.
- [ForwardsClientCalls]
- public virtual Response GetDeletedKeyVault(AzureLocation location, string vaultName, CancellationToken cancellationToken = default)
+ /// A collection of that may take multiple service requests to iterate over.
+ public virtual AsyncPageable GetDeletedKeyVaultsAsync(CancellationToken cancellationToken = default)
{
- return GetDeletedKeyVaults().Get(location, vaultName, cancellationToken);
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ return new AsyncPageableWrapper(new VaultsOperationGroupGetDeletedKeyVaultsAsyncCollectionResultOfT(VaultsOperationGroupRestClient, Guid.Parse(Id.SubscriptionId), context), data => new DeletedKeyVaultResource(Client, data));
}
- ///
- /// Checks that the managed hsm name is valid and is not already in use.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkMhsmNameAvailability
- ///
- /// -
- /// Operation Id
- /// ManagedHsms_CheckManagedHsmNameAvailability
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
- ///
- ///
- ///
- /// The request body.
+ /// Gets information about the deleted vaults in a subscription.
+ /// The cancellation token to use.
+ /// A collection of that may take multiple service requests to iterate over.
+ public virtual Pageable GetDeletedKeyVaults(CancellationToken cancellationToken = default)
+ {
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ return new PageableWrapper(new VaultsOperationGroupGetDeletedKeyVaultsCollectionResultOfT(VaultsOperationGroupRestClient, Guid.Parse(Id.SubscriptionId), context), data => new DeletedKeyVaultResource(Client, data));
+ }
+
+ /// Checks that the vault name is valid and is not already in use.
+ /// The name of the vault.
/// The cancellation token to use.
/// is null.
- public virtual async Task> CheckManagedHsmNameAvailabilityAsync(ManagedHsmNameAvailabilityContent content, CancellationToken cancellationToken = default)
+ public virtual async Task> CheckKeyVaultNameAvailabilityAsync(KeyVaultNameAvailabilityContent content, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(content, nameof(content));
- using var scope = ManagedHsmClientDiagnostics.CreateScope("MockableKeyVaultSubscriptionResource.CheckManagedHsmNameAvailability");
+ using DiagnosticScope scope = VaultsOperationGroupClientDiagnostics.CreateScope("MockableKeyVaultSubscriptionResource.CheckKeyVaultNameAvailability");
scope.Start();
try
{
- var response = await ManagedHsmRestClient.CheckManagedHsmNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false);
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ HttpMessage message = VaultsOperationGroupRestClient.CreateCheckKeyVaultNameAvailabilityRequest(Guid.Parse(Id.SubscriptionId), KeyVaultNameAvailabilityContent.ToRequestContent(content), context);
+ Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ Response response = Response.FromValue(KeyVaultNameAvailabilityResult.FromResponse(result), result);
+ if (response.Value == null)
+ {
+ throw new RequestFailedException(response.GetRawResponse());
+ }
return response;
}
catch (Exception e)
@@ -238,39 +180,29 @@ public virtual async Task> CheckManag
}
}
- ///
- /// Checks that the managed hsm name is valid and is not already in use.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkMhsmNameAvailability
- ///
- /// -
- /// Operation Id
- /// ManagedHsms_CheckManagedHsmNameAvailability
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
- ///
- ///
- ///
- /// The request body.
+ /// Checks that the vault name is valid and is not already in use.
+ /// The name of the vault.
/// The cancellation token to use.
/// is null.
- public virtual Response CheckManagedHsmNameAvailability(ManagedHsmNameAvailabilityContent content, CancellationToken cancellationToken = default)
+ public virtual Response CheckKeyVaultNameAvailability(KeyVaultNameAvailabilityContent content, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(content, nameof(content));
- using var scope = ManagedHsmClientDiagnostics.CreateScope("MockableKeyVaultSubscriptionResource.CheckManagedHsmNameAvailability");
+ using DiagnosticScope scope = VaultsOperationGroupClientDiagnostics.CreateScope("MockableKeyVaultSubscriptionResource.CheckKeyVaultNameAvailability");
scope.Start();
try
{
- var response = ManagedHsmRestClient.CheckManagedHsmNameAvailability(Id.SubscriptionId, content, cancellationToken);
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ HttpMessage message = VaultsOperationGroupRestClient.CreateCheckKeyVaultNameAvailabilityRequest(Guid.Parse(Id.SubscriptionId), KeyVaultNameAvailabilityContent.ToRequestContent(content), context);
+ Response result = Pipeline.ProcessMessage(message, context);
+ Response response = Response.FromValue(KeyVaultNameAvailabilityResult.FromResponse(result), result);
+ if (response.Value == null)
+ {
+ throw new RequestFailedException(response.GetRawResponse());
+ }
return response;
}
catch (Exception e)
@@ -280,153 +212,53 @@ public virtual Response CheckManagedHsmNameAva
}
}
- ///
- /// The List operation gets information about the deleted managed HSMs associated with the subscription.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedManagedHSMs
- ///
- /// -
- /// Operation Id
- /// ManagedHsms_ListDeleted
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- ///
- ///
+ /// The List operation gets information about the deleted managed HSMs associated with the subscription.
/// The cancellation token to use.
- /// An async collection of that may take multiple service requests to iterate over.
+ /// A collection of that may take multiple service requests to iterate over.
public virtual AsyncPageable GetDeletedManagedHsmsAsync(CancellationToken cancellationToken = default)
{
- HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedHsmsRestClient.CreateListDeletedRequest(Id.SubscriptionId);
- HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedHsmsRestClient.CreateListDeletedNextPageRequest(nextLink, Id.SubscriptionId);
- return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DeletedManagedHsmResource(Client, DeletedManagedHsmData.DeserializeDeletedManagedHsmData(e)), ManagedHsmsClientDiagnostics, Pipeline, "MockableKeyVaultSubscriptionResource.GetDeletedManagedHsms", "value", "nextLink", cancellationToken);
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ return new AsyncPageableWrapper(new ManagedHsmsOperationGroupGetDeletedManagedHsmsAsyncCollectionResultOfT(ManagedHsmsOperationGroupRestClient, Guid.Parse(Id.SubscriptionId), context), data => new DeletedManagedHsmResource(Client, data));
}
- ///
- /// The List operation gets information about the deleted managed HSMs associated with the subscription.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedManagedHSMs
- ///
- /// -
- /// Operation Id
- /// ManagedHsms_ListDeleted
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- ///
- ///
+ /// The List operation gets information about the deleted managed HSMs associated with the subscription.
/// The cancellation token to use.
/// A collection of that may take multiple service requests to iterate over.
public virtual Pageable GetDeletedManagedHsms(CancellationToken cancellationToken = default)
{
- HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedHsmsRestClient.CreateListDeletedRequest(Id.SubscriptionId);
- HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedHsmsRestClient.CreateListDeletedNextPageRequest(nextLink, Id.SubscriptionId);
- return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeletedManagedHsmResource(Client, DeletedManagedHsmData.DeserializeDeletedManagedHsmData(e)), ManagedHsmsClientDiagnostics, Pipeline, "MockableKeyVaultSubscriptionResource.GetDeletedManagedHsms", "value", "nextLink", cancellationToken);
- }
-
- ///
- /// The List operation gets information about the managed HSM Pools associated with the subscription.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/managedHSMs
- ///
- /// -
- /// Operation Id
- /// ManagedHsms_ListBySubscription
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
- ///
- ///
- ///
- /// Maximum number of results to return.
- /// The cancellation token to use.
- /// An async collection of that may take multiple service requests to iterate over.
- public virtual AsyncPageable GetManagedHsmsAsync(int? top = null, CancellationToken cancellationToken = default)
- {
- HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedHsmRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top);
- HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedHsmRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top);
- return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedHsmResource(Client, ManagedHsmData.DeserializeManagedHsmData(e)), ManagedHsmClientDiagnostics, Pipeline, "MockableKeyVaultSubscriptionResource.GetManagedHsms", "value", "nextLink", cancellationToken);
- }
-
- ///
- /// The List operation gets information about the managed HSM Pools associated with the subscription.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/managedHSMs
- ///
- /// -
- /// Operation Id
- /// ManagedHsms_ListBySubscription
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
- ///
- ///
- ///
- /// Maximum number of results to return.
- /// The cancellation token to use.
- /// A collection of that may take multiple service requests to iterate over.
- public virtual Pageable GetManagedHsms(int? top = null, CancellationToken cancellationToken = default)
- {
- HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedHsmRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top);
- HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedHsmRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top);
- return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedHsmResource(Client, ManagedHsmData.DeserializeManagedHsmData(e)), ManagedHsmClientDiagnostics, Pipeline, "MockableKeyVaultSubscriptionResource.GetManagedHsms", "value", "nextLink", cancellationToken);
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ return new PageableWrapper(new ManagedHsmsOperationGroupGetDeletedManagedHsmsCollectionResultOfT(ManagedHsmsOperationGroupRestClient, Guid.Parse(Id.SubscriptionId), context), data => new DeletedManagedHsmResource(Client, data));
}
- ///
- /// Checks that the vault name is valid and is not already in use.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability
- ///
- /// -
- /// Operation Id
- /// Vaults_CheckNameAvailability
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
- ///
- ///
- ///
- /// The name of the vault.
+ /// Checks that the managed hsm name is valid and is not already in use.
+ /// The request body.
/// The cancellation token to use.
/// is null.
- public virtual async Task> CheckKeyVaultNameAvailabilityAsync(KeyVaultNameAvailabilityContent content, CancellationToken cancellationToken = default)
+ public virtual async Task> CheckManagedHsmNameAvailabilityAsync(ManagedHsmNameAvailabilityParameters content, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(content, nameof(content));
- using var scope = KeyVaultVaultsClientDiagnostics.CreateScope("MockableKeyVaultSubscriptionResource.CheckKeyVaultNameAvailability");
+ using DiagnosticScope scope = ManagedHsmsOperationGroupClientDiagnostics.CreateScope("MockableKeyVaultSubscriptionResource.CheckManagedHsmNameAvailability");
scope.Start();
try
{
- var response = await KeyVaultVaultsRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false);
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ HttpMessage message = ManagedHsmsOperationGroupRestClient.CreateCheckManagedHsmNameAvailabilityRequest(Guid.Parse(Id.SubscriptionId), ManagedHsmNameAvailabilityParameters.ToRequestContent(content), context);
+ Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ Response response = Response.FromValue(ManagedHsmNameAvailabilityResult.FromResponse(result), result);
+ if (response.Value == null)
+ {
+ throw new RequestFailedException(response.GetRawResponse());
+ }
return response;
}
catch (Exception e)
@@ -436,39 +268,29 @@ public virtual async Task> CheckKeyVaul
}
}
- ///
- /// Checks that the vault name is valid and is not already in use.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability
- ///
- /// -
- /// Operation Id
- /// Vaults_CheckNameAvailability
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
- ///
- ///
- ///
- /// The name of the vault.
+ /// Checks that the managed hsm name is valid and is not already in use.
+ /// The request body.
/// The cancellation token to use.
/// is null.
- public virtual Response CheckKeyVaultNameAvailability(KeyVaultNameAvailabilityContent content, CancellationToken cancellationToken = default)
+ public virtual Response CheckManagedHsmNameAvailability(ManagedHsmNameAvailabilityParameters content, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(content, nameof(content));
- using var scope = KeyVaultVaultsClientDiagnostics.CreateScope("MockableKeyVaultSubscriptionResource.CheckKeyVaultNameAvailability");
+ using DiagnosticScope scope = ManagedHsmsOperationGroupClientDiagnostics.CreateScope("MockableKeyVaultSubscriptionResource.CheckManagedHsmNameAvailability");
scope.Start();
try
{
- var response = KeyVaultVaultsRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken);
+ RequestContext context = new RequestContext
+ {
+ CancellationToken = cancellationToken
+ };
+ HttpMessage message = ManagedHsmsOperationGroupRestClient.CreateCheckManagedHsmNameAvailabilityRequest(Guid.Parse(Id.SubscriptionId), ManagedHsmNameAvailabilityParameters.ToRequestContent(content), context);
+ Response result = Pipeline.ProcessMessage(message, context);
+ Response response = Response.FromValue(ManagedHsmNameAvailabilityResult.FromResponse(result), result);
+ if (response.Value == null)
+ {
+ throw new RequestFailedException(response.GetRawResponse());
+ }
return response;
}
catch (Exception e)
@@ -477,119 +299,5 @@ public virtual Response CheckKeyVaultNameAvailab
throw;
}
}
-
- ///
- /// Gets information about the deleted vaults in a subscription.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults
- ///
- /// -
- /// Operation Id
- /// Vaults_ListDeleted
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- ///
- ///
- /// The cancellation token to use.
- /// An async collection of that may take multiple service requests to iterate over.
- public virtual AsyncPageable GetDeletedKeyVaultsAsync(CancellationToken cancellationToken = default)
- {
- HttpMessage FirstPageRequest(int? pageSizeHint) => VaultsRestClient.CreateListDeletedRequest(Id.SubscriptionId);
- HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VaultsRestClient.CreateListDeletedNextPageRequest(nextLink, Id.SubscriptionId);
- return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DeletedKeyVaultResource(Client, DeletedKeyVaultData.DeserializeDeletedKeyVaultData(e)), VaultsClientDiagnostics, Pipeline, "MockableKeyVaultSubscriptionResource.GetDeletedKeyVaults", "value", "nextLink", cancellationToken);
- }
-
- ///
- /// Gets information about the deleted vaults in a subscription.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults
- ///
- /// -
- /// Operation Id
- /// Vaults_ListDeleted
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- ///
- ///
- /// The cancellation token to use.
- /// A collection of that may take multiple service requests to iterate over.
- public virtual Pageable GetDeletedKeyVaults(CancellationToken cancellationToken = default)
- {
- HttpMessage FirstPageRequest(int? pageSizeHint) => VaultsRestClient.CreateListDeletedRequest(Id.SubscriptionId);
- HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VaultsRestClient.CreateListDeletedNextPageRequest(nextLink, Id.SubscriptionId);
- return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeletedKeyVaultResource(Client, DeletedKeyVaultData.DeserializeDeletedKeyVaultData(e)), VaultsClientDiagnostics, Pipeline, "MockableKeyVaultSubscriptionResource.GetDeletedKeyVaults", "value", "nextLink", cancellationToken);
- }
-
- ///
- /// The List operation gets information about the vaults associated with the subscription.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults
- ///
- /// -
- /// Operation Id
- /// Vaults_ListBySubscription
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
- ///
- ///
- ///
- /// Maximum number of results to return.
- /// The cancellation token to use.
- /// An async collection of that may take multiple service requests to iterate over.
- public virtual AsyncPageable GetKeyVaultsAsync(int? top = null, CancellationToken cancellationToken = default)
- {
- HttpMessage FirstPageRequest(int? pageSizeHint) => KeyVaultVaultsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top);
- HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => KeyVaultVaultsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top);
- return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new KeyVaultResource(Client, KeyVaultData.DeserializeKeyVaultData(e)), KeyVaultVaultsClientDiagnostics, Pipeline, "MockableKeyVaultSubscriptionResource.GetKeyVaults", "value", "nextLink", cancellationToken);
- }
-
- ///
- /// The List operation gets information about the vaults associated with the subscription.
- ///
- /// -
- /// Request Path
- /// /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults
- ///
- /// -
- /// Operation Id
- /// Vaults_ListBySubscription
- ///
- /// -
- /// Default Api Version
- /// 2025-05-01
- ///
- /// -
- /// Resource
- ///
- ///
- ///
- ///
- /// Maximum number of results to return.
- /// The cancellation token to use.
- /// A collection of that may take multiple service requests to iterate over.
- public virtual Pageable GetKeyVaults(int? top = null, CancellationToken cancellationToken = default)
- {
- HttpMessage FirstPageRequest(int? pageSizeHint) => KeyVaultVaultsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top);
- HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => KeyVaultVaultsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top);
- return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new KeyVaultResource(Client, KeyVaultData.DeserializeKeyVaultData(e)), KeyVaultVaultsClientDiagnostics, Pipeline, "MockableKeyVaultSubscriptionResource.GetKeyVaults", "value", "nextLink", cancellationToken);
- }
}
}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/Argument.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/Argument.cs
index e17d26ee6fff..5237420a2391 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/Argument.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/Argument.cs
@@ -11,8 +11,10 @@
namespace Azure.ResourceManager.KeyVault
{
- internal static class Argument
+ internal static partial class Argument
{
+ /// The value.
+ /// The name.
public static void AssertNotNull(T value, string name)
{
if (value is null)
@@ -21,8 +23,10 @@ public static void AssertNotNull(T value, string name)
}
}
+ /// The value.
+ /// The name.
public static void AssertNotNull(T? value, string name)
- where T : struct
+ where T : struct
{
if (!value.HasValue)
{
@@ -30,6 +34,8 @@ public static void AssertNotNull(T? value, string name)
}
}
+ /// The value.
+ /// The name.
public static void AssertNotNullOrEmpty(IEnumerable value, string name)
{
if (value is null)
@@ -51,6 +57,8 @@ public static void AssertNotNullOrEmpty(IEnumerable value, string name)
}
}
+ /// The value.
+ /// The name.
public static void AssertNotNullOrEmpty(string value, string name)
{
if (value is null)
@@ -62,68 +70,5 @@ public static void AssertNotNullOrEmpty(string value, string name)
throw new ArgumentException("Value cannot be an empty string.", name);
}
}
-
- public static void AssertNotNullOrWhiteSpace(string value, string name)
- {
- if (value is null)
- {
- throw new ArgumentNullException(name);
- }
- if (string.IsNullOrWhiteSpace(value))
- {
- throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name);
- }
- }
-
- public static void AssertNotDefault(ref T value, string name)
- where T : struct, IEquatable
- {
- if (value.Equals(default))
- {
- throw new ArgumentException("Value cannot be empty.", name);
- }
- }
-
- public static void AssertInRange(T value, T minimum, T maximum, string name)
- where T : notnull, IComparable
- {
- if (minimum.CompareTo(value) > 0)
- {
- throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed.");
- }
- if (maximum.CompareTo(value) < 0)
- {
- throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed.");
- }
- }
-
- public static void AssertEnumDefined(Type enumType, object value, string name)
- {
- if (!Enum.IsDefined(enumType, value))
- {
- throw new ArgumentException($"Value not defined for {enumType.FullName}.", name);
- }
- }
-
- public static T CheckNotNull(T value, string name)
- where T : class
- {
- AssertNotNull(value, name);
- return value;
- }
-
- public static string CheckNotNullOrEmpty(string value, string name)
- {
- AssertNotNullOrEmpty(value, name);
- return value;
- }
-
- public static void AssertNull(T value, string name, string message = null)
- {
- if (value != null)
- {
- throw new ArgumentException(message ?? "Value must be null.", name);
- }
- }
}
}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/AsyncPageableWrapper.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/AsyncPageableWrapper.cs
new file mode 100644
index 000000000000..00488bdab462
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/AsyncPageableWrapper.cs
@@ -0,0 +1,48 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Azure;
+
+namespace Azure.ResourceManager.KeyVault
+{
+ internal partial class AsyncPageableWrapper : AsyncPageable
+ {
+ /// The source async pageable value of type AsyncPageable<T>.
+ private AsyncPageable _source;
+ /// The converter function from T to U.
+ private Func _converter;
+
+ /// Initializes a new instance of the AsyncPageableWrapper class.
+ /// The source async pageable value of type AsyncPageable<T>.
+ /// The converter function from T to U.
+ public AsyncPageableWrapper(AsyncPageable source, Func converter)
+ {
+ _source = source;
+ _converter = converter;
+ }
+
+ /// Converts the pages from AsyncPageable to Page.
+ /// A continuation token from a previous response.
+ /// An optional hint to specify the desired size of each page.
+ /// An enumerable of pages containing converted items of type U.
+ public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint)
+ {
+ await foreach (Page page in _source.AsPages(continuationToken, pageSizeHint).ConfigureAwait(false))
+ {
+ List convertedItems = new List();
+ foreach (T item in page.Values)
+ {
+ convertedItems.Add(_converter.Invoke(item));
+ }
+ yield return Page.FromValues(convertedItems, page.ContinuationToken, page.GetRawResponse());
+ }
+ }
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/BicepSerializationHelpers.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/BicepSerializationHelpers.cs
deleted file mode 100644
index 7eba433fe042..000000000000
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/BicepSerializationHelpers.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-//
-
-#nullable disable
-
-using System;
-using System.ClientModel.Primitives;
-using System.Text;
-
-namespace Azure.ResourceManager.KeyVault
-{
- internal static class BicepSerializationHelpers
- {
- public static void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName)
- {
- string indent = new string(' ', spaces);
- int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length;
- int length = stringBuilder.Length;
- bool inMultilineString = false;
-
- BinaryData data = ModelReaderWriter.Write(childObject, options, AzureResourceManagerKeyVaultContext.Default);
- string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
- for (int i = 0; i < lines.Length; i++)
- {
- string line = lines[i];
- if (inMultilineString)
- {
- if (line.Contains("'''"))
- {
- inMultilineString = false;
- }
- stringBuilder.AppendLine(line);
- continue;
- }
- if (line.Contains("'''"))
- {
- inMultilineString = true;
- stringBuilder.AppendLine($"{indent}{line}");
- continue;
- }
- if (i == 0 && !indentFirstLine)
- {
- stringBuilder.AppendLine($"{line}");
- }
- else
- {
- stringBuilder.AppendLine($"{indent}{line}");
- }
- }
- if (stringBuilder.Length == length + emptyObjectLength)
- {
- stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length;
- }
- }
- }
-}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/ChangeTrackingDictionary.cs
index 8bff13e6b145..40288103e255 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/ChangeTrackingDictionary.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/ChangeTrackingDictionary.cs
@@ -11,7 +11,8 @@
namespace Azure.ResourceManager.KeyVault
{
- internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull
+ internal partial class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary
+ where TKey : notnull
{
private IDictionary _innerDictionary;
@@ -19,6 +20,7 @@ public ChangeTrackingDictionary()
{
}
+ /// The inner dictionary.
public ChangeTrackingDictionary(IDictionary dictionary)
{
if (dictionary == null)
@@ -28,6 +30,7 @@ public ChangeTrackingDictionary(IDictionary dictionary)
_innerDictionary = new Dictionary(dictionary);
}
+ /// The inner dictionary.
public ChangeTrackingDictionary(IReadOnlyDictionary dictionary)
{
if (dictionary == null)
@@ -41,16 +44,22 @@ public ChangeTrackingDictionary(IReadOnlyDictionary dictionary)
}
}
+ /// Gets the IsUndefined.
public bool IsUndefined => _innerDictionary == null;
+ /// Gets the Count.
public int Count => IsUndefined ? 0 : EnsureDictionary().Count;
+ /// Gets the IsReadOnly.
public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly;
+ /// Gets the Keys.
public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys;
+ /// Gets the Values.
public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values;
+ /// Gets or sets the value associated with the specified key.
public TValue this[TKey key]
{
get
@@ -67,8 +76,10 @@ public TValue this[TKey key]
}
}
+ /// Gets the Keys.
IEnumerable IReadOnlyDictionary.Keys => Keys;
+ /// Gets the Values.
IEnumerable IReadOnlyDictionary.Values => Values;
public IEnumerator> GetEnumerator()
@@ -89,6 +100,7 @@ IEnumerator IEnumerable.GetEnumerator()
return GetEnumerator();
}
+ /// The item to add.
public void Add(KeyValuePair item)
{
EnsureDictionary().Add(item);
@@ -99,6 +111,7 @@ public void Clear()
EnsureDictionary().Clear();
}
+ /// The item to search for.
public bool Contains(KeyValuePair item)
{
if (IsUndefined)
@@ -108,6 +121,8 @@ public bool Contains(KeyValuePair item)
return EnsureDictionary().Contains(item);
}
+ /// The array to copy.
+ /// The index.
public void CopyTo(KeyValuePair[] array, int index)
{
if (IsUndefined)
@@ -117,6 +132,7 @@ public void CopyTo(KeyValuePair[] array, int index)
EnsureDictionary().CopyTo(array, index);
}
+ /// The item to remove.
public bool Remove(KeyValuePair item)
{
if (IsUndefined)
@@ -126,11 +142,14 @@ public bool Remove(KeyValuePair item)
return EnsureDictionary().Remove(item);
}
+ /// The key.
+ /// The value to add.
public void Add(TKey key, TValue value)
{
EnsureDictionary().Add(key, value);
}
+ /// The key to search for.
public bool ContainsKey(TKey key)
{
if (IsUndefined)
@@ -140,6 +159,7 @@ public bool ContainsKey(TKey key)
return EnsureDictionary().ContainsKey(key);
}
+ /// The key.
public bool Remove(TKey key)
{
if (IsUndefined)
@@ -149,6 +169,8 @@ public bool Remove(TKey key)
return EnsureDictionary().Remove(key);
}
+ /// The key to search for.
+ /// The value.
public bool TryGetValue(TKey key, out TValue value)
{
if (IsUndefined)
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/ChangeTrackingList.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/ChangeTrackingList.cs
index d4dc6f4c9f4d..ade47d8b5806 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/ChangeTrackingList.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/ChangeTrackingList.cs
@@ -12,7 +12,7 @@
namespace Azure.ResourceManager.KeyVault
{
- internal class ChangeTrackingList : IList, IReadOnlyList
+ internal partial class ChangeTrackingList : IList, IReadOnlyList
{
private IList _innerList;
@@ -20,6 +20,7 @@ public ChangeTrackingList()
{
}
+ /// The inner list.
public ChangeTrackingList(IList innerList)
{
if (innerList != null)
@@ -28,6 +29,7 @@ public ChangeTrackingList(IList innerList)
}
}
+ /// The inner list.
public ChangeTrackingList(IReadOnlyList innerList)
{
if (innerList != null)
@@ -36,12 +38,16 @@ public ChangeTrackingList(IReadOnlyList innerList)
}
}
+ /// Gets the IsUndefined.
public bool IsUndefined => _innerList == null;
+ /// Gets the Count.
public int Count => IsUndefined ? 0 : EnsureList().Count;
+ /// Gets the IsReadOnly.
public bool IsReadOnly => IsUndefined ? false : EnsureList().IsReadOnly;
+ /// Gets or sets the value associated with the specified key.
public T this[int index]
{
get
@@ -85,6 +91,7 @@ IEnumerator IEnumerable.GetEnumerator()
return GetEnumerator();
}
+ /// The item to add.
public void Add(T item)
{
EnsureList().Add(item);
@@ -95,6 +102,7 @@ public void Clear()
EnsureList().Clear();
}
+ /// The item.
public bool Contains(T item)
{
if (IsUndefined)
@@ -104,6 +112,8 @@ public bool Contains(T item)
return EnsureList().Contains(item);
}
+ /// The array to copy to.
+ /// The array index.
public void CopyTo(T[] array, int arrayIndex)
{
if (IsUndefined)
@@ -113,6 +123,7 @@ public void CopyTo(T[] array, int arrayIndex)
EnsureList().CopyTo(array, arrayIndex);
}
+ /// The item.
public bool Remove(T item)
{
if (IsUndefined)
@@ -122,6 +133,7 @@ public bool Remove(T item)
return EnsureList().Remove(item);
}
+ /// The item.
public int IndexOf(T item)
{
if (IsUndefined)
@@ -131,11 +143,14 @@ public int IndexOf(T item)
return EnsureList().IndexOf(item);
}
+ /// The inner list.
+ /// The item.
public void Insert(int index, T item)
{
EnsureList().Insert(index, item);
}
+ /// The inner list.
public void RemoveAt(int index)
{
if (IsUndefined)
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/ClientPipelineExtensions.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/ClientPipelineExtensions.cs
new file mode 100644
index 000000000000..5b4e27d1171f
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/ClientPipelineExtensions.cs
@@ -0,0 +1,72 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+
+namespace Azure.ResourceManager.KeyVault
+{
+ internal static partial class ClientPipelineExtensions
+ {
+ public static async ValueTask ProcessMessageAsync(this HttpPipeline pipeline, HttpMessage message, RequestContext context)
+ {
+ (CancellationToken userCancellationToken, ErrorOptions statusOption) = context.Parse();
+ await pipeline.SendAsync(message, userCancellationToken).ConfigureAwait(false);
+
+ if (message.Response.IsError && (context?.ErrorOptions & ErrorOptions.NoThrow) != ErrorOptions.NoThrow)
+ {
+ throw new RequestFailedException(message.Response);
+ }
+
+ return message.Response;
+ }
+
+ public static Response ProcessMessage(this HttpPipeline pipeline, HttpMessage message, RequestContext context)
+ {
+ (CancellationToken userCancellationToken, ErrorOptions statusOption) = context.Parse();
+ pipeline.Send(message, userCancellationToken);
+
+ if (message.Response.IsError && (context?.ErrorOptions & ErrorOptions.NoThrow) != ErrorOptions.NoThrow)
+ {
+ throw new RequestFailedException(message.Response);
+ }
+
+ return message.Response;
+ }
+
+ public static async ValueTask> ProcessHeadAsBoolMessageAsync(this HttpPipeline pipeline, HttpMessage message, RequestContext context)
+ {
+ Response response = await pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ switch (response.Status)
+ {
+ case >= 200 and < 300:
+ return Response.FromValue(true, response);
+ case >= 400 and < 500:
+ return Response.FromValue(false, response);
+ default:
+ return new ErrorResult(response, new RequestFailedException(response));
+ }
+ }
+
+ public static Response ProcessHeadAsBoolMessage(this HttpPipeline pipeline, HttpMessage message, RequestContext context)
+ {
+ Response response = pipeline.ProcessMessage(message, context);
+ switch (response.Status)
+ {
+ case >= 200 and < 300:
+ return Response.FromValue(true, response);
+ case >= 400 and < 500:
+ return Response.FromValue(false, response);
+ default:
+ return new ErrorResult(response, new RequestFailedException(response));
+ }
+ }
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/CodeGenMemberAttribute.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/CodeGenMemberAttribute.cs
new file mode 100644
index 000000000000..f7f42e5c37f3
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/CodeGenMemberAttribute.cs
@@ -0,0 +1,20 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+
+namespace Azure.ResourceManager.KeyVault
+{
+ [AttributeUsage((AttributeTargets.Property | AttributeTargets.Field))]
+ internal partial class CodeGenMemberAttribute : CodeGenTypeAttribute
+ {
+ /// The original name of the member.
+ public CodeGenMemberAttribute(string originalName) : base(originalName)
+ {
+ }
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/CodeGenSerializationAttribute.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/CodeGenSerializationAttribute.cs
new file mode 100644
index 000000000000..4b88711c0428
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/CodeGenSerializationAttribute.cs
@@ -0,0 +1,48 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+
+namespace Azure.ResourceManager.KeyVault
+{
+ [AttributeUsage((AttributeTargets.Class | AttributeTargets.Struct), AllowMultiple = true, Inherited = true)]
+ internal partial class CodeGenSerializationAttribute : Attribute
+ {
+ /// The property name which these hooks apply to.
+ public CodeGenSerializationAttribute(string propertyName)
+ {
+ PropertyName = propertyName;
+ }
+
+ /// The property name which these hooks apply to.
+ /// The serialization name of the property.
+ public CodeGenSerializationAttribute(string propertyName, string propertySerializationName)
+ {
+ PropertyName = propertyName;
+ PropertySerializationName = propertySerializationName;
+ }
+
+ /// Gets or sets the property name which these hooks should apply to.
+ public string PropertyName { get; }
+
+ /// Gets or sets the serialization name of the property.
+ public string PropertySerializationName { get; set; }
+
+ ///
+ /// Gets or sets the method name to use when serializing the property value (property name excluded).
+ /// The signature of the serialization hook method must be or compatible with when invoking: private void SerializeHook(Utf8JsonWriter writer);
+ ///
+ public string SerializationValueHook { get; set; }
+
+ ///
+ /// Gets or sets the method name to use when deserializing the property value from the JSON.
+ /// private static void DeserializationHook(JsonProperty property, ref TypeOfTheProperty propertyValue); // if the property is required
+ /// private static void DeserializationHook(JsonProperty property, ref Optional<TypeOfTheProperty> propertyValue); // if the property is optional
+ ///
+ public string DeserializationValueHook { get; set; }
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/CodeGenSuppressAttribute.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/CodeGenSuppressAttribute.cs
new file mode 100644
index 000000000000..d5632bb45dbf
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/CodeGenSuppressAttribute.cs
@@ -0,0 +1,29 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+
+namespace Azure.ResourceManager.KeyVault
+{
+ [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct), AllowMultiple = true)]
+ internal partial class CodeGenSuppressAttribute : Attribute
+ {
+ /// The member to suppress.
+ /// The types of the parameters of the member.
+ public CodeGenSuppressAttribute(string member, params Type[] parameters)
+ {
+ Member = member;
+ Parameters = parameters;
+ }
+
+ /// Gets the Member.
+ public string Member { get; }
+
+ /// Gets the Parameters.
+ public Type[] Parameters { get; }
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/CodeGenTypeAttribute.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/CodeGenTypeAttribute.cs
new file mode 100644
index 000000000000..789eff80771f
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/CodeGenTypeAttribute.cs
@@ -0,0 +1,24 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+
+namespace Azure.ResourceManager.KeyVault
+{
+ [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct))]
+ internal partial class CodeGenTypeAttribute : Attribute
+ {
+ /// The original name of the type.
+ public CodeGenTypeAttribute(string originalName)
+ {
+ OriginalName = originalName;
+ }
+
+ /// Gets the OriginalName.
+ public string OriginalName { get; }
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/ErrorResult.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/ErrorResult.cs
new file mode 100644
index 000000000000..811c13e847aa
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/ErrorResult.cs
@@ -0,0 +1,32 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using Azure;
+
+namespace Azure.ResourceManager.KeyVault
+{
+ internal partial class ErrorResult : Response
+ {
+ private readonly Response _response;
+ private readonly RequestFailedException _exception;
+
+ public ErrorResult(Response response, RequestFailedException exception)
+ {
+ _response = response;
+ _exception = exception;
+ }
+
+ /// Gets the Value.
+ public override T Value => throw _exception;
+
+ ///
+ public override Response GetRawResponse()
+ {
+ return _response;
+ }
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/ModelSerializationExtensions.cs
index 6020098d5b65..5cf226cf1161 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/ModelSerializationExtensions.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/ModelSerializationExtensions.cs
@@ -11,18 +11,16 @@
using System.Diagnostics;
using System.Globalization;
using System.Text.Json;
-using System.Xml;
-using Azure.Core;
namespace Azure.ResourceManager.KeyVault
{
- internal static class ModelSerializationExtensions
+ internal static partial class ModelSerializationExtensions
{
- internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions { MaxDepth = 256 };
internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W");
- internal static readonly ModelReaderWriterOptions WireV3Options = new ModelReaderWriterOptions("W|v3");
- internal static readonly ModelReaderWriterOptions JsonV3Options = new ModelReaderWriterOptions("J|v3");
- internal static readonly BinaryData SentinelValue = BinaryData.FromBytes("\"__EMPTY__\""u8.ToArray());
+ internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions
+ {
+ MaxDepth = 256
+ };
public static object GetObject(this JsonElement element)
{
@@ -48,14 +46,14 @@ public static object GetObject(this JsonElement element)
case JsonValueKind.Null:
return null;
case JsonValueKind.Object:
- var dictionary = new Dictionary();
+ Dictionary dictionary = new Dictionary();
foreach (var jsonProperty in element.EnumerateObject())
{
dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject());
}
return dictionary;
case JsonValueKind.Array:
- var list = new List