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(); + List list = new List(); foreach (var item in element.EnumerateArray()) { list.Add(item.GetObject()); @@ -93,7 +91,7 @@ public static char GetChar(this JsonElement element) { if (element.ValueKind == JsonValueKind.String) { - var text = element.GetString(); + string text = element.GetString(); if (text == null || text.Length != 1) { throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); @@ -107,14 +105,14 @@ public static char GetChar(this JsonElement element) } [Conditional("DEBUG")] - public static void ThrowNonNullablePropertyIsNull(this JsonProperty property) + public static void ThrowNonNullablePropertyIsNull(this JsonProperty @property) { - throw new JsonException($"A property '{property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); + throw new JsonException($"A property '{@property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); } public static string GetRequiredString(this JsonElement element) { - var value = element.GetString(); + string value = element.GetString(); if (value == null) { throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); @@ -181,9 +179,6 @@ public static void WriteObjectValue(this Utf8JsonWriter writer, T value, Mode case IJsonModel jsonModel: jsonModel.Write(writer, options ?? WireOptions); break; - case IUtf8JsonSerializable serializable: - serializable.Write(writer); - break; case byte[] bytes: writer.WriteBase64StringValue(bytes); break; @@ -259,151 +254,5 @@ public static void WriteObjectValue(this Utf8JsonWriter writer, object value, Mo { writer.WriteObjectValue(value, options); } - - internal static bool IsSentinelValue(BinaryData value) - { - ReadOnlySpan sentinelSpan = SentinelValue.ToMemory().Span; - ReadOnlySpan valueSpan = value.ToMemory().Span; - return sentinelSpan.SequenceEqual(valueSpan); - } - - internal static class TypeFormatters - { - private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; - public const string DefaultNumberFormat = "G"; - - public static string ToString(bool value) => value ? "true" : "false"; - - public static string ToString(DateTime value, string format) => value.Kind switch - { - DateTimeKind.Utc => ToString((DateTimeOffset)value, format), - _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Azure SDK requires it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") - }; - - public static string ToString(DateTimeOffset value, string format) => format switch - { - "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), - "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), - "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), - "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), - "R" => value.ToString("r", CultureInfo.InvariantCulture), - _ => value.ToString(format, CultureInfo.InvariantCulture) - }; - - public static string ToString(TimeSpan value, string format) => format switch - { - "P" => XmlConvert.ToString(value), - _ => value.ToString(format, CultureInfo.InvariantCulture) - }; - - public static string ToString(byte[] value, string format) => format switch - { - "U" => ToBase64UrlString(value), - "D" => Convert.ToBase64String(value), - _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) - }; - - public static string ToBase64UrlString(byte[] value) - { - int numWholeOrPartialInputBlocks = checked(value.Length + 2) / 3; - int size = checked(numWholeOrPartialInputBlocks * 4); - char[] output = new char[size]; - - int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); - - int i = 0; - for (; i < numBase64Chars; i++) - { - char ch = output[i]; - if (ch == '+') - { - output[i] = '-'; - } - else - { - if (ch == '/') - { - output[i] = '_'; - } - else - { - if (ch == '=') - { - break; - } - } - } - } - - return new string(output, 0, i); - } - - public static byte[] FromBase64UrlString(string value) - { - int paddingCharsToAdd = (value.Length % 4) switch - { - 0 => 0, - 2 => 2, - 3 => 1, - _ => throw new InvalidOperationException("Malformed input") - }; - char[] output = new char[(value.Length + paddingCharsToAdd)]; - int i = 0; - for (; i < value.Length; i++) - { - char ch = value[i]; - if (ch == '-') - { - output[i] = '+'; - } - else - { - if (ch == '_') - { - output[i] = '/'; - } - else - { - output[i] = ch; - } - } - } - - for (; i < output.Length; i++) - { - output[i] = '='; - } - - return Convert.FromBase64CharArray(output, 0, output.Length); - } - - public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch - { - "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), - _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) - }; - - public static TimeSpan ParseTimeSpan(string value, string format) => format switch - { - "P" => XmlConvert.ToTimeSpan(value), - _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) - }; - - public static string ConvertToString(object value, string format = null) => value switch - { - null => "null", - string s => s, - bool b => ToString(b), - int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), - byte[] b0 when format != null => ToString(b0, format), - IEnumerable s0 => string.Join(",", s0), - DateTimeOffset dateTime when format != null => ToString(dateTime, format), - TimeSpan timeSpan when format != null => ToString(timeSpan, format), - TimeSpan timeSpan0 => XmlConvert.ToString(timeSpan0), - Guid guid => guid.ToString(), - BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), - _ => value.ToString() - }; - } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/Optional.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/Optional.cs index 2f5650bc4a4f..03081d6d803a 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/Optional.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/Optional.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.KeyVault { - internal static class Optional + internal static partial class Optional { public static bool IsCollectionDefined(IEnumerable collection) { @@ -28,7 +28,7 @@ public static bool IsCollectionDefined(IReadOnlyDictionary(T? value) - where T : struct + where T : struct { return value.HasValue; } @@ -38,14 +38,14 @@ public static bool IsDefined(object value) return value != null; } - public static bool IsDefined(JsonElement value) + public static bool IsDefined(string value) { - return value.ValueKind != JsonValueKind.Undefined; + return value != null; } - public static bool IsDefined(string value) + public static bool IsDefined(JsonElement value) { - return value != null; + return value.ValueKind != JsonValueKind.Undefined; } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/PageableWrapper.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/PageableWrapper.cs new file mode 100644 index 000000000000..aa790559d198 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/PageableWrapper.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; + +namespace Azure.ResourceManager.KeyVault +{ + internal partial class PageableWrapper : Pageable + { + /// The source pageable value of type Pageable<T>. + private Pageable _source; + /// The converter function from T to U. + private Func _converter; + + /// Initializes a new instance of the PageableWrapper class. + /// The source pageable value of type Pageable<T>. + /// The converter function from T to U. + public PageableWrapper(Pageable source, Func converter) + { + _source = source; + _converter = converter; + } + + /// Converts the pages from Pageable 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 IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + foreach (Page page in _source.AsPages(continuationToken, pageSizeHint)) + { + 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/RawRequestUriBuilderExtensions.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/RawRequestUriBuilderExtensions.cs new file mode 100644 index 000000000000..805068432fbb --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/RawRequestUriBuilderExtensions.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Linq; +using Azure.Core; + +namespace Azure.ResourceManager.KeyVault +{ + internal static partial class RawRequestUriBuilderExtensions + { + public static void AppendQueryDelimited(this RawRequestUriBuilder builder, string name, IEnumerable value, string delimiter, SerializationFormat format = SerializationFormat.Default, bool escape = true) + { + delimiter ??= ","; + IEnumerable stringValues = value.Select(v => TypeFormatters.ConvertToString(v, format)); + builder.AppendQuery(name, string.Join(delimiter, stringValues), escape); + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/RequestContextExtensions.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/RequestContextExtensions.cs new file mode 100644 index 000000000000..73aa83a46724 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/RequestContextExtensions.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using Azure; + +namespace Azure.ResourceManager.KeyVault +{ + internal static partial class RequestContextExtensions + { + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + public static ValueTuple Parse(this RequestContext context) + { + if (context == null) + { + return (CancellationToken.None, ErrorOptions.Default); + } + return (context.CancellationToken, context.ErrorOptions); + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/SerializationFormat.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/SerializationFormat.cs new file mode 100644 index 000000000000..a10bb8dbe00d --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/SerializationFormat.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.KeyVault +{ + internal enum SerializationFormat + { + /// The default serialization format. + Default = 0, + /// The RFC1123 date time format. + DateTime_RFC1123 = 1, + /// The RFC3339 date time format. + DateTime_RFC3339 = 2, + /// The RFC7231 date time format. + DateTime_RFC7231 = 3, + /// The ISO8601 date time format. + DateTime_ISO8601 = 4, + /// The Unix date time format. + DateTime_Unix = 5, + /// The ISO8601 date format. + Date_ISO8601 = 6, + /// The ISO8601 duration format. + Duration_ISO8601 = 7, + /// The constant duration format. + Duration_Constant = 8, + /// The seconds duration format. + Duration_Seconds = 9, + /// The seconds duration format with float precision. + Duration_Seconds_Float = 10, + /// The seconds duration format with double precision. + Duration_Seconds_Double = 11, + /// The milliseconds duration format. + Duration_Milliseconds = 12, + /// The milliseconds duration format with float precision. + Duration_Milliseconds_Float = 13, + /// The milliseconds duration format with double precision. + Duration_Milliseconds_Double = 14, + /// The ISO8601 time format. + Time_ISO8601 = 15, + /// The Base64Url bytes format. + Bytes_Base64Url = 16, + /// The Base64 bytes format. + Bytes_Base64 = 17 + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/TypeFormatters.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/TypeFormatters.cs new file mode 100644 index 000000000000..4731fa64be92 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/TypeFormatters.cs @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Xml; + +namespace Azure.ResourceManager.KeyVault +{ + internal static partial class TypeFormatters + { + private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; + public const string DefaultNumberFormat = "G"; + + public static string ToString(bool value) => value ? "true" : "false"; + + public static string ToString(DateTime value, string format) => value.Kind switch + { + DateTimeKind.Utc => ToString((DateTimeOffset)value, format), + _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Generated clients require it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") + }; + + public static string ToString(DateTimeOffset value, string format) => format switch + { + "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), + "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), + "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "R" => value.ToString("r", CultureInfo.InvariantCulture), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(TimeSpan value, string format) => format switch + { + "P" => XmlConvert.ToString(value), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(byte[] value, string format) => format switch + { + "U" => ToBase64UrlString(value), + "D" => Convert.ToBase64String(value), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + + public static string ToBase64UrlString(byte[] value) + { + int numWholeOrPartialInputBlocks = checked (value.Length + 2) / 3; + int size = checked (numWholeOrPartialInputBlocks * 4); + char[] output = new char[size]; + + int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); + + int i = 0; + for (; i < numBase64Chars; i++) + { + char ch = output[i]; + if (ch == '+') + { + output[i] = '-'; + } + else + { + if (ch == '/') + { + output[i] = '_'; + } + else + { + if (ch == '=') + { + break; + } + } + } + } + + return new string(output, 0, i); + } + + public static byte[] FromBase64UrlString(string value) + { + int paddingCharsToAdd = (value.Length % 4) switch + { + 0 => 0, + 2 => 2, + 3 => 1, + _ => throw new InvalidOperationException("Malformed input") + }; + char[] output = new char[(value.Length + paddingCharsToAdd)]; + int i = 0; + for (; i < value.Length; i++) + { + char ch = value[i]; + if (ch == '-') + { + output[i] = '+'; + } + else + { + if (ch == '_') + { + output[i] = '/'; + } + else + { + output[i] = ch; + } + } + } + + for (; i < output.Length; i++) + { + output[i] = '='; + } + + return Convert.FromBase64CharArray(output, 0, output.Length); + } + + public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch + { + "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), + _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) + }; + + public static TimeSpan ParseTimeSpan(string value, string format) => format switch + { + "P" => XmlConvert.ToTimeSpan(value), + _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) + }; + + public static string ToFormatSpecifier(SerializationFormat format) => format switch + { + SerializationFormat.DateTime_RFC1123 => "R", + SerializationFormat.DateTime_RFC3339 => "O", + SerializationFormat.DateTime_RFC7231 => "R", + SerializationFormat.DateTime_ISO8601 => "O", + SerializationFormat.Date_ISO8601 => "D", + SerializationFormat.DateTime_Unix => "U", + SerializationFormat.Bytes_Base64Url => "U", + SerializationFormat.Bytes_Base64 => "D", + SerializationFormat.Duration_ISO8601 => "P", + SerializationFormat.Duration_Constant => "c", + SerializationFormat.Duration_Seconds => "%s", + SerializationFormat.Duration_Seconds_Float => "s\\.FFF", + SerializationFormat.Duration_Seconds_Double => "s\\.FFFFFF", + SerializationFormat.Time_ISO8601 => "T", + _ => null + }; + + public static string ConvertToString(object value, SerializationFormat format = SerializationFormat.Default) + { + string formatSpecifier = ToFormatSpecifier(format); + + return value switch + { + null => "null", + string s => s, + bool b => ToString(b), + int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), + byte[] b0 when formatSpecifier != null => ToString(b0, formatSpecifier), + IEnumerable s0 => string.Join(",", s0), + DateTimeOffset dateTime when formatSpecifier != null => ToString(dateTime, formatSpecifier), + TimeSpan timeSpan when format == SerializationFormat.Duration_Seconds => Convert.ToInt32(timeSpan.TotalSeconds).ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan0 when format == SerializationFormat.Duration_Seconds_Float || format == SerializationFormat.Duration_Seconds_Double => timeSpan0.TotalSeconds.ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan1 when format == SerializationFormat.Duration_Milliseconds => Convert.ToInt32(timeSpan1.TotalMilliseconds).ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan2 when format == SerializationFormat.Duration_Milliseconds_Float || format == SerializationFormat.Duration_Milliseconds_Double => timeSpan2.TotalMilliseconds.ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan3 when formatSpecifier != null => ToString(timeSpan3, formatSpecifier), + TimeSpan timeSpan4 => XmlConvert.ToString(timeSpan4), + Guid guid => guid.ToString(), + BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), + _ => value.ToString() + }; + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/Utf8JsonRequestContent.cs index 7c076d3bc623..48756b6e4f58 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/Utf8JsonRequestContent.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/Utf8JsonRequestContent.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.KeyVault { - internal class Utf8JsonRequestContent : RequestContent + internal partial class Utf8JsonRequestContent : RequestContent { private readonly MemoryStream _stream; private readonly RequestContent _content; @@ -25,20 +25,26 @@ public Utf8JsonRequestContent() JsonWriter = new Utf8JsonWriter(_stream); } + /// Gets the JsonWriter. public Utf8JsonWriter JsonWriter { get; } + /// The stream containing the data to be written. + /// The cancellation token to use. public override async Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default) { await JsonWriter.FlushAsync().ConfigureAwait(false); await _content.WriteToAsync(stream, cancellationToken).ConfigureAwait(false); } + /// The stream containing the data to be written. + /// The cancellation token to use. public override void WriteTo(Stream stream, CancellationToken cancellationToken = default) { JsonWriter.Flush(); _content.WriteTo(stream, cancellationToken); } + /// public override bool TryComputeLength(out long length) { length = JsonWriter.BytesCommitted + JsonWriter.BytesPending; diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/WirePathAttribute.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/WirePathAttribute.cs index da27b853ed34..99dee7f7db95 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/WirePathAttribute.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Internal/WirePathAttribute.cs @@ -10,18 +10,14 @@ namespace Azure.ResourceManager.KeyVault { [AttributeUsage(AttributeTargets.Property)] - internal class WirePathAttribute : Attribute + internal partial class WirePathAttribute : Attribute { private string _wirePath; + /// The wire path. public WirePathAttribute(string wirePath) { _wirePath = wirePath; } - - public override string ToString() - { - return _wirePath; - } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultCollection.cs index 119dd8ce5d01..ba489ea6b553 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultCollection.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultCollection.cs @@ -8,12 +8,13 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Globalization; +using System.Diagnostics; 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.Models; using Azure.ResourceManager.Resources; @@ -21,78 +22,89 @@ 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 GetKeyVaults 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 GetKeyVaults method from an instance of the parent resource. /// public partial class KeyVaultCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _keyVaultVaultsClientDiagnostics; - private readonly VaultsRestOperations _keyVaultVaultsRestClient; + private readonly ClientDiagnostics _vaultsClientDiagnostics; + private readonly Vaults _vaultsRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of KeyVaultCollection for mocking. protected KeyVaultCollection() { } - /// 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 KeyVaultCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _keyVaultVaultsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", KeyVaultResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(KeyVaultResource.ResourceType, out string keyVaultVaultsApiVersion); - _keyVaultVaultsRestClient = new VaultsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, keyVaultVaultsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(KeyVaultResource.ResourceType, out string keyVaultApiVersion); + _vaultsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", KeyVaultResource.ResourceType.Namespace, Diagnostics); + _vaultsRestClient = new Vaults(_vaultsClientDiagnostics, Pipeline, Endpoint, keyVaultApiVersion ?? "2025-05-01"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != ResourceGroupResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), id); + } } /// /// Create or update a key vault in the specified subscription. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} - /// - /// - /// Operation Id - /// Vaults_CreateOrUpdate + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. /// /// - /// Default Api Version - /// 2025-05-01 + /// Operation Id. + /// Vaults_CreateOrUpdate. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-05-01. /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The name of the vault. - /// Parameters to create or update the vault. + /// Parameters to create or update the vault. /// The cancellation token to use. + /// or is null. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string vaultName, KeyVaultCreateOrUpdateContent content, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string vaultName, VaultCreateOrUpdateParameters vaultCreateOrUpdateParameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(vaultCreateOrUpdateParameters, nameof(vaultCreateOrUpdateParameters)); - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultCollection.CreateOrUpdate"); + using DiagnosticScope scope = _vaultsClientDiagnostics.CreateScope("KeyVaultCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _keyVaultVaultsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, vaultName, content, cancellationToken).ConfigureAwait(false); - var operation = new KeyVaultArmOperation(new KeyVaultOperationSource(Client), _keyVaultVaultsClientDiagnostics, Pipeline, _keyVaultVaultsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, content).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _vaultsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, vaultName, VaultCreateOrUpdateParameters.ToRequestContent(vaultCreateOrUpdateParameters), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + KeyVaultArmOperation operation = new KeyVaultArmOperation( + new KeyVaultOperationSource(Client), + _vaultsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -106,42 +118,51 @@ public virtual async Task> CreateOrUpdateAsync(Wa /// Create or update a key vault in the specified subscription. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. /// /// - /// Operation Id - /// Vaults_CreateOrUpdate + /// Operation Id. + /// Vaults_CreateOrUpdate. /// /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-05-01. /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The name of the vault. - /// Parameters to create or update the vault. + /// Parameters to create or update the vault. /// The cancellation token to use. + /// or is null. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string vaultName, KeyVaultCreateOrUpdateContent content, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string vaultName, VaultCreateOrUpdateParameters vaultCreateOrUpdateParameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(vaultCreateOrUpdateParameters, nameof(vaultCreateOrUpdateParameters)); - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultCollection.CreateOrUpdate"); + using DiagnosticScope scope = _vaultsClientDiagnostics.CreateScope("KeyVaultCollection.CreateOrUpdate"); scope.Start(); try { - var response = _keyVaultVaultsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, vaultName, content, cancellationToken); - var operation = new KeyVaultArmOperation(new KeyVaultOperationSource(Client), _keyVaultVaultsClientDiagnostics, Pipeline, _keyVaultVaultsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, content).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _vaultsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, vaultName, VaultCreateOrUpdateParameters.ToRequestContent(vaultCreateOrUpdateParameters), context); + Response response = Pipeline.ProcessMessage(message, context); + KeyVaultArmOperation operation = new KeyVaultArmOperation( + new KeyVaultOperationSource(Client), + _vaultsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -155,38 +176,42 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil /// Gets the specified Azure key vault. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} - /// - /// - /// Operation Id - /// Vaults_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 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> GetAsync(string vaultName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultCollection.Get"); + using DiagnosticScope scope = _vaultsClientDiagnostics.CreateScope("KeyVaultCollection.Get"); scope.Start(); try { - var response = await _keyVaultVaultsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, vaultName, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _vaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, vaultName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(KeyVaultData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new KeyVaultResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -200,38 +225,42 @@ public virtual async Task> GetAsync(string vaultName, /// Gets the specified Azure key vault. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} - /// - /// - /// Operation Id - /// Vaults_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 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 Get(string vaultName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultCollection.Get"); + using DiagnosticScope scope = _vaultsClientDiagnostics.CreateScope("KeyVaultCollection.Get"); scope.Start(); try { - var response = _keyVaultVaultsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, vaultName, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _vaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, vaultName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(KeyVaultData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new KeyVaultResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -241,102 +270,80 @@ public virtual Response Get(string vaultName, CancellationToke } } - /// - /// The List operation gets information about the vaults associated with the subscription and within the specified resource group. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults - /// - /// - /// Operation Id - /// Vaults_ListByResourceGroup - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// The List operation gets information about the vaults associated with the subscription and within the specified resource group. /// 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 GetAllAsync(int? top = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(int? top = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _keyVaultVaultsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _keyVaultVaultsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, top); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new KeyVaultResource(Client, KeyVaultData.DeserializeKeyVaultData(e)), _keyVaultVaultsClientDiagnostics, Pipeline, "KeyVaultCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new VaultsGetByResourceGroupAsyncCollectionResultOfT(_vaultsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, top, context), data => new KeyVaultResource(Client, data)); } - /// - /// The List operation gets information about the vaults associated with the subscription and within the specified resource group. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults - /// - /// - /// Operation Id - /// Vaults_ListByResourceGroup - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// The List operation gets information about the vaults associated with the subscription and within the specified resource group. /// 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 GetAll(int? top = null, CancellationToken cancellationToken = default) + public virtual Pageable GetAll(int? top = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _keyVaultVaultsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _keyVaultVaultsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, top); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new KeyVaultResource(Client, KeyVaultData.DeserializeKeyVaultData(e)), _keyVaultVaultsClientDiagnostics, Pipeline, "KeyVaultCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new VaultsGetByResourceGroupCollectionResultOfT(_vaultsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, top, context), data => new KeyVaultResource(Client, data)); } /// - /// Checks to see if the resource exists in azure. + /// Gets the specified Azure key vault. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} - /// - /// - /// Operation Id - /// Vaults_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 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(string vaultName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultCollection.Exists"); + using DiagnosticScope scope = _vaultsClientDiagnostics.CreateScope("KeyVaultCollection.Exists"); scope.Start(); try { - var response = await _keyVaultVaultsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, vaultName, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _vaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, 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(KeyVaultData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((KeyVaultData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -347,39 +354,53 @@ public virtual async Task> ExistsAsync(string vaultName, Cancella } /// - /// Checks to see if the resource exists in azure. + /// Gets the specified Azure key vault. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. /// /// - /// Operation Id - /// Vaults_Get + /// Operation Id. + /// Vaults_Get. /// /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-05-01. /// /// /// /// 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(string vaultName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultCollection.Exists"); + using DiagnosticScope scope = _vaultsClientDiagnostics.CreateScope("KeyVaultCollection.Exists"); scope.Start(); try { - var response = _keyVaultVaultsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, vaultName, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _vaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, vaultName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(KeyVaultData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((KeyVaultData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -390,41 +411,57 @@ public virtual Response Exists(string vaultName, CancellationToken cancell } /// - /// Tries to get details for this resource from the service. + /// Gets the specified Azure key vault. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} - /// - /// - /// Operation Id - /// Vaults_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 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(string vaultName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultCollection.GetIfExists"); + using DiagnosticScope scope = _vaultsClientDiagnostics.CreateScope("KeyVaultCollection.GetIfExists"); scope.Start(); try { - var response = await _keyVaultVaultsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, vaultName, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _vaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, 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(KeyVaultData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((KeyVaultData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new KeyVaultResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -435,41 +472,57 @@ public virtual async Task> GetIfExistsAsync(s } /// - /// Tries to get details for this resource from the service. + /// Gets the specified Azure key vault. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} - /// - /// - /// Operation Id - /// Vaults_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 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(string vaultName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultCollection.GetIfExists"); + using DiagnosticScope scope = _vaultsClientDiagnostics.CreateScope("KeyVaultCollection.GetIfExists"); scope.Start(); try { - var response = _keyVaultVaultsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, vaultName, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _vaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, vaultName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(KeyVaultData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((KeyVaultData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new KeyVaultResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -489,6 +542,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } + /// The cancellation token to use. IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultData.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultData.Serialization.cs index 1c5f419ccc5d..b6f96ad094ef 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultData.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultData.Serialization.cs @@ -8,19 +8,25 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; 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 KeyVaultData : IUtf8JsonSerializable, IJsonModel + /// Resource information with extended details. + public partial class KeyVaultData : ResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal KeyVaultData() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -32,269 +38,185 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOpti /// 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(KeyVaultData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); writer.WriteObjectValue(Properties, options); + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location.Value); + } } - KeyVaultData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + KeyVaultData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (KeyVaultData)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(KeyVaultData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeKeyVaultData(document.RootElement, options); } - internal static KeyVaultData DeserializeKeyVaultData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static KeyVaultData DeserializeKeyVaultData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - Models.KeyVaultProperties properties = default; - IDictionary tags = default; - AzureLocation location = 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(); + Models.KeyVaultProperties properties = default; + IDictionary tags = default; + AzureLocation? location = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("id"u8)) { - properties = Models.KeyVaultProperties.DeserializeKeyVaultProperties(property.Value, options); - continue; - } - if (property.NameEquals("tags"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("name"u8)) { - location = new AzureLocation(property.Value.GetString()); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("type"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("systemData"u8)) { - name = 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("type"u8)) + if (prop.NameEquals("properties"u8)) { - type = new ResourceType(property.Value.GetString()); + properties = Models.KeyVaultProperties.DeserializeKeyVaultProperties(prop.Value, options); continue; } - if (property.NameEquals("systemData"u8)) + if (prop.NameEquals("tags"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); + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + if (prop.NameEquals("location"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(prop.Value.GetString()); 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 KeyVaultData( id, name, - type, + resourceType, systemData, - tags ?? new ChangeTrackingDictionary(), - location, + additionalBinaryDataProperties, properties, - serializedAdditionalRawData); + tags ?? new ChangeTrackingDictionary(), + location); } - 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(Location), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" location: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" location: "); - builder.AppendLine($"'{Location.ToString()}'"); - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Tags), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" tags: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Tags)) - { - if (Tags.Any()) - { - builder.Append(" tags: "); - builder.AppendLine("{"); - foreach (var item in Tags) - { - builder.Append($" '{item.Key}': "); - if (item.Value == null) - { - builder.Append("null"); - continue; - } - if (item.Value.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{item.Value}'''"); - } - else - { - builder.AppendLine($"'{item.Value}'"); - } - } - builder.AppendLine(" }"); - } - } - } - - 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(KeyVaultData)} does not support writing '{options.Format}' format."); } } - KeyVaultData 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. + KeyVaultData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (KeyVaultData)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 DeserializeKeyVaultData(document.RootElement, options); } default: @@ -302,6 +224,15 @@ KeyVaultData IPersistableModel.Create(BinaryData data, ModelReader } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static KeyVaultData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeKeyVaultData(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultData.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultData.cs index cdb24d19be23..00dddf0fbb30 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultData.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultData.cs @@ -13,77 +13,47 @@ namespace Azure.ResourceManager.KeyVault { - /// - /// A class representing the KeyVault data model. - /// Resource information with extended details. - /// - public partial class KeyVaultData : TrackedResourceData + /// Resource information with extended details. + public partial class KeyVaultData : 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 . - /// The location. /// Properties of the vault. - /// is null. - public KeyVaultData(AzureLocation location, Models.KeyVaultProperties properties) : base(location) + internal KeyVaultData(Models.KeyVaultProperties properties) { - Argument.AssertNotNull(properties, nameof(properties)); - Properties = properties; + Tags = new ChangeTrackingDictionary(); } /// 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. + /// Keeps track of any properties unknown to the library. /// Properties of the vault. - /// Keeps track of any properties unknown to the library. - internal KeyVaultData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, Models.KeyVaultProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + /// Resource tags. + /// The geo-location where the resource lives. + internal KeyVaultData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, Models.KeyVaultProperties properties, IDictionary tags, AzureLocation? location) : base(id, name, resourceType, systemData) { + _additionalBinaryDataProperties = additionalBinaryDataProperties; Properties = properties; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal KeyVaultData() - { + Tags = tags; + Location = location; } /// Properties of the vault. [WirePath("properties")] - public Models.KeyVaultProperties Properties { get; set; } + public Models.KeyVaultProperties Properties { get; } + + /// Resource tags. + [WirePath("tags")] + public IDictionary Tags { get; } + + /// The geo-location where the resource lives. + [WirePath("location")] + public AzureLocation? Location { get; } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionCollection.cs index 4842a47425cc..c73166f1da97 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionCollection.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionCollection.cs @@ -8,67 +8,66 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Globalization; +using System.Diagnostics; using System.Threading; using System.Threading.Tasks; -using Autorest.CSharp.Core; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; 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 GetKeyVaultPrivateEndpointConnections 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 GetKeyVaultPrivateEndpointConnections method from an instance of the parent resource. /// public partial class KeyVaultPrivateEndpointConnectionCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics; - private readonly PrivateEndpointConnectionsRestOperations _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient; + private readonly ClientDiagnostics _privateEndpointConnectionsClientDiagnostics; + private readonly PrivateEndpointConnections _privateEndpointConnectionsRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of KeyVaultPrivateEndpointConnectionCollection for mocking. protected KeyVaultPrivateEndpointConnectionCollection() { } - /// 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 KeyVaultPrivateEndpointConnectionCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", KeyVaultPrivateEndpointConnectionResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(KeyVaultPrivateEndpointConnectionResource.ResourceType, out string keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsApiVersion); - _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient = new PrivateEndpointConnectionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(KeyVaultPrivateEndpointConnectionResource.ResourceType, out string keyVaultPrivateEndpointConnectionApiVersion); + _privateEndpointConnectionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", KeyVaultPrivateEndpointConnectionResource.ResourceType.Namespace, Diagnostics); + _privateEndpointConnectionsRestClient = new PrivateEndpointConnections(_privateEndpointConnectionsClientDiagnostics, Pipeline, Endpoint, keyVaultPrivateEndpointConnectionApiVersion ?? "2025-05-01"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != KeyVaultResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, KeyVaultResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, KeyVaultResource.ResourceType), id); + } } /// /// Updates the specified private endpoint connection associated with the key vault. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Operation Id - /// PrivateEndpointConnections_Put + /// Operation Id. + /// PrivateEndpointConnections_Put. /// /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-05-01. /// /// /// @@ -76,23 +75,31 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// Name of the private endpoint connection associated with the key vault. /// The intended state of private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// or is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string privateEndpointConnectionName, KeyVaultPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionCollection.CreateOrUpdate"); + using DiagnosticScope scope = _privateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.PutAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data, cancellationToken).ConfigureAwait(false); - var uri = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreatePutRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new KeyVaultArmOperation(Response.FromValue(new KeyVaultPrivateEndpointConnectionResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _privateEndpointConnectionsRestClient.CreatePutRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, KeyVaultPrivateEndpointConnectionData.ToRequestContent(data), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(KeyVaultPrivateEndpointConnectionData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + KeyVaultArmOperation operation = new KeyVaultArmOperation(Response.FromValue(new KeyVaultPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -106,20 +113,16 @@ public virtual async Task /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// PrivateEndpointConnections_Put + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Default Api Version - /// 2025-05-01 + /// Operation Id. + /// PrivateEndpointConnections_Put. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-05-01. /// /// /// @@ -127,23 +130,31 @@ public virtual async Task Name of the private endpoint connection associated with the key vault. /// The intended state of private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// or is null. + /// is an empty string, and was expected to be non-empty. public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string privateEndpointConnectionName, KeyVaultPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionCollection.CreateOrUpdate"); + using DiagnosticScope scope = _privateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionCollection.CreateOrUpdate"); scope.Start(); try { - var response = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Put(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data, cancellationToken); - var uri = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreatePutRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new KeyVaultArmOperation(Response.FromValue(new KeyVaultPrivateEndpointConnectionResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _privateEndpointConnectionsRestClient.CreatePutRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, KeyVaultPrivateEndpointConnectionData.ToRequestContent(data), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(KeyVaultPrivateEndpointConnectionData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + KeyVaultArmOperation operation = new KeyVaultArmOperation(Response.FromValue(new KeyVaultPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -157,38 +168,42 @@ public virtual ArmOperation CreateOrU /// Gets the specified private endpoint connection associated with the key vault. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// PrivateEndpointConnections_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Default Api Version - /// 2025-05-01 + /// Operation Id. + /// PrivateEndpointConnections_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-05-01. /// /// /// /// Name of the private endpoint connection associated with the key 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> GetAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - using var scope = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionCollection.Get"); + using DiagnosticScope scope = _privateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionCollection.Get"); scope.Start(); try { - var response = await _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _privateEndpointConnectionsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(KeyVaultPrivateEndpointConnectionData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new KeyVaultPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -202,38 +217,42 @@ public virtual async Task> G /// Gets the specified private endpoint connection associated with the key vault. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// PrivateEndpointConnections_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Default Api Version - /// 2025-05-01 + /// Operation Id. + /// PrivateEndpointConnections_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-05-01. /// /// /// /// Name of the private endpoint connection associated with the key 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 Get(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - using var scope = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionCollection.Get"); + using DiagnosticScope scope = _privateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionCollection.Get"); scope.Start(); try { - var response = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _privateEndpointConnectionsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(KeyVaultPrivateEndpointConnectionData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new KeyVaultPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -243,100 +262,78 @@ public virtual Response Get(string pr } } - /// - /// The List operation gets information about the private endpoint connections associated with the vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections - /// - /// - /// Operation Id - /// PrivateEndpointConnections_ListByResource - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// The List operation gets information about the private endpoint connections associated with the vault. /// 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 GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListByResourceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListByResourceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new KeyVaultPrivateEndpointConnectionResource(Client, KeyVaultPrivateEndpointConnectionData.DeserializeKeyVaultPrivateEndpointConnectionData(e)), _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "KeyVaultPrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new PrivateEndpointConnectionsGetByResourceAsyncCollectionResultOfT(_privateEndpointConnectionsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context), data => new KeyVaultPrivateEndpointConnectionResource(Client, data)); } - /// - /// The List operation gets information about the private endpoint connections associated with the vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections - /// - /// - /// Operation Id - /// PrivateEndpointConnections_ListByResource - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// The List operation gets information about the private endpoint connections associated with the vault. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListByResourceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListByResourceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new KeyVaultPrivateEndpointConnectionResource(Client, KeyVaultPrivateEndpointConnectionData.DeserializeKeyVaultPrivateEndpointConnectionData(e)), _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "KeyVaultPrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new PrivateEndpointConnectionsGetByResourceCollectionResultOfT(_privateEndpointConnectionsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context), data => new KeyVaultPrivateEndpointConnectionResource(Client, data)); } /// - /// Checks to see if the resource exists in azure. + /// Gets the specified private endpoint connection associated with the key vault. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Operation Id - /// PrivateEndpointConnections_Get + /// Operation Id. + /// PrivateEndpointConnections_Get. /// /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-05-01. /// /// /// /// Name of the private endpoint connection associated with the key 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(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - using var scope = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionCollection.Exists"); + using DiagnosticScope scope = _privateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionCollection.Exists"); scope.Start(); try { - var response = await _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _privateEndpointConnectionsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(KeyVaultPrivateEndpointConnectionData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((KeyVaultPrivateEndpointConnectionData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -347,39 +344,53 @@ public virtual async Task> ExistsAsync(string privateEndpointConn } /// - /// Checks to see if the resource exists in azure. + /// Gets the specified private endpoint connection associated with the key vault. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// PrivateEndpointConnections_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Default Api Version - /// 2025-05-01 + /// Operation Id. + /// PrivateEndpointConnections_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-05-01. /// /// /// /// Name of the private endpoint connection associated with the key 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(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - using var scope = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionCollection.Exists"); + using DiagnosticScope scope = _privateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionCollection.Exists"); scope.Start(); try { - var response = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _privateEndpointConnectionsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(KeyVaultPrivateEndpointConnectionData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((KeyVaultPrivateEndpointConnectionData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -390,41 +401,57 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } /// - /// Tries to get details for this resource from the service. + /// Gets the specified private endpoint connection associated with the key vault. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// PrivateEndpointConnections_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Default Api Version - /// 2025-05-01 + /// Operation Id. + /// PrivateEndpointConnections_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-05-01. /// /// /// /// Name of the private endpoint connection associated with the key 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(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - using var scope = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionCollection.GetIfExists"); + using DiagnosticScope scope = _privateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionCollection.GetIfExists"); scope.Start(); try { - var response = await _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _privateEndpointConnectionsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(KeyVaultPrivateEndpointConnectionData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((KeyVaultPrivateEndpointConnectionData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new KeyVaultPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -435,41 +462,57 @@ public virtual async Task - /// Tries to get details for this resource from the service. + /// Gets the specified private endpoint connection associated with the key vault. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// PrivateEndpointConnections_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Default Api Version - /// 2025-05-01 + /// Operation Id. + /// PrivateEndpointConnections_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-05-01. /// /// /// /// Name of the private endpoint connection associated with the key 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(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - using var scope = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionCollection.GetIfExists"); + using DiagnosticScope scope = _privateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionCollection.GetIfExists"); scope.Start(); try { - var response = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _privateEndpointConnectionsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(KeyVaultPrivateEndpointConnectionData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((KeyVaultPrivateEndpointConnectionData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new KeyVaultPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -489,6 +532,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } + /// The cancellation token to use. IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionData.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionData.Serialization.cs index 4dbac94238c0..b8dffad9441f 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionData.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionData.Serialization.cs @@ -8,20 +8,20 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.KeyVault.Models; using Azure.ResourceManager.Models; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.KeyVault { - public partial class KeyVaultPrivateEndpointConnectionData : IUtf8JsonSerializable, IJsonModel + /// Private endpoint connection resource. + public partial class KeyVaultPrivateEndpointConnectionData : 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(); @@ -33,13 +33,17 @@ void IJsonModel.Write(Utf8JsonWriter writ /// 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(KeyVaultPrivateEndpointConnectionData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } if (options.Format != "W" && Optional.IsDefined(Location)) { writer.WritePropertyName("location"u8); @@ -52,6 +56,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri foreach (var item in Tags) { writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } writer.WriteStringValue(item.Value); } writer.WriteEndObject(); @@ -61,387 +70,171 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("etag"u8); writer.WriteStringValue(ETag.Value.ToString()); } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(PrivateEndpoint)) - { - writer.WritePropertyName("privateEndpoint"u8); - ((IJsonModel)PrivateEndpoint).Write(writer, options); - } - if (Optional.IsDefined(ConnectionState)) - { - writer.WritePropertyName("privateLinkServiceConnectionState"u8); - writer.WriteObjectValue(ConnectionState, options); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); - } - writer.WriteEndObject(); } - KeyVaultPrivateEndpointConnectionData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + KeyVaultPrivateEndpointConnectionData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (KeyVaultPrivateEndpointConnectionData)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(KeyVaultPrivateEndpointConnectionData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeKeyVaultPrivateEndpointConnectionData(document.RootElement, options); } - internal static KeyVaultPrivateEndpointConnectionData DeserializeKeyVaultPrivateEndpointConnectionData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static KeyVaultPrivateEndpointConnectionData DeserializeKeyVaultPrivateEndpointConnectionData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - AzureLocation? location = default; - IReadOnlyDictionary tags = default; - ETag? etag = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - SubResource privateEndpoint = default; - KeyVaultPrivateLinkServiceConnectionState privateLinkServiceConnectionState = default; - KeyVaultPrivateEndpointConnectionProvisioningState? provisioningState = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + PrivateEndpointConnectionProperties properties = default; + AzureLocation? location = default; + IReadOnlyDictionary tags = default; + ETag? eTag = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("location"u8)) + if (prop.NameEquals("id"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - location = new AzureLocation(property.Value.GetString()); + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("name"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; + name = prop.Value.GetString(); continue; } - if (property.NameEquals("etag"u8)) + if (prop.NameEquals("type"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - etag = new ETag(property.Value.GetString()); - continue; - } - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("systemData"u8)) { - name = 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("type"u8)) + if (prop.NameEquals("properties"u8)) { - type = new ResourceType(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = PrivateEndpointConnectionProperties.DeserializePrivateEndpointConnectionProperties(prop.Value, options); continue; } - if (property.NameEquals("systemData"u8)) + if (prop.NameEquals("location"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); + location = new AzureLocation(prop.Value.GetString()); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) { - if (property0.NameEquals("privateEndpoint"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - privateEndpoint = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property0.Value.GetRawText())), options, AzureResourceManagerKeyVaultContext.Default); - continue; - } - if (property0.NameEquals("privateLinkServiceConnectionState"u8)) + if (prop0.Value.ValueKind == JsonValueKind.Null) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - privateLinkServiceConnectionState = KeyVaultPrivateLinkServiceConnectionState.DeserializeKeyVaultPrivateLinkServiceConnectionState(property0.Value, options); - continue; + dictionary.Add(prop0.Name, null); } - if (property0.NameEquals("provisioningState"u8)) + else { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new KeyVaultPrivateEndpointConnectionProvisioningState(property0.Value.GetString()); - continue; + dictionary.Add(prop0.Name, prop0.Value.GetString()); } } + tags = dictionary; + continue; + } + if (prop.NameEquals("etag"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + eTag = new ETag(prop.Value.GetString()); 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 KeyVaultPrivateEndpointConnectionData( id, name, - type, + resourceType, systemData, + additionalBinaryDataProperties, + properties, location, tags ?? new ChangeTrackingDictionary(), - etag, - privateEndpoint, - privateLinkServiceConnectionState, - provisioningState, - serializedAdditionalRawData); + eTag); } - 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(Location), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" location: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Location)) - { - builder.Append(" location: "); - builder.AppendLine($"'{Location.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Tags), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" tags: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Tags)) - { - if (Tags.Any()) - { - builder.Append(" tags: "); - builder.AppendLine("{"); - foreach (var item in Tags) - { - builder.Append($" '{item.Key}': "); - if (item.Value == null) - { - builder.Append("null"); - continue; - } - if (item.Value.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{item.Value}'''"); - } - else - { - builder.AppendLine($"'{item.Value}'"); - } - } - builder.AppendLine(" }"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ETag), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" etag: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ETag)) - { - builder.Append(" etag: "); - builder.AppendLine($"'{ETag.Value.ToString()}'"); - } - } - - 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.Append(" properties:"); - builder.AppendLine(" {"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("PrivateEndpointId", out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" privateEndpoint: "); - builder.AppendLine("{"); - builder.AppendLine(" privateEndpoint: {"); - builder.Append(" id: "); - builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - builder.AppendLine(" }"); - } - else - { - if (Optional.IsDefined(PrivateEndpoint)) - { - builder.Append(" privateEndpoint: "); - BicepSerializationHelpers.AppendChildObject(builder, PrivateEndpoint, options, 4, false, " privateEndpoint: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ConnectionState), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" privateLinkServiceConnectionState: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ConnectionState)) - { - builder.Append(" privateLinkServiceConnectionState: "); - BicepSerializationHelpers.AppendChildObject(builder, ConnectionState, options, 4, false, " privateLinkServiceConnectionState: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" provisioningState: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ProvisioningState)) - { - builder.Append(" provisioningState: "); - builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); - } - } - - builder.AppendLine(" }"); - 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(KeyVaultPrivateEndpointConnectionData)} does not support writing '{options.Format}' format."); } } - KeyVaultPrivateEndpointConnectionData 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. + KeyVaultPrivateEndpointConnectionData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (KeyVaultPrivateEndpointConnectionData)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 DeserializeKeyVaultPrivateEndpointConnectionData(document.RootElement, options); } default: @@ -449,6 +242,27 @@ KeyVaultPrivateEndpointConnectionData IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(KeyVaultPrivateEndpointConnectionData keyVaultPrivateEndpointConnectionData) + { + if (keyVaultPrivateEndpointConnectionData == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(keyVaultPrivateEndpointConnectionData, ModelSerializationExtensions.WireOptions); + return content; + } + + /// The to deserialize the from. + internal static KeyVaultPrivateEndpointConnectionData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeKeyVaultPrivateEndpointConnectionData(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionData.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionData.cs index cca5f80a0cce..769b4a44c39a 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionData.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionData.cs @@ -7,50 +7,18 @@ using System; using System.Collections.Generic; +using Azure; using Azure.Core; using Azure.ResourceManager.KeyVault.Models; using Azure.ResourceManager.Models; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.KeyVault { - /// - /// A class representing the KeyVaultPrivateEndpointConnection data model. - /// Private endpoint connection resource. - /// + /// Private endpoint connection resource. public partial class KeyVaultPrivateEndpointConnectionData : 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 . public KeyVaultPrivateEndpointConnectionData() @@ -59,51 +27,76 @@ public KeyVaultPrivateEndpointConnectionData() } /// 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. + /// Resource properties. /// 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. - /// Keeps track of any properties unknown to the library. - internal KeyVaultPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, IReadOnlyDictionary tags, ETag? etag, SubResource privateEndpoint, KeyVaultPrivateLinkServiceConnectionState connectionState, KeyVaultPrivateEndpointConnectionProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + /// Modified whenever there is a change in the state of private endpoint connection. + internal KeyVaultPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, PrivateEndpointConnectionProperties properties, AzureLocation? location, IReadOnlyDictionary tags, ETag? eTag) : base(id, name, resourceType, systemData) { + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; Location = location; Tags = tags; - ETag = etag; - PrivateEndpoint = privateEndpoint; - ConnectionState = connectionState; - ProvisioningState = provisioningState; - _serializedAdditionalRawData = serializedAdditionalRawData; + ETag = eTag; } + /// Resource properties. + [WirePath("properties")] + internal PrivateEndpointConnectionProperties Properties { get; set; } + /// Azure location of the key vault resource. [WirePath("location")] public AzureLocation? Location { get; } + /// Tags assigned to the key vault resource. [WirePath("tags")] public IReadOnlyDictionary Tags { get; } + /// Modified whenever there is a change in the state of private endpoint connection. [WirePath("etag")] public ETag? ETag { get; set; } - /// Properties of the private endpoint object. - internal SubResource PrivateEndpoint { get; set; } - /// Gets Id. - [WirePath("properties.privateEndpoint.id")] - public ResourceIdentifier PrivateEndpointId - { - get => PrivateEndpoint is null ? default : PrivateEndpoint.Id; - } /// Approval state of the private link connection. [WirePath("properties.privateLinkServiceConnectionState")] - public KeyVaultPrivateLinkServiceConnectionState ConnectionState { get; set; } + public KeyVaultPrivateLinkServiceConnectionState ConnectionState + { + get + { + return Properties is null ? default : Properties.ConnectionState; + } + set + { + if (Properties is null) + { + Properties = new PrivateEndpointConnectionProperties(); + } + Properties.ConnectionState = value; + } + } + /// Provisioning state of the private endpoint connection. [WirePath("properties.provisioningState")] - public KeyVaultPrivateEndpointConnectionProvisioningState? ProvisioningState { get; } + public KeyVaultPrivateEndpointConnectionProvisioningState? ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + + /// Full identifier of the private endpoint resource. + [WirePath("properties.privateEndpoint.id")] + public string PrivateEndpointId + { + get + { + return Properties is null ? default : Properties.PrivateEndpointId; + } + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionResource.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionResource.Serialization.cs index 0423c72c85d9..fad782d5893b 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionResource.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.KeyVault { + /// public partial class KeyVaultPrivateEndpointConnectionResource : IJsonModel { - private static KeyVaultPrivateEndpointConnectionData s_dataDeserializationInstance; - private static KeyVaultPrivateEndpointConnectionData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new KeyVaultPrivateEndpointConnectionData(); + + /// 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); - KeyVaultPrivateEndpointConnectionData 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. + KeyVaultPrivateEndpointConnectionData 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. KeyVaultPrivateEndpointConnectionData 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/KeyVaultPrivateEndpointConnectionResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionResource.cs index 0943851e07af..1d171b12c92f 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionResource.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionResource.cs @@ -6,46 +6,35 @@ #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; namespace Azure.ResourceManager.KeyVault { /// - /// A Class representing a KeyVaultPrivateEndpointConnection 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 GetKeyVaultPrivateEndpointConnectionResource method. - /// Otherwise you can get one from its parent resource using the GetKeyVaultPrivateEndpointConnection method. + /// A class representing a KeyVaultPrivateEndpointConnection 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 GetKeyVaultPrivateEndpointConnections method. /// public partial class KeyVaultPrivateEndpointConnectionResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The vaultName. - /// The privateEndpointConnectionName. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string privateEndpointConnectionName) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics; - private readonly PrivateEndpointConnectionsRestOperations _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient; + private readonly ClientDiagnostics _privateEndpointConnectionsClientDiagnostics; + private readonly PrivateEndpointConnections _privateEndpointConnectionsRestClient; private readonly KeyVaultPrivateEndpointConnectionData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.KeyVault/vaults/privateEndpointConnections"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of KeyVaultPrivateEndpointConnectionResource for mocking. protected KeyVaultPrivateEndpointConnectionResource() { } - /// 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 KeyVaultPrivateEndpointConnectionResource(ArmClient client, KeyVaultPrivateEndpointConnectionData data) : this(client, data.Id) @@ -54,71 +43,93 @@ internal KeyVaultPrivateEndpointConnectionResource(ArmClient client, KeyVaultPri _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 KeyVaultPrivateEndpointConnectionResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsApiVersion); - _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient = new PrivateEndpointConnectionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ResourceType, out string keyVaultPrivateEndpointConnectionApiVersion); + _privateEndpointConnectionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", ResourceType.Namespace, Diagnostics); + _privateEndpointConnectionsRestClient = new PrivateEndpointConnections(_privateEndpointConnectionsClientDiagnostics, Pipeline, Endpoint, keyVaultPrivateEndpointConnectionApiVersion ?? "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 KeyVaultPrivateEndpointConnectionData 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 resourceGroupName. + /// The vaultName. + /// The privateEndpointConnectionName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string privateEndpointConnectionName) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"; + 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 private endpoint connection associated with the key vault. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Operation Id - /// PrivateEndpointConnections_Get + /// Operation Id. + /// PrivateEndpointConnections_Get. /// /// - /// 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) { - using var scope = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionResource.Get"); + using DiagnosticScope scope = _privateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionResource.Get"); scope.Start(); try { - var response = await _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _privateEndpointConnectionsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(KeyVaultPrivateEndpointConnectionData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new KeyVaultPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -132,33 +143,41 @@ public virtual async Task> G /// Gets the specified private endpoint connection associated with the key vault. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Operation Id - /// PrivateEndpointConnections_Get + /// Operation Id. + /// PrivateEndpointConnections_Get. /// /// - /// 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) { - using var scope = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionResource.Get"); + using DiagnosticScope scope = _privateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionResource.Get"); scope.Start(); try { - var response = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _privateEndpointConnectionsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(KeyVaultPrivateEndpointConnectionData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new KeyVaultPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -172,20 +191,20 @@ public virtual Response Get(Cancellat /// Deletes the specified private endpoint connection associated with the key vault. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Operation Id - /// PrivateEndpointConnections_Delete + /// Operation Id. + /// PrivateEndpointConnections_Delete. /// /// - /// Default Api Version - /// 2025-05-01 + /// Default Api Version. + /// 2025-05-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -193,14 +212,27 @@ public virtual Response Get(Cancellat /// The cancellation token to use. public virtual async Task> DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionResource.Delete"); + using DiagnosticScope scope = _privateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionResource.Delete"); scope.Start(); try { - var response = await _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new KeyVaultArmOperation(new KeyVaultPrivateEndpointConnectionOperationSource(Client), _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _privateEndpointConnectionsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + KeyVaultArmOperation operation = new KeyVaultArmOperation( + new KeyVaultPrivateEndpointConnectionOperationSource(Client), + _privateEndpointConnectionsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -214,20 +246,20 @@ public virtual async Task /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Operation Id - /// PrivateEndpointConnections_Delete + /// Operation Id. + /// PrivateEndpointConnections_Delete. /// /// - /// Default Api Version - /// 2025-05-01 + /// Default Api Version. + /// 2025-05-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -235,14 +267,27 @@ public virtual async Task The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionResource.Delete"); + using DiagnosticScope scope = _privateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionResource.Delete"); scope.Start(); try { - var response = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new KeyVaultArmOperation(new KeyVaultPrivateEndpointConnectionOperationSource(Client), _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _privateEndpointConnectionsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + KeyVaultArmOperation operation = new KeyVaultArmOperation( + new KeyVaultPrivateEndpointConnectionOperationSource(Client), + _privateEndpointConnectionsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -256,20 +301,20 @@ public virtual ArmOperation Delete(Wa /// Updates the specified private endpoint connection associated with the key vault. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Operation Id - /// PrivateEndpointConnections_Put + /// Operation Id. + /// PrivateEndpointConnections_Put. /// /// - /// Default Api Version - /// 2025-05-01 + /// Default Api Version. + /// 2025-05-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -281,16 +326,24 @@ public virtual async Task(Response.FromValue(new KeyVaultPrivateEndpointConnectionResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _privateEndpointConnectionsRestClient.CreatePutRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, KeyVaultPrivateEndpointConnectionData.ToRequestContent(data), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(KeyVaultPrivateEndpointConnectionData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + KeyVaultArmOperation operation = new KeyVaultArmOperation(Response.FromValue(new KeyVaultPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -304,20 +357,20 @@ public virtual async Task /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Operation Id - /// PrivateEndpointConnections_Put + /// Operation Id. + /// PrivateEndpointConnections_Put. /// /// - /// Default Api Version - /// 2025-05-01 + /// Default Api Version. + /// 2025-05-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -329,16 +382,24 @@ public virtual ArmOperation Update(Wa { Argument.AssertNotNull(data, nameof(data)); - using var scope = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionResource.Update"); + using DiagnosticScope scope = _privateEndpointConnectionsClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionResource.Update"); scope.Start(); try { - var response = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Put(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); - var uri = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreatePutRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new KeyVaultArmOperation(Response.FromValue(new KeyVaultPrivateEndpointConnectionResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _privateEndpointConnectionsRestClient.CreatePutRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, KeyVaultPrivateEndpointConnectionData.ToRequestContent(data), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(KeyVaultPrivateEndpointConnectionData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + KeyVaultArmOperation operation = new KeyVaultArmOperation(Response.FromValue(new KeyVaultPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultResource.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultResource.Serialization.cs index b45d538c0cd6..e8b8875a6a4f 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultResource.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.KeyVault { + /// public partial class KeyVaultResource : IJsonModel { - private static KeyVaultData s_dataDeserializationInstance; - private static KeyVaultData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new KeyVaultData(); + + /// 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); - KeyVaultData 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. + KeyVaultData 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. KeyVaultData 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/KeyVaultResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultResource.cs index da0a74b99c37..1204fd07371c 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultResource.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultResource.cs @@ -7,50 +7,37 @@ using System; using System.Collections.Generic; -using System.Globalization; +using System.Diagnostics; 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.Models; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.KeyVault { /// - /// A Class representing a KeyVault 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 GetKeyVaultResource method. - /// Otherwise you can get one from its parent resource using the GetKeyVault method. + /// A class representing a KeyVault 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 GetKeyVaults method. /// public partial class KeyVaultResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The vaultName. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _keyVaultVaultsClientDiagnostics; - private readonly VaultsRestOperations _keyVaultVaultsRestClient; - private readonly ClientDiagnostics _privateLinkResourcesClientDiagnostics; - private readonly PrivateLinkResourcesRestOperations _privateLinkResourcesRestClient; + private readonly ClientDiagnostics _vaultsClientDiagnostics; + private readonly Vaults _vaultsRestClient; private readonly KeyVaultData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.KeyVault/vaults"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of KeyVaultResource for mocking. protected KeyVaultResource() { } - /// 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 KeyVaultResource(ArmClient client, KeyVaultData data) : this(client, data.Id) @@ -59,211 +46,92 @@ internal KeyVaultResource(ArmClient client, KeyVaultData data) : this(client, da _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 KeyVaultResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _keyVaultVaultsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string keyVaultVaultsApiVersion); - _keyVaultVaultsRestClient = new VaultsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, keyVaultVaultsApiVersion); - _privateLinkResourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _privateLinkResourcesRestClient = new PrivateLinkResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ResourceType, out string keyVaultApiVersion); + _vaultsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", ResourceType.Namespace, Diagnostics); + _vaultsRestClient = new Vaults(_vaultsClientDiagnostics, Pipeline, Endpoint, keyVaultApiVersion ?? "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 KeyVaultData Data { get { if (!HasData) + { throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } return _data; } } - 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)); - } - - /// Gets a collection of KeyVaultPrivateEndpointConnectionResources in the KeyVault. - /// An object representing collection of KeyVaultPrivateEndpointConnectionResources and their operations over a KeyVaultPrivateEndpointConnectionResource. - public virtual KeyVaultPrivateEndpointConnectionCollection GetKeyVaultPrivateEndpointConnections() - { - return GetCachedClient(client => new KeyVaultPrivateEndpointConnectionCollection(client, Id)); - } - - /// - /// Gets the specified private endpoint connection associated with the key vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// PrivateEndpointConnections_Get - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// Name of the private endpoint connection associated with the key vault. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetKeyVaultPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) - { - return await GetKeyVaultPrivateEndpointConnections().GetAsync(privateEndpointConnectionName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets the specified private endpoint connection associated with the key vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// PrivateEndpointConnections_Get - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// Name of the private endpoint connection associated with the key vault. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetKeyVaultPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) - { - return GetKeyVaultPrivateEndpointConnections().Get(privateEndpointConnectionName, cancellationToken); - } - - /// Gets a collection of KeyVaultSecretResources in the KeyVault. - /// An object representing collection of KeyVaultSecretResources and their operations over a KeyVaultSecretResource. - public virtual KeyVaultSecretCollection GetKeyVaultSecrets() - { - return GetCachedClient(client => new KeyVaultSecretCollection(client, Id)); - } - - /// - /// Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName} - /// - /// - /// Operation Id - /// Secrets_Get - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the secret. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetKeyVaultSecretAsync(string secretName, CancellationToken cancellationToken = default) + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The vaultName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName) { - return await GetKeyVaultSecrets().GetAsync(secretName, cancellationToken).ConfigureAwait(false); + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}"; + return new ResourceIdentifier(resourceId); } - /// - /// Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName} - /// - /// - /// Operation Id - /// Secrets_Get - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the secret. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetKeyVaultSecret(string secretName, CancellationToken cancellationToken = default) + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) { - return GetKeyVaultSecrets().Get(secretName, cancellationToken); + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } } /// /// Gets the specified Azure key vault. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. /// /// - /// Operation Id - /// Vaults_Get + /// Operation Id. + /// Vaults_Get. /// /// - /// 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) { - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultResource.Get"); + using DiagnosticScope scope = _vaultsClientDiagnostics.CreateScope("KeyVaultResource.Get"); scope.Start(); try { - var response = await _keyVaultVaultsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _vaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(KeyVaultData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new KeyVaultResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -277,33 +145,41 @@ public virtual async Task> GetAsync(CancellationToken /// Gets the specified Azure key vault. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. /// /// - /// Operation Id - /// Vaults_Get + /// Operation Id. + /// Vaults_Get. /// /// - /// 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) { - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultResource.Get"); + using DiagnosticScope scope = _vaultsClientDiagnostics.CreateScope("KeyVaultResource.Get"); scope.Start(); try { - var response = _keyVaultVaultsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _vaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(KeyVaultData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new KeyVaultResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -314,41 +190,49 @@ public virtual Response Get(CancellationToken cancellationToke } /// - /// Deletes the specified Azure key vault. + /// Update a key vault in the specified subscription. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. /// /// - /// Operation Id - /// Vaults_Delete + /// Operation Id. + /// Vaults_Update. /// /// - /// Default Api Version - /// 2025-05-01 + /// Default Api Version. + /// 2025-05-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Parameters to patch the vault. /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(KeyVaultPatch keyVaultPatch, CancellationToken cancellationToken = default) { - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultResource.Delete"); + Argument.AssertNotNull(keyVaultPatch, nameof(keyVaultPatch)); + + using DiagnosticScope scope = _vaultsClientDiagnostics.CreateScope("KeyVaultResource.Update"); scope.Start(); try { - var response = await _keyVaultVaultsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var uri = _keyVaultVaultsRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new KeyVaultArmOperation(response, rehydrationToken); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _vaultsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, KeyVaultPatch.ToRequestContent(keyVaultPatch), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(KeyVaultData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new KeyVaultResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -358,41 +242,49 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Deletes the specified Azure key vault. + /// Update a key vault in the specified subscription. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. /// /// - /// Operation Id - /// Vaults_Delete + /// Operation Id. + /// Vaults_Update. /// /// - /// Default Api Version - /// 2025-05-01 + /// Default Api Version. + /// 2025-05-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Parameters to patch the vault. /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(KeyVaultPatch keyVaultPatch, CancellationToken cancellationToken = default) { - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultResource.Delete"); + Argument.AssertNotNull(keyVaultPatch, nameof(keyVaultPatch)); + + using DiagnosticScope scope = _vaultsClientDiagnostics.CreateScope("KeyVaultResource.Update"); scope.Start(); try { - var response = _keyVaultVaultsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var uri = _keyVaultVaultsRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new KeyVaultArmOperation(response, rehydrationToken); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _vaultsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, KeyVaultPatch.ToRequestContent(keyVaultPatch), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(KeyVaultData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new KeyVaultResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -402,39 +294,48 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Update a key vault in the specified subscription. + /// Deletes the specified Azure key vault. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. /// /// - /// Operation Id - /// Vaults_Update + /// Operation Id. + /// Vaults_Delete. /// /// - /// Default Api Version - /// 2025-05-01 + /// Default Api Version. + /// 2025-05-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// Parameters to patch the vault. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(KeyVaultPatch patch, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultResource.Update"); + using DiagnosticScope scope = _vaultsClientDiagnostics.CreateScope("KeyVaultResource.Delete"); scope.Start(); try { - var response = await _keyVaultVaultsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new KeyVaultResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _vaultsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + KeyVaultArmOperation operation = new KeyVaultArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; } catch (Exception e) { @@ -444,39 +345,48 @@ public virtual async Task> UpdateAsync(KeyVaultPatch } /// - /// Update a key vault in the specified subscription. + /// Deletes the specified Azure key vault. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. /// /// - /// Operation Id - /// Vaults_Update + /// Operation Id. + /// Vaults_Delete. /// /// - /// Default Api Version - /// 2025-05-01 + /// Default Api Version. + /// 2025-05-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// Parameters to patch the vault. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual Response Update(KeyVaultPatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultResource.Update"); + using DiagnosticScope scope = _vaultsClientDiagnostics.CreateScope("KeyVaultResource.Delete"); scope.Start(); try { - var response = _keyVaultVaultsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); - return Response.FromValue(new KeyVaultResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _vaultsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + KeyVaultArmOperation operation = new KeyVaultArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; } catch (Exception e) { @@ -486,35 +396,44 @@ public virtual Response Update(KeyVaultPatch patch, Cancellati } /// - /// Update access policies in a key vault in the specified subscription. + /// Gets the private link resources supported for the key vault. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources. + /// + /// + /// Operation Id. + /// Vaults_ListByVault. /// /// - /// Operation Id - /// Vaults_UpdateAccessPolicy + /// Default Api Version. + /// 2025-05-01. /// /// - /// Default Api Version - /// 2025-05-01 + /// Resource. + /// . /// /// /// - /// Name of the operation. - /// Access policy to merge into the vault. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAccessPolicyAsync(AccessPolicyUpdateKind operationKind, KeyVaultAccessPolicyParameters keyVaultAccessPolicyParameters, CancellationToken cancellationToken = default) + public virtual async Task> GetPrivateLinkResourcesAsync(CancellationToken cancellationToken = default) { - Argument.AssertNotNull(keyVaultAccessPolicyParameters, nameof(keyVaultAccessPolicyParameters)); - - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultResource.UpdateAccessPolicy"); + using DiagnosticScope scope = _vaultsClientDiagnostics.CreateScope("KeyVaultResource.GetPrivateLinkResources"); scope.Start(); try { - var response = await _keyVaultVaultsRestClient.UpdateAccessPolicyAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, operationKind, keyVaultAccessPolicyParameters, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _vaultsRestClient.CreateGetPrivateLinkResourcesRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(KeyVaultPrivateLinkResourceListResult.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return response; } catch (Exception e) @@ -525,35 +444,44 @@ public virtual async Task> UpdateAccess } /// - /// Update access policies in a key vault in the specified subscription. + /// Gets the private link resources supported for the key vault. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources. + /// + /// + /// Operation Id. + /// Vaults_ListByVault. /// /// - /// Operation Id - /// Vaults_UpdateAccessPolicy + /// Default Api Version. + /// 2025-05-01. /// /// - /// Default Api Version - /// 2025-05-01 + /// Resource. + /// . /// /// /// - /// Name of the operation. - /// Access policy to merge into the vault. /// The cancellation token to use. - /// is null. - public virtual Response UpdateAccessPolicy(AccessPolicyUpdateKind operationKind, KeyVaultAccessPolicyParameters keyVaultAccessPolicyParameters, CancellationToken cancellationToken = default) + public virtual Response GetPrivateLinkResources(CancellationToken cancellationToken = default) { - Argument.AssertNotNull(keyVaultAccessPolicyParameters, nameof(keyVaultAccessPolicyParameters)); - - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultResource.UpdateAccessPolicy"); + using DiagnosticScope scope = _vaultsClientDiagnostics.CreateScope("KeyVaultResource.GetPrivateLinkResources"); scope.Start(); try { - var response = _keyVaultVaultsRestClient.UpdateAccessPolicy(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, operationKind, keyVaultAccessPolicyParameters, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _vaultsRestClient.CreateGetPrivateLinkResourcesRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(KeyVaultPrivateLinkResourceListResult.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return response; } catch (Exception e) @@ -563,77 +491,7 @@ public virtual Response UpdateAccessPolicy(Acces } } - /// - /// Gets the private link resources supported for the key vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources - /// - /// - /// Operation Id - /// PrivateLinkResources_ListByVault - /// - /// - /// 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 GetPrivateLinkResourcesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _privateLinkResourcesRestClient.CreateListByVaultRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => KeyVaultPrivateLinkResourceData.DeserializeKeyVaultPrivateLinkResourceData(e), _privateLinkResourcesClientDiagnostics, Pipeline, "KeyVaultResource.GetPrivateLinkResources", "value", null, cancellationToken); - } - - /// - /// Gets the private link resources supported for the key vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources - /// - /// - /// Operation Id - /// PrivateLinkResources_ListByVault - /// - /// - /// 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 GetPrivateLinkResources(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _privateLinkResourcesRestClient.CreateListByVaultRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => KeyVaultPrivateLinkResourceData.DeserializeKeyVaultPrivateLinkResourceData(e), _privateLinkResourcesClientDiagnostics, Pipeline, "KeyVaultResource.GetPrivateLinkResources", "value", null, cancellationToken); - } - - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} - /// - /// - /// Operation Id - /// Vaults_Get - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -643,29 +501,35 @@ public virtual async Task> AddTagAsync(string key, st Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultResource.AddTag"); + using DiagnosticScope scope = _vaultsClientDiagnostics.CreateScope("KeyVaultResource.AddTag"); scope.Start(); try { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) { - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + Response 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 _keyVaultVaultsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new KeyVaultResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _vaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(KeyVaultData.FromResponse(result), result); + return Response.FromValue(new KeyVaultResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new KeyVaultPatch(); - foreach (var tag in current.Tags) + KeyVaultData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + KeyVaultPatch patch = new KeyVaultPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags[key] = value; - var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return result; + Response result = await UpdateAsync(patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); } } catch (Exception e) @@ -675,27 +539,7 @@ public virtual async Task> AddTagAsync(string key, st } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} - /// - /// - /// Operation Id - /// Vaults_Get - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -705,29 +549,35 @@ public virtual Response AddTag(string key, string value, Cance Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultResource.AddTag"); + using DiagnosticScope scope = _vaultsClientDiagnostics.CreateScope("KeyVaultResource.AddTag"); scope.Start(); try { - if (CanUseTagResource(cancellationToken: cancellationToken)) + if (CanUseTagResource(cancellationToken)) { - var originalTags = GetTagResource().Get(cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues[key] = value; - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _keyVaultVaultsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new KeyVaultResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _vaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(KeyVaultData.FromResponse(result), result); + return Response.FromValue(new KeyVaultResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new KeyVaultPatch(); - foreach (var tag in current.Tags) + KeyVaultData current = Get(cancellationToken: cancellationToken).Value.Data; + KeyVaultPatch patch = new KeyVaultPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags[key] = value; - var result = Update(patch, cancellationToken: cancellationToken); - return result; + Response result = Update(patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); } } catch (Exception e) @@ -737,54 +587,40 @@ public virtual Response AddTag(string key, string value, Cance } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} - /// - /// - /// Operation Id - /// Vaults_Get - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. /// The cancellation token to use. /// is null. public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultResource.SetTags"); + using DiagnosticScope scope = _vaultsClientDiagnostics.CreateScope("KeyVaultResource.SetTags"); scope.Start(); try { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) { - await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken).ConfigureAwait(false); + Response 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 _keyVaultVaultsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new KeyVaultResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _vaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(KeyVaultData.FromResponse(result), result); + return Response.FromValue(new KeyVaultResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new KeyVaultPatch(); + KeyVaultData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + KeyVaultPatch patch = new KeyVaultPatch(); patch.Tags.ReplaceWith(tags); - var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return result; + Response result = await UpdateAsync(patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); } } catch (Exception e) @@ -794,54 +630,40 @@ public virtual async Task> SetTagsAsync(IDictionary - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} - /// - /// - /// Operation Id - /// Vaults_Get - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. /// The cancellation token to use. /// is null. public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultResource.SetTags"); + using DiagnosticScope scope = _vaultsClientDiagnostics.CreateScope("KeyVaultResource.SetTags"); scope.Start(); try { - if (CanUseTagResource(cancellationToken: cancellationToken)) + if (CanUseTagResource(cancellationToken)) { - GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); - var originalTags = GetTagResource().Get(cancellationToken); + GetTagResource().Delete(WaitUntil.Completed, cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues.ReplaceWith(tags); - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _keyVaultVaultsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new KeyVaultResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _vaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(KeyVaultData.FromResponse(result), result); + return Response.FromValue(new KeyVaultResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new KeyVaultPatch(); + KeyVaultData current = Get(cancellationToken: cancellationToken).Value.Data; + KeyVaultPatch patch = new KeyVaultPatch(); patch.Tags.ReplaceWith(tags); - var result = Update(patch, cancellationToken: cancellationToken); - return result; + Response result = Update(patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); } } catch (Exception e) @@ -851,27 +673,7 @@ public virtual Response SetTags(IDictionary ta } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} - /// - /// - /// Operation Id - /// Vaults_Get - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -879,29 +681,35 @@ public virtual async Task> RemoveTagAsync(string key, { Argument.AssertNotNull(key, nameof(key)); - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultResource.RemoveTag"); + using DiagnosticScope scope = _vaultsClientDiagnostics.CreateScope("KeyVaultResource.RemoveTag"); scope.Start(); try { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) { - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + Response 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 _keyVaultVaultsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new KeyVaultResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _vaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(KeyVaultData.FromResponse(result), result); + return Response.FromValue(new KeyVaultResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new KeyVaultPatch(); - foreach (var tag in current.Tags) + KeyVaultData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + KeyVaultPatch patch = new KeyVaultPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags.Remove(key); - var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return result; + Response result = await UpdateAsync(patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); } } catch (Exception e) @@ -911,27 +719,7 @@ public virtual async Task> RemoveTagAsync(string key, } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} - /// - /// - /// Operation Id - /// Vaults_Get - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -939,29 +727,35 @@ public virtual Response RemoveTag(string key, CancellationToke { Argument.AssertNotNull(key, nameof(key)); - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultResource.RemoveTag"); + using DiagnosticScope scope = _vaultsClientDiagnostics.CreateScope("KeyVaultResource.RemoveTag"); scope.Start(); try { - if (CanUseTagResource(cancellationToken: cancellationToken)) + if (CanUseTagResource(cancellationToken)) { - var originalTags = GetTagResource().Get(cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues.Remove(key); - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _keyVaultVaultsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new KeyVaultResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _vaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(KeyVaultData.FromResponse(result), result); + return Response.FromValue(new KeyVaultResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new KeyVaultPatch(); - foreach (var tag in current.Tags) + KeyVaultData current = Get(cancellationToken: cancellationToken).Value.Data; + KeyVaultPatch patch = new KeyVaultPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags.Remove(key); - var result = Update(patch, cancellationToken: cancellationToken); - return result; + Response result = Update(patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); } } catch (Exception e) @@ -970,5 +764,71 @@ public virtual Response RemoveTag(string key, CancellationToke throw; } } + + /// Gets a collection of KeyVaultPrivateEndpointConnections in the . + /// An object representing collection of KeyVaultPrivateEndpointConnections and their operations over a KeyVaultPrivateEndpointConnectionResource. + public virtual KeyVaultPrivateEndpointConnectionCollection GetKeyVaultPrivateEndpointConnections() + { + return GetCachedClient(client => new KeyVaultPrivateEndpointConnectionCollection(client, Id)); + } + + /// Gets the specified private endpoint connection associated with the key vault. + /// Name of the private endpoint connection associated with the key vault. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetKeyVaultPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + return await GetKeyVaultPrivateEndpointConnections().GetAsync(privateEndpointConnectionName, cancellationToken).ConfigureAwait(false); + } + + /// Gets the specified private endpoint connection associated with the key vault. + /// Name of the private endpoint connection associated with the key vault. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetKeyVaultPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + return GetKeyVaultPrivateEndpointConnections().Get(privateEndpointConnectionName, cancellationToken); + } + + /// Gets a collection of KeyVaultSecrets in the . + /// An object representing collection of KeyVaultSecrets and their operations over a KeyVaultSecretResource. + public virtual KeyVaultSecretCollection GetKeyVaultSecrets() + { + return GetCachedClient(client => new KeyVaultSecretCollection(client, Id)); + } + + /// Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + /// The name of the secret. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetKeyVaultSecretAsync(string secretName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(secretName, nameof(secretName)); + + return await GetKeyVaultSecrets().GetAsync(secretName, cancellationToken).ConfigureAwait(false); + } + + /// Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + /// The name of the secret. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetKeyVaultSecret(string secretName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(secretName, nameof(secretName)); + + return GetKeyVaultSecrets().Get(secretName, cancellationToken); + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretCollection.cs index 5d1d816cca5f..76660bb0ed9f 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretCollection.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretCollection.cs @@ -8,92 +8,99 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Globalization; +using System.Diagnostics; 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.Models; 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 GetKeyVaultSecrets 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 GetKeyVaultSecrets method from an instance of the parent resource. /// public partial class KeyVaultSecretCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _keyVaultSecretSecretsClientDiagnostics; - private readonly SecretsRestOperations _keyVaultSecretSecretsRestClient; + private readonly ClientDiagnostics _secretsClientDiagnostics; + private readonly Secrets _secretsRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of KeyVaultSecretCollection for mocking. protected KeyVaultSecretCollection() { } - /// 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 KeyVaultSecretCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _keyVaultSecretSecretsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", KeyVaultSecretResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(KeyVaultSecretResource.ResourceType, out string keyVaultSecretSecretsApiVersion); - _keyVaultSecretSecretsRestClient = new SecretsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, keyVaultSecretSecretsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(KeyVaultSecretResource.ResourceType, out string keyVaultSecretApiVersion); + _secretsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", KeyVaultSecretResource.ResourceType.Namespace, Diagnostics); + _secretsRestClient = new Secrets(_secretsClientDiagnostics, Pipeline, Endpoint, keyVaultSecretApiVersion ?? "2025-05-01"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != KeyVaultResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, KeyVaultResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, KeyVaultResource.ResourceType), id); + } } /// /// Create or update a secret in a key vault in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName} - /// - /// - /// Operation Id - /// Secrets_CreateOrUpdate + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}. /// /// - /// Default Api Version - /// 2025-05-01 + /// Operation Id. + /// Secrets_CreateOrUpdate. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-05-01. /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The name of the secret. - /// Parameters to create or update the secret. + /// Parameters to create or update the secret. /// The cancellation token to use. + /// or is null. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string secretName, KeyVaultSecretCreateOrUpdateContent content, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string secretName, SecretCreateOrUpdateParameters secretCreateOrUpdateParameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(secretName, nameof(secretName)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(secretCreateOrUpdateParameters, nameof(secretCreateOrUpdateParameters)); - using var scope = _keyVaultSecretSecretsClientDiagnostics.CreateScope("KeyVaultSecretCollection.CreateOrUpdate"); + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("KeyVaultSecretCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _keyVaultSecretSecretsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, secretName, content, cancellationToken).ConfigureAwait(false); - var uri = _keyVaultSecretSecretsRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, secretName, content); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new KeyVaultArmOperation(Response.FromValue(new KeyVaultSecretResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, secretName, SecretCreateOrUpdateParameters.ToRequestContent(secretCreateOrUpdateParameters), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(KeyVaultSecretData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + KeyVaultArmOperation operation = new KeyVaultArmOperation(Response.FromValue(new KeyVaultSecretResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -107,44 +114,48 @@ public virtual async Task> CreateOrUpdateAs /// Create or update a secret in a key vault in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}. /// /// - /// Operation Id - /// Secrets_CreateOrUpdate + /// Operation Id. + /// Secrets_CreateOrUpdate. /// /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-05-01. /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The name of the secret. - /// Parameters to create or update the secret. + /// Parameters to create or update the secret. /// The cancellation token to use. + /// or is null. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string secretName, KeyVaultSecretCreateOrUpdateContent content, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string secretName, SecretCreateOrUpdateParameters secretCreateOrUpdateParameters, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(secretName, nameof(secretName)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(secretCreateOrUpdateParameters, nameof(secretCreateOrUpdateParameters)); - using var scope = _keyVaultSecretSecretsClientDiagnostics.CreateScope("KeyVaultSecretCollection.CreateOrUpdate"); + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("KeyVaultSecretCollection.CreateOrUpdate"); scope.Start(); try { - var response = _keyVaultSecretSecretsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, secretName, content, cancellationToken); - var uri = _keyVaultSecretSecretsRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, secretName, content); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new KeyVaultArmOperation(Response.FromValue(new KeyVaultSecretResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, secretName, SecretCreateOrUpdateParameters.ToRequestContent(secretCreateOrUpdateParameters), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(KeyVaultSecretData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + KeyVaultArmOperation operation = new KeyVaultArmOperation(Response.FromValue(new KeyVaultSecretResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -158,38 +169,42 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil wai /// Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName} - /// - /// - /// Operation Id - /// Secrets_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}. /// /// - /// Default Api Version - /// 2025-05-01 + /// Operation Id. + /// Secrets_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-05-01. /// /// /// /// The name of the secret. /// 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> GetAsync(string secretName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(secretName, nameof(secretName)); - using var scope = _keyVaultSecretSecretsClientDiagnostics.CreateScope("KeyVaultSecretCollection.Get"); + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("KeyVaultSecretCollection.Get"); scope.Start(); try { - var response = await _keyVaultSecretSecretsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, secretName, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, secretName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(KeyVaultSecretData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new KeyVaultSecretResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -203,38 +218,42 @@ public virtual async Task> GetAsync(string secr /// Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName} - /// - /// - /// Operation Id - /// Secrets_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}. /// /// - /// Default Api Version - /// 2025-05-01 + /// Operation Id. + /// Secrets_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-05-01. /// /// /// /// The name of the secret. /// 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 Get(string secretName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(secretName, nameof(secretName)); - using var scope = _keyVaultSecretSecretsClientDiagnostics.CreateScope("KeyVaultSecretCollection.Get"); + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("KeyVaultSecretCollection.Get"); scope.Start(); try { - var response = _keyVaultSecretSecretsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, secretName, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, secretName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(KeyVaultSecretData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new KeyVaultSecretResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -244,102 +263,92 @@ public virtual Response Get(string secretName, Cancellat } } - /// - /// The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets - /// - /// - /// Operation Id - /// Secrets_List - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. /// 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 GetAllAsync(int? top = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(int? top = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _keyVaultSecretSecretsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _keyVaultSecretSecretsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new KeyVaultSecretResource(Client, KeyVaultSecretData.DeserializeKeyVaultSecretData(e)), _keyVaultSecretSecretsClientDiagnostics, Pipeline, "KeyVaultSecretCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new SecretsGetAllAsyncCollectionResultOfT( + _secretsRestClient, + Guid.Parse(Id.SubscriptionId), + Id.ResourceGroupName, + Id.Name, + top, + context), data => new KeyVaultSecretResource(Client, data)); } - /// - /// The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets - /// - /// - /// Operation Id - /// Secrets_List - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. /// 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 GetAll(int? top = null, CancellationToken cancellationToken = default) + public virtual Pageable GetAll(int? top = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _keyVaultSecretSecretsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _keyVaultSecretSecretsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new KeyVaultSecretResource(Client, KeyVaultSecretData.DeserializeKeyVaultSecretData(e)), _keyVaultSecretSecretsClientDiagnostics, Pipeline, "KeyVaultSecretCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new SecretsGetAllCollectionResultOfT( + _secretsRestClient, + Guid.Parse(Id.SubscriptionId), + Id.ResourceGroupName, + Id.Name, + top, + context), data => new KeyVaultSecretResource(Client, data)); } /// - /// Checks to see if the resource exists in azure. + /// Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName} - /// - /// - /// Operation Id - /// Secrets_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}. /// /// - /// Default Api Version - /// 2025-05-01 + /// Operation Id. + /// Secrets_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-05-01. /// /// /// /// The name of the secret. /// 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(string secretName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(secretName, nameof(secretName)); - using var scope = _keyVaultSecretSecretsClientDiagnostics.CreateScope("KeyVaultSecretCollection.Exists"); + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("KeyVaultSecretCollection.Exists"); scope.Start(); try { - var response = await _keyVaultSecretSecretsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, secretName, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, secretName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(KeyVaultSecretData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((KeyVaultSecretData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -350,39 +359,53 @@ public virtual async Task> ExistsAsync(string secretName, Cancell } /// - /// Checks to see if the resource exists in azure. + /// Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}. /// /// - /// Operation Id - /// Secrets_Get + /// Operation Id. + /// Secrets_Get. /// /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-05-01. /// /// /// /// The name of the secret. /// 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(string secretName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(secretName, nameof(secretName)); - using var scope = _keyVaultSecretSecretsClientDiagnostics.CreateScope("KeyVaultSecretCollection.Exists"); + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("KeyVaultSecretCollection.Exists"); scope.Start(); try { - var response = _keyVaultSecretSecretsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, secretName, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, secretName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(KeyVaultSecretData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((KeyVaultSecretData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -393,41 +416,57 @@ public virtual Response Exists(string secretName, CancellationToken cancel } /// - /// Tries to get details for this resource from the service. + /// Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName} - /// - /// - /// Operation Id - /// Secrets_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}. /// /// - /// Default Api Version - /// 2025-05-01 + /// Operation Id. + /// Secrets_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-05-01. /// /// /// /// The name of the secret. /// 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(string secretName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(secretName, nameof(secretName)); - using var scope = _keyVaultSecretSecretsClientDiagnostics.CreateScope("KeyVaultSecretCollection.GetIfExists"); + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("KeyVaultSecretCollection.GetIfExists"); scope.Start(); try { - var response = await _keyVaultSecretSecretsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, secretName, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, secretName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(KeyVaultSecretData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((KeyVaultSecretData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new KeyVaultSecretResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -438,41 +477,57 @@ public virtual async Task> GetIfExistsA } /// - /// Tries to get details for this resource from the service. + /// Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName} - /// - /// - /// Operation Id - /// Secrets_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}. /// /// - /// Default Api Version - /// 2025-05-01 + /// Operation Id. + /// Secrets_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-05-01. /// /// /// /// The name of the secret. /// 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(string secretName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(secretName, nameof(secretName)); - using var scope = _keyVaultSecretSecretsClientDiagnostics.CreateScope("KeyVaultSecretCollection.GetIfExists"); + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("KeyVaultSecretCollection.GetIfExists"); scope.Start(); try { - var response = _keyVaultSecretSecretsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, secretName, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, secretName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(KeyVaultSecretData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((KeyVaultSecretData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new KeyVaultSecretResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -492,6 +547,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } + /// The cancellation token to use. IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretData.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretData.Serialization.cs index 5e70af23b0df..7940197c4417 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretData.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretData.Serialization.cs @@ -8,19 +8,25 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; 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 KeyVaultSecretData : IUtf8JsonSerializable, IJsonModel + /// Resource information with extended details. + public partial class KeyVaultSecretData : ResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal KeyVaultSecretData() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -32,12 +38,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit /// 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(KeyVaultSecretData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); writer.WriteObjectValue(Properties, options); @@ -53,271 +58,165 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri foreach (var item in Tags) { writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } writer.WriteStringValue(item.Value); } writer.WriteEndObject(); } } - KeyVaultSecretData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + KeyVaultSecretData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (KeyVaultSecretData)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(KeyVaultSecretData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeKeyVaultSecretData(document.RootElement, options); } - internal static KeyVaultSecretData DeserializeKeyVaultSecretData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static KeyVaultSecretData DeserializeKeyVaultSecretData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - SecretProperties properties = default; - AzureLocation? location = default; - IReadOnlyDictionary tags = 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(); + SecretProperties properties = default; + AzureLocation? location = default; + IReadOnlyDictionary tags = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("properties"u8)) - { - properties = SecretProperties.DeserializeSecretProperties(property.Value, options); - continue; - } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("id"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - location = new AzureLocation(property.Value.GetString()); + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("name"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("systemData"u8)) { - id = new ResourceIdentifier(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("name"u8)) + if (prop.NameEquals("properties"u8)) { - name = property.Value.GetString(); + properties = SecretProperties.DeserializeSecretProperties(prop.Value, options); continue; } - if (property.NameEquals("type"u8)) + if (prop.NameEquals("location"u8)) { - type = new ResourceType(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(prop.Value.GetString()); continue; } - if (property.NameEquals("systemData"u8)) + if (prop.NameEquals("tags"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); + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + tags = dictionary; 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 KeyVaultSecretData( id, name, - type, + resourceType, systemData, + additionalBinaryDataProperties, properties, location, - tags ?? new ChangeTrackingDictionary(), - serializedAdditionalRawData); + tags ?? new ChangeTrackingDictionary()); } - 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(Location), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" location: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Location)) - { - builder.Append(" location: "); - builder.AppendLine($"'{Location.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Tags), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" tags: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Tags)) - { - if (Tags.Any()) - { - builder.Append(" tags: "); - builder.AppendLine("{"); - foreach (var item in Tags) - { - builder.Append($" '{item.Key}': "); - if (item.Value == null) - { - builder.Append("null"); - continue; - } - if (item.Value.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{item.Value}'''"); - } - else - { - builder.AppendLine($"'{item.Value}'"); - } - } - builder.AppendLine(" }"); - } - } - } - - 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(KeyVaultSecretData)} does not support writing '{options.Format}' format."); } } - KeyVaultSecretData 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. + KeyVaultSecretData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (KeyVaultSecretData)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 DeserializeKeyVaultSecretData(document.RootElement, options); } default: @@ -325,6 +224,15 @@ KeyVaultSecretData IPersistableModel.Create(BinaryData data, } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static KeyVaultSecretData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeKeyVaultSecretData(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretData.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretData.cs index c28b1fcc8921..7223db0f010c 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretData.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretData.cs @@ -13,83 +13,45 @@ namespace Azure.ResourceManager.KeyVault { - /// - /// A class representing the KeyVaultSecret data model. - /// Resource information with extended details. - /// + /// Resource information with extended details. public partial class KeyVaultSecretData : 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 . /// Properties of the secret. - /// is null. - public KeyVaultSecretData(SecretProperties properties) + internal KeyVaultSecretData(SecretProperties properties) { - Argument.AssertNotNull(properties, nameof(properties)); - Properties = properties; Tags = new ChangeTrackingDictionary(); } /// 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 secret. /// Azure location of the key vault resource. /// Tags assigned to the key vault resource. - /// Keeps track of any properties unknown to the library. - internal KeyVaultSecretData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SecretProperties properties, AzureLocation? location, IReadOnlyDictionary tags, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal KeyVaultSecretData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, SecretProperties properties, AzureLocation? location, IReadOnlyDictionary tags) : base(id, name, resourceType, systemData) { + _additionalBinaryDataProperties = additionalBinaryDataProperties; Properties = properties; Location = location; Tags = tags; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal KeyVaultSecretData() - { } /// Properties of the secret. [WirePath("properties")] - public SecretProperties Properties { get; set; } + public SecretProperties Properties { get; } + /// Azure location of the key vault resource. [WirePath("location")] public AzureLocation? Location { get; } + /// Tags assigned to the key vault resource. [WirePath("tags")] public IReadOnlyDictionary Tags { get; } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretResource.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretResource.Serialization.cs index 69159ad41fa8..166d2cba103f 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretResource.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.KeyVault { + /// public partial class KeyVaultSecretResource : IJsonModel { - private static KeyVaultSecretData s_dataDeserializationInstance; - private static KeyVaultSecretData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new KeyVaultSecretData(); + + /// 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); - KeyVaultSecretData 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. + KeyVaultSecretData 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. KeyVaultSecretData 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/KeyVaultSecretResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretResource.cs index 8a10c378c6e7..418a5a1fd5ae 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretResource.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretResource.cs @@ -6,47 +6,38 @@ #nullable disable using System; -using System.Globalization; +using System.Collections.Generic; +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.KeyVault.Models; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.KeyVault { /// - /// A Class representing a KeyVaultSecret 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 GetKeyVaultSecretResource method. - /// Otherwise you can get one from its parent resource using the GetKeyVaultSecret method. + /// A class representing a KeyVaultSecret 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 GetKeyVaultSecrets method. /// public partial class KeyVaultSecretResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The vaultName. - /// The secretName. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string secretName) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _keyVaultSecretSecretsClientDiagnostics; - private readonly SecretsRestOperations _keyVaultSecretSecretsRestClient; + private readonly ClientDiagnostics _secretsClientDiagnostics; + private readonly Secrets _secretsRestClient; private readonly KeyVaultSecretData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.KeyVault/vaults/secrets"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of KeyVaultSecretResource for mocking. protected KeyVaultSecretResource() { } - /// 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 KeyVaultSecretResource(ArmClient client, KeyVaultSecretData data) : this(client, data.Id) @@ -55,71 +46,93 @@ internal KeyVaultSecretResource(ArmClient client, KeyVaultSecretData data) : thi _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 KeyVaultSecretResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _keyVaultSecretSecretsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string keyVaultSecretSecretsApiVersion); - _keyVaultSecretSecretsRestClient = new SecretsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, keyVaultSecretSecretsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ResourceType, out string keyVaultSecretApiVersion); + _secretsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", ResourceType.Namespace, Diagnostics); + _secretsRestClient = new Secrets(_secretsClientDiagnostics, Pipeline, Endpoint, keyVaultSecretApiVersion ?? "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 KeyVaultSecretData 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 resourceGroupName. + /// The vaultName. + /// The secretName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string secretName) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}"; + 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 secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}. /// /// - /// Operation Id - /// Secrets_Get + /// Operation Id. + /// Secrets_Get. /// /// - /// 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) { - using var scope = _keyVaultSecretSecretsClientDiagnostics.CreateScope("KeyVaultSecretResource.Get"); + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("KeyVaultSecretResource.Get"); scope.Start(); try { - var response = await _keyVaultSecretSecretsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(KeyVaultSecretData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new KeyVaultSecretResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -133,33 +146,41 @@ public virtual async Task> GetAsync(Cancellatio /// Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}. /// /// - /// Operation Id - /// Secrets_Get + /// Operation Id. + /// Secrets_Get. /// /// - /// 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) { - using var scope = _keyVaultSecretSecretsClientDiagnostics.CreateScope("KeyVaultSecretResource.Get"); + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("KeyVaultSecretResource.Get"); scope.Start(); try { - var response = _keyVaultSecretSecretsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(KeyVaultSecretData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new KeyVaultSecretResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -173,35 +194,45 @@ public virtual Response Get(CancellationToken cancellati /// Update a secret in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}. /// /// - /// Operation Id - /// Secrets_Update + /// Operation Id. + /// Secrets_Update. /// /// - /// Default Api Version - /// 2025-05-01 + /// Default Api Version. + /// 2025-05-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// Parameters to patch the secret. + /// Parameters to patch the secret. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(KeyVaultSecretPatch patch, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(KeyVaultSecretPatch keyVaultSecretPatch, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(keyVaultSecretPatch, nameof(keyVaultSecretPatch)); - using var scope = _keyVaultSecretSecretsClientDiagnostics.CreateScope("KeyVaultSecretResource.Update"); + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("KeyVaultSecretResource.Update"); scope.Start(); try { - var response = await _keyVaultSecretSecretsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, KeyVaultSecretPatch.ToRequestContent(keyVaultSecretPatch), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(KeyVaultSecretData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new KeyVaultSecretResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -215,35 +246,45 @@ public virtual async Task> UpdateAsync(KeyVault /// Update a secret in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}. /// /// - /// Operation Id - /// Secrets_Update + /// Operation Id. + /// Secrets_Update. /// /// - /// Default Api Version - /// 2025-05-01 + /// Default Api Version. + /// 2025-05-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// Parameters to patch the secret. + /// Parameters to patch the secret. /// The cancellation token to use. - /// is null. - public virtual Response Update(KeyVaultSecretPatch patch, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(KeyVaultSecretPatch keyVaultSecretPatch, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(keyVaultSecretPatch, nameof(keyVaultSecretPatch)); - using var scope = _keyVaultSecretSecretsClientDiagnostics.CreateScope("KeyVaultSecretResource.Update"); + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("KeyVaultSecretResource.Update"); scope.Start(); try { - var response = _keyVaultSecretSecretsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, KeyVaultSecretPatch.ToRequestContent(keyVaultSecretPatch), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(KeyVaultSecretData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new KeyVaultSecretResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -252,5 +293,279 @@ public virtual Response Update(KeyVaultSecretPatch patch throw; } } + + /// Add a tag to the current resource. + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("KeyVaultSecretResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(KeyVaultSecretData.FromResponse(result), result); + return Response.FromValue(new KeyVaultSecretResource(Client, response.Value), response.GetRawResponse()); + } + else + { + KeyVaultSecretData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + KeyVaultSecretPatch patch = new KeyVaultSecretPatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + Response result = await UpdateAsync(patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Add a tag to the current resource. + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("KeyVaultSecretResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(KeyVaultSecretData.FromResponse(result), result); + return Response.FromValue(new KeyVaultSecretResource(Client, response.Value), response.GetRawResponse()); + } + else + { + KeyVaultSecretData current = Get(cancellationToken: cancellationToken).Value.Data; + KeyVaultSecretPatch patch = new KeyVaultSecretPatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + Response result = Update(patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("KeyVaultSecretResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken).ConfigureAwait(false); + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(KeyVaultSecretData.FromResponse(result), result); + return Response.FromValue(new KeyVaultSecretResource(Client, response.Value), response.GetRawResponse()); + } + else + { + KeyVaultSecretData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + KeyVaultSecretPatch patch = new KeyVaultSecretPatch(); + patch.Tags.ReplaceWith(tags); + Response result = await UpdateAsync(patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("KeyVaultSecretResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(KeyVaultSecretData.FromResponse(result), result); + return Response.FromValue(new KeyVaultSecretResource(Client, response.Value), response.GetRawResponse()); + } + else + { + KeyVaultSecretData current = Get(cancellationToken: cancellationToken).Value.Data; + KeyVaultSecretPatch patch = new KeyVaultSecretPatch(); + patch.Tags.ReplaceWith(tags); + Response result = Update(patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Removes a tag by key from the resource. + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("KeyVaultSecretResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(KeyVaultSecretData.FromResponse(result), result); + return Response.FromValue(new KeyVaultSecretResource(Client, response.Value), response.GetRawResponse()); + } + else + { + KeyVaultSecretData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + KeyVaultSecretPatch patch = new KeyVaultSecretPatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + Response result = await UpdateAsync(patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Removes a tag by key from the resource. + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("KeyVaultSecretResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(KeyVaultSecretData.FromResponse(result), result); + return Response.FromValue(new KeyVaultSecretResource(Client, response.Value), response.GetRawResponse()); + } + else + { + KeyVaultSecretData current = Get(cancellationToken: cancellationToken).Value.Data; + KeyVaultSecretPatch patch = new KeyVaultSecretPatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + Response result = Update(patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/LongRunningOperation/KeyVaultArmOperation.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/LongRunningOperation/KeyVaultArmOperation.cs index 8fb7442f68c2..650b21db3a0e 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/LongRunningOperation/KeyVaultArmOperation.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/LongRunningOperation/KeyVaultArmOperation.cs @@ -6,18 +6,16 @@ #nullable disable using System; -using System.ClientModel.Primitives; -using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; namespace Azure.ResourceManager.KeyVault { -#pragma warning disable SA1649 // File name should match first type name - internal class KeyVaultArmOperation : ArmOperation -#pragma warning restore SA1649 // File name should match first type name + internal partial class KeyVaultArmOperation : ArmOperation { private readonly OperationInternal _operation; private readonly RehydrationToken? _completeRehydrationToken; @@ -29,6 +27,9 @@ protected KeyVaultArmOperation() { } + /// + /// The operation response. + /// The token to rehydrate the operation. internal KeyVaultArmOperation(Response response, RehydrationToken? rehydrationToken = null) { _operation = OperationInternal.Succeeded(response); @@ -36,12 +37,20 @@ internal KeyVaultArmOperation(Response response, RehydrationToken? rehydrationTo _operationId = GetOperationId(rehydrationToken); } + /// + /// The instance of . + /// The instance of . + /// The operation request. + /// The operation response. + /// The finalStateVia of the operation. + /// If should skip Api version override. + /// The Api version override value. internal KeyVaultArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) { - var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); - if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationValue) + IOperation nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationImplementation) { - _nextLinkOperation = nextLinkOperationValue; + _nextLinkOperation = nextLinkOperationImplementation; _operationId = _nextLinkOperation.OperationId; } else @@ -49,48 +58,49 @@ internal KeyVaultArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); _operationId = GetOperationId(_completeRehydrationToken); } - _operation = new OperationInternal(nextLinkOperation, clientDiagnostics, response, "KeyVaultArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + _operation = new OperationInternal( + nextLinkOperation, + clientDiagnostics, + response, + "KeyVaultArmOperation", + null, + new SequentialDelayStrategy()); } + /// Gets the Id. + public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; + + /// Gets the HasCompleted. + public override bool HasCompleted => _operation.HasCompleted; + + /// The token to rehydrate a long-running operation. private string GetOperationId(RehydrationToken? rehydrationToken) { - if (rehydrationToken is null) - { - return null; - } - var data = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json, AzureResourceManagerKeyVaultContext.Default); - using var document = JsonDocument.Parse(data); - var lroDetails = document.RootElement; - return lroDetails.GetProperty("id").GetString(); + return rehydrationToken?.Id; } - /// - public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; - /// + /// public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; - /// - public override bool HasCompleted => _operation.HasCompleted; - - /// + /// public override Response GetRawResponse() => _operation.RawResponse; - /// + /// public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); - /// + /// public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); - /// + /// public override Response WaitForCompletionResponse(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponse(cancellationToken); - /// + /// public override Response WaitForCompletionResponse(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponse(pollingInterval, cancellationToken); - /// + /// public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); - /// + /// public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/LongRunningOperation/KeyVaultArmOperationOfT.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/LongRunningOperation/KeyVaultArmOperationOfT.cs index 34aa42526b56..460ac7bdc6df 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/LongRunningOperation/KeyVaultArmOperationOfT.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/LongRunningOperation/KeyVaultArmOperationOfT.cs @@ -6,18 +6,16 @@ #nullable disable using System; -using System.ClientModel.Primitives; -using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; namespace Azure.ResourceManager.KeyVault { -#pragma warning disable SA1649 // File name should match first type name - internal class KeyVaultArmOperation : ArmOperation -#pragma warning restore SA1649 // File name should match first type name + internal partial class KeyVaultArmOperation : ArmOperation { private readonly OperationInternal _operation; private readonly RehydrationToken? _completeRehydrationToken; @@ -29,6 +27,9 @@ protected KeyVaultArmOperation() { } + /// + /// The operation response. + /// The token to rehydrate the operation. internal KeyVaultArmOperation(Response response, RehydrationToken? rehydrationToken = null) { _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); @@ -36,12 +37,21 @@ internal KeyVaultArmOperation(Response response, RehydrationToken? rehydratio _operationId = GetOperationId(rehydrationToken); } + /// + /// The instance of . + /// The instance of . + /// The instance of . + /// The operation request. + /// The operation response. + /// The finalStateVia of the operation. + /// If should skip Api version override. + /// The Api version override value. internal KeyVaultArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) { - var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); - if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationValue) + IOperation nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationImplementation) { - _nextLinkOperation = nextLinkOperationValue; + _nextLinkOperation = nextLinkOperationImplementation; _operationId = _nextLinkOperation.OperationId; } else @@ -49,54 +59,55 @@ internal KeyVaultArmOperation(IOperationSource source, ClientDiagnostics clie _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); _operationId = GetOperationId(_completeRehydrationToken); } - _operation = new OperationInternal(NextLinkOperationImplementation.Create(source, nextLinkOperation), clientDiagnostics, response, "KeyVaultArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + _operation = new OperationInternal( + NextLinkOperationImplementation.Create(source, nextLinkOperation), + clientDiagnostics, + response, + "KeyVaultArmOperation", + null, + new SequentialDelayStrategy()); } - private string GetOperationId(RehydrationToken? rehydrationToken) - { - if (rehydrationToken is null) - { - return null; - } - var data = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json, AzureResourceManagerKeyVaultContext.Default); - using var document = JsonDocument.Parse(data); - var lroDetails = document.RootElement; - return lroDetails.GetProperty("id").GetString(); - } - /// + /// Gets the Id. public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; - /// - public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; - - /// + /// Gets the Value. public override T Value => _operation.Value; - /// + /// Gets the HasValue. public override bool HasValue => _operation.HasValue; - /// + /// Gets the HasCompleted. public override bool HasCompleted => _operation.HasCompleted; - /// + /// The token to rehydrate a long-running operation. + private string GetOperationId(RehydrationToken? rehydrationToken) + { + return rehydrationToken?.Id; + } + + /// + public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; + + /// public override Response GetRawResponse() => _operation.RawResponse; - /// + /// public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); - /// + /// public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); - /// + /// public override Response WaitForCompletion(CancellationToken cancellationToken = default) => _operation.WaitForCompletion(cancellationToken); - /// + /// public override Response WaitForCompletion(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletion(pollingInterval, cancellationToken); - /// + /// public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); - /// + /// public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/LongRunningOperation/KeyVaultOperationSource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/LongRunningOperation/KeyVaultOperationSource.cs index 6765c7c830de..45e1adbc2d6b 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/LongRunningOperation/KeyVaultOperationSource.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/LongRunningOperation/KeyVaultOperationSource.cs @@ -5,32 +5,45 @@ #nullable disable -using System.ClientModel.Primitives; +using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; +using Azure.ResourceManager; namespace Azure.ResourceManager.KeyVault { - internal class KeyVaultOperationSource : IOperationSource + /// + internal partial class KeyVaultOperationSource : IOperationSource { private readonly ArmClient _client; + /// + /// internal KeyVaultOperationSource(ArmClient client) { _client = client; } + /// The response from the service. + /// The cancellation token to use. + /// KeyVaultResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerKeyVaultContext.Default); + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + KeyVaultData data = KeyVaultData.DeserializeKeyVaultData(document.RootElement, ModelSerializationExtensions.WireOptions); return new KeyVaultResource(_client, data); } + /// The response from the service. + /// The cancellation token to use. + /// async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerKeyVaultContext.Default); - return await Task.FromResult(new KeyVaultResource(_client, data)).ConfigureAwait(false); + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + KeyVaultData data = KeyVaultData.DeserializeKeyVaultData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new KeyVaultResource(_client, data); } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/LongRunningOperation/KeyVaultPrivateEndpointConnectionOperationSource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/LongRunningOperation/KeyVaultPrivateEndpointConnectionOperationSource.cs index 9359727f4dc9..3e76f0107f34 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/LongRunningOperation/KeyVaultPrivateEndpointConnectionOperationSource.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/LongRunningOperation/KeyVaultPrivateEndpointConnectionOperationSource.cs @@ -5,32 +5,45 @@ #nullable disable -using System.ClientModel.Primitives; +using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; +using Azure.ResourceManager; namespace Azure.ResourceManager.KeyVault { - internal class KeyVaultPrivateEndpointConnectionOperationSource : IOperationSource + /// + internal partial class KeyVaultPrivateEndpointConnectionOperationSource : IOperationSource { private readonly ArmClient _client; + /// + /// internal KeyVaultPrivateEndpointConnectionOperationSource(ArmClient client) { _client = client; } + /// The response from the service. + /// The cancellation token to use. + /// KeyVaultPrivateEndpointConnectionResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerKeyVaultContext.Default); + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + KeyVaultPrivateEndpointConnectionData data = KeyVaultPrivateEndpointConnectionData.DeserializeKeyVaultPrivateEndpointConnectionData(document.RootElement, ModelSerializationExtensions.WireOptions); return new KeyVaultPrivateEndpointConnectionResource(_client, data); } + /// The response from the service. + /// The cancellation token to use. + /// async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerKeyVaultContext.Default); - return await Task.FromResult(new KeyVaultPrivateEndpointConnectionResource(_client, data)).ConfigureAwait(false); + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + KeyVaultPrivateEndpointConnectionData data = KeyVaultPrivateEndpointConnectionData.DeserializeKeyVaultPrivateEndpointConnectionData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new KeyVaultPrivateEndpointConnectionResource(_client, data); } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/LongRunningOperation/ManagedHsmOperationSource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/LongRunningOperation/ManagedHsmOperationSource.cs index 71d2c886dd89..58a88cb7a197 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/LongRunningOperation/ManagedHsmOperationSource.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/LongRunningOperation/ManagedHsmOperationSource.cs @@ -5,32 +5,45 @@ #nullable disable -using System.ClientModel.Primitives; +using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; +using Azure.ResourceManager; namespace Azure.ResourceManager.KeyVault { - internal class ManagedHsmOperationSource : IOperationSource + /// + internal partial class ManagedHsmOperationSource : IOperationSource { private readonly ArmClient _client; + /// + /// internal ManagedHsmOperationSource(ArmClient client) { _client = client; } + /// The response from the service. + /// The cancellation token to use. + /// ManagedHsmResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerKeyVaultContext.Default); + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + ManagedHsmData data = ManagedHsmData.DeserializeManagedHsmData(document.RootElement, ModelSerializationExtensions.WireOptions); return new ManagedHsmResource(_client, data); } + /// The response from the service. + /// The cancellation token to use. + /// async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerKeyVaultContext.Default); - return await Task.FromResult(new ManagedHsmResource(_client, data)).ConfigureAwait(false); + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + ManagedHsmData data = ManagedHsmData.DeserializeManagedHsmData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new ManagedHsmResource(_client, data); } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/LongRunningOperation/ManagedHsmPrivateEndpointConnectionOperationSource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/LongRunningOperation/ManagedHsmPrivateEndpointConnectionOperationSource.cs index 8995fcc46146..cc4a1d9422e2 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/LongRunningOperation/ManagedHsmPrivateEndpointConnectionOperationSource.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/LongRunningOperation/ManagedHsmPrivateEndpointConnectionOperationSource.cs @@ -5,32 +5,45 @@ #nullable disable -using System.ClientModel.Primitives; +using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; +using Azure.ResourceManager; namespace Azure.ResourceManager.KeyVault { - internal class ManagedHsmPrivateEndpointConnectionOperationSource : IOperationSource + /// + internal partial class ManagedHsmPrivateEndpointConnectionOperationSource : IOperationSource { private readonly ArmClient _client; + /// + /// internal ManagedHsmPrivateEndpointConnectionOperationSource(ArmClient client) { _client = client; } + /// The response from the service. + /// The cancellation token to use. + /// ManagedHsmPrivateEndpointConnectionResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerKeyVaultContext.Default); + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + ManagedHsmPrivateEndpointConnectionData data = ManagedHsmPrivateEndpointConnectionData.DeserializeManagedHsmPrivateEndpointConnectionData(document.RootElement, ModelSerializationExtensions.WireOptions); return new ManagedHsmPrivateEndpointConnectionResource(_client, data); } + /// The response from the service. + /// The cancellation token to use. + /// async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerKeyVaultContext.Default); - return await Task.FromResult(new ManagedHsmPrivateEndpointConnectionResource(_client, data)).ConfigureAwait(false); + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + ManagedHsmPrivateEndpointConnectionData data = ManagedHsmPrivateEndpointConnectionData.DeserializeManagedHsmPrivateEndpointConnectionData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new ManagedHsmPrivateEndpointConnectionResource(_client, data); } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmCollection.cs index 8b9ae9237347..fc5fb1a4824b 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmCollection.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmCollection.cs @@ -8,68 +8,67 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Globalization; +using System.Diagnostics; 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.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 GetManagedHsms 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 GetManagedHsms method from an instance of the parent resource. /// public partial class ManagedHsmCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _managedHsmClientDiagnostics; - private readonly ManagedHsmsRestOperations _managedHsmRestClient; + private readonly ClientDiagnostics _managedHsmsClientDiagnostics; + private readonly ManagedHsms _managedHsmsRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of ManagedHsmCollection for mocking. protected ManagedHsmCollection() { } - /// 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 ManagedHsmCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _managedHsmClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", ManagedHsmResource.ResourceType.Namespace, Diagnostics); TryGetApiVersion(ManagedHsmResource.ResourceType, out string managedHsmApiVersion); - _managedHsmRestClient = new ManagedHsmsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, managedHsmApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + _managedHsmsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", ManagedHsmResource.ResourceType.Namespace, Diagnostics); + _managedHsmsRestClient = new ManagedHsms(_managedHsmsClientDiagnostics, Pipeline, Endpoint, managedHsmApiVersion ?? "2025-05-01"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != ResourceGroupResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), id); + } } /// /// Create or update a managed HSM Pool in the specified subscription. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}. /// /// - /// Operation Id - /// ManagedHsms_CreateOrUpdate + /// Operation Id. + /// ManagedHsms_CreateOrUpdate. /// /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-05-01. /// /// /// @@ -77,21 +76,34 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The name of the managed HSM Pool. /// Parameters to create or update the managed HSM Pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// or is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string name, ManagedHsmData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _managedHsmClientDiagnostics.CreateScope("ManagedHsmCollection.CreateOrUpdate"); + using DiagnosticScope scope = _managedHsmsClientDiagnostics.CreateScope("ManagedHsmCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _managedHsmRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, name, data, cancellationToken).ConfigureAwait(false); - var operation = new KeyVaultArmOperation(new ManagedHsmOperationSource(Client), _managedHsmClientDiagnostics, Pipeline, _managedHsmRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, name, data).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _managedHsmsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, name, ManagedHsmData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + KeyVaultArmOperation operation = new KeyVaultArmOperation( + new ManagedHsmOperationSource(Client), + _managedHsmsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -105,20 +117,16 @@ public virtual async Task> CreateOrUpdateAsync( /// Create or update a managed HSM Pool in the specified subscription. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name} - /// - /// - /// Operation Id - /// ManagedHsms_CreateOrUpdate + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}. /// /// - /// Default Api Version - /// 2025-05-01 + /// Operation Id. + /// ManagedHsms_CreateOrUpdate. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-05-01. /// /// /// @@ -126,21 +134,34 @@ public virtual async Task> CreateOrUpdateAsync( /// The name of the managed HSM Pool. /// Parameters to create or update the managed HSM Pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// or is null. + /// is an empty string, and was expected to be non-empty. public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string name, ManagedHsmData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _managedHsmClientDiagnostics.CreateScope("ManagedHsmCollection.CreateOrUpdate"); + using DiagnosticScope scope = _managedHsmsClientDiagnostics.CreateScope("ManagedHsmCollection.CreateOrUpdate"); scope.Start(); try { - var response = _managedHsmRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, name, data, cancellationToken); - var operation = new KeyVaultArmOperation(new ManagedHsmOperationSource(Client), _managedHsmClientDiagnostics, Pipeline, _managedHsmRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, name, data).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _managedHsmsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, name, ManagedHsmData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + KeyVaultArmOperation operation = new KeyVaultArmOperation( + new ManagedHsmOperationSource(Client), + _managedHsmsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -154,38 +175,42 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitUnt /// Gets the specified managed HSM Pool. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name} - /// - /// - /// Operation Id - /// ManagedHsms_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 managed HSM Pool. /// 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> GetAsync(string name, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _managedHsmClientDiagnostics.CreateScope("ManagedHsmCollection.Get"); + using DiagnosticScope scope = _managedHsmsClientDiagnostics.CreateScope("ManagedHsmCollection.Get"); scope.Start(); try { - var response = await _managedHsmRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _managedHsmsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ManagedHsmData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new ManagedHsmResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -199,38 +224,42 @@ public virtual async Task> GetAsync(string name, Ca /// Gets the specified managed HSM Pool. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name} - /// - /// - /// Operation Id - /// ManagedHsms_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 managed HSM Pool. /// 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 Get(string name, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _managedHsmClientDiagnostics.CreateScope("ManagedHsmCollection.Get"); + using DiagnosticScope scope = _managedHsmsClientDiagnostics.CreateScope("ManagedHsmCollection.Get"); scope.Start(); try { - var response = _managedHsmRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _managedHsmsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ManagedHsmData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new ManagedHsmResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -240,102 +269,80 @@ public virtual Response Get(string name, CancellationToken c } } - /// - /// The List operation gets information about the managed HSM Pools associated with the subscription and within the specified resource group. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs - /// - /// - /// Operation Id - /// ManagedHsms_ListByResourceGroup - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// The List operation gets information about the managed HSM Pools associated with the subscription and within the specified resource group. /// 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 GetAllAsync(int? top = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(int? top = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _managedHsmRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _managedHsmRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, top); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedHsmResource(Client, ManagedHsmData.DeserializeManagedHsmData(e)), _managedHsmClientDiagnostics, Pipeline, "ManagedHsmCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new ManagedHsmsGetByResourceGroupAsyncCollectionResultOfT(_managedHsmsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, top, context), data => new ManagedHsmResource(Client, data)); } - /// - /// The List operation gets information about the managed HSM Pools associated with the subscription and within the specified resource group. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs - /// - /// - /// Operation Id - /// ManagedHsms_ListByResourceGroup - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// The List operation gets information about the managed HSM Pools associated with the subscription and within the specified resource group. /// 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 GetAll(int? top = null, CancellationToken cancellationToken = default) + public virtual Pageable GetAll(int? top = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _managedHsmRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _managedHsmRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, top); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedHsmResource(Client, ManagedHsmData.DeserializeManagedHsmData(e)), _managedHsmClientDiagnostics, Pipeline, "ManagedHsmCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new ManagedHsmsGetByResourceGroupCollectionResultOfT(_managedHsmsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, top, context), data => new ManagedHsmResource(Client, data)); } /// - /// Checks to see if the resource exists in azure. + /// Gets the specified managed HSM Pool. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}. /// /// - /// Operation Id - /// ManagedHsms_Get + /// Operation Id. + /// ManagedHsms_Get. /// /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-05-01. /// /// /// /// The name of the managed HSM Pool. /// 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(string name, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _managedHsmClientDiagnostics.CreateScope("ManagedHsmCollection.Exists"); + using DiagnosticScope scope = _managedHsmsClientDiagnostics.CreateScope("ManagedHsmCollection.Exists"); scope.Start(); try { - var response = await _managedHsmRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _managedHsmsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, 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(ManagedHsmData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ManagedHsmData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -346,39 +353,53 @@ public virtual async Task> ExistsAsync(string name, CancellationT } /// - /// Checks to see if the resource exists in azure. + /// Gets the specified managed HSM Pool. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name} - /// - /// - /// Operation Id - /// ManagedHsms_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 managed HSM Pool. /// 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(string name, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _managedHsmClientDiagnostics.CreateScope("ManagedHsmCollection.Exists"); + using DiagnosticScope scope = _managedHsmsClientDiagnostics.CreateScope("ManagedHsmCollection.Exists"); scope.Start(); try { - var response = _managedHsmRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _managedHsmsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, name, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ManagedHsmData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ManagedHsmData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -389,41 +410,57 @@ public virtual Response Exists(string name, CancellationToken cancellation } /// - /// Tries to get details for this resource from the service. + /// Gets the specified managed HSM Pool. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name} - /// - /// - /// Operation Id - /// ManagedHsms_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 managed HSM Pool. /// 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(string name, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _managedHsmClientDiagnostics.CreateScope("ManagedHsmCollection.GetIfExists"); + using DiagnosticScope scope = _managedHsmsClientDiagnostics.CreateScope("ManagedHsmCollection.GetIfExists"); scope.Start(); try { - var response = await _managedHsmRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _managedHsmsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, 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(ManagedHsmData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ManagedHsmData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new ManagedHsmResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -434,41 +471,57 @@ public virtual async Task> GetIfExistsAsync } /// - /// Tries to get details for this resource from the service. + /// Gets the specified managed HSM Pool. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name} - /// - /// - /// Operation Id - /// ManagedHsms_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 managed HSM Pool. /// 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(string name, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _managedHsmClientDiagnostics.CreateScope("ManagedHsmCollection.GetIfExists"); + using DiagnosticScope scope = _managedHsmsClientDiagnostics.CreateScope("ManagedHsmCollection.GetIfExists"); scope.Start(); try { - var response = _managedHsmRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _managedHsmsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, name, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ManagedHsmData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ManagedHsmData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new ManagedHsmResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -488,6 +541,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } + /// The cancellation token to use. IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmData.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmData.Serialization.cs index ca1ab2a948d4..d88b15646603 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmData.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmData.Serialization.cs @@ -8,19 +8,20 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; 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 ManagedHsmData : IUtf8JsonSerializable, IJsonModel + /// Resource information with extended details. + public partial class ManagedHsmData : 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(); @@ -32,18 +33,38 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOp /// 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(ManagedHsmData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); writer.WriteObjectValue(Properties, options); } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location.Value); + } if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); @@ -52,318 +73,184 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri if (Optional.IsDefined(Identity)) { writer.WritePropertyName("identity"u8); - ((IJsonModel)Identity).Write(writer, ModelSerializationExtensions.WireV3Options); + ((IJsonModel)Identity).Write(writer, options); } } - ManagedHsmData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ManagedHsmData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (ManagedHsmData)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(ManagedHsmData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeManagedHsmData(document.RootElement, options); } - internal static ManagedHsmData DeserializeManagedHsmData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ManagedHsmData DeserializeManagedHsmData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - ManagedHsmProperties properties = default; - ManagedHsmSku sku = default; - ManagedServiceIdentity identity = default; - IDictionary tags = default; - AzureLocation location = 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(); + ManagedHsmProperties properties = default; + IDictionary tags = default; + AzureLocation? location = default; + ManagedHsmSku sku = default; + ManagedServiceIdentity identity = 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 = ManagedHsmProperties.DeserializeManagedHsmProperties(property.Value, options); + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("sku"u8)) + if (prop.NameEquals("name"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - sku = ManagedHsmSku.DeserializeManagedHsmSku(property.Value, options); + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("identity"u8)) + if (prop.NameEquals("systemData"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - identity = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireV3Options, AzureResourceManagerKeyVaultContext.Default); + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerKeyVaultContext.Default); continue; } - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("properties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ManagedHsmProperties.DeserializeManagedHsmProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("tags"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) + foreach (var prop0 in prop.Value.EnumerateObject()) { - dictionary.Add(property0.Name, property0.Value.GetString()); + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } } tags = dictionary; continue; } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("location"u8)) { - location = new AzureLocation(property.Value.GetString()); - continue; - } - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(prop.Value.GetString()); continue; } - if (property.NameEquals("type"u8)) + if (prop.NameEquals("sku"u8)) { - type = new ResourceType(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = ManagedHsmSku.DeserializeManagedHsmSku(prop.Value, options); continue; } - if (property.NameEquals("systemData"u8)) + if (prop.NameEquals("identity"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); + identity = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerKeyVaultContext.Default); 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 ManagedHsmData( id, name, - type, + resourceType, systemData, + additionalBinaryDataProperties, + properties, tags ?? new ChangeTrackingDictionary(), location, - properties, sku, - identity, - serializedAdditionalRawData); + identity); } - 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(Location), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" location: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" location: "); - builder.AppendLine($"'{Location.ToString()}'"); - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Tags), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" tags: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Tags)) - { - if (Tags.Any()) - { - builder.Append(" tags: "); - builder.AppendLine("{"); - foreach (var item in Tags) - { - builder.Append($" '{item.Key}': "); - if (item.Value == null) - { - builder.Append("null"); - continue; - } - if (item.Value.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{item.Value}'''"); - } - else - { - builder.AppendLine($"'{item.Value}'"); - } - } - builder.AppendLine(" }"); - } - } - } - - 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(Sku), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" sku: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Sku)) - { - builder.Append(" sku: "); - BicepSerializationHelpers.AppendChildObject(builder, Sku, options, 2, false, " sku: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Identity), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" identity: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Identity)) - { - builder.Append(" identity: "); - BicepSerializationHelpers.AppendChildObject(builder, Identity, options, 2, false, " identity: "); - } - } - - 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(ManagedHsmData)} does not support writing '{options.Format}' format."); } } - ManagedHsmData 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. + ManagedHsmData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (ManagedHsmData)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 DeserializeManagedHsmData(document.RootElement, options); } default: @@ -371,6 +258,27 @@ ManagedHsmData IPersistableModel.Create(BinaryData data, ModelRe } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(ManagedHsmData managedHsmData) + { + if (managedHsmData == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(managedHsmData, ModelSerializationExtensions.WireOptions); + return content; + } + + /// The to deserialize the from. + internal static ManagedHsmData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeManagedHsmData(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmData.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmData.cs index 9ae105f1588a..d16b4536148e 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmData.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmData.cs @@ -13,80 +13,55 @@ namespace Azure.ResourceManager.KeyVault { - /// - /// A class representing the ManagedHsm data model. - /// Resource information with extended details. - /// - public partial class ManagedHsmData : TrackedResourceData + /// Resource information with extended details. + public partial class ManagedHsmData : 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 . - /// The location. - public ManagedHsmData(AzureLocation location) : base(location) + public ManagedHsmData() { + Tags = new ChangeTrackingDictionary(); } /// 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. + /// Keeps track of any properties unknown to the library. /// Properties of the managed HSM. + /// Resource tags. + /// The geo-location where the resource lives. /// SKU details. /// Managed service identity. - /// Keeps track of any properties unknown to the library. - internal ManagedHsmData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedHsmProperties properties, ManagedHsmSku sku, ManagedServiceIdentity identity, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal ManagedHsmData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, ManagedHsmProperties properties, IDictionary tags, AzureLocation? location, ManagedHsmSku sku, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData) { + _additionalBinaryDataProperties = additionalBinaryDataProperties; Properties = properties; + Tags = tags; + Location = location; Sku = sku; Identity = identity; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ManagedHsmData() - { } /// Properties of the managed HSM. [WirePath("properties")] public ManagedHsmProperties Properties { get; set; } + + /// Resource tags. + [WirePath("tags")] + public IDictionary Tags { get; } + + /// The geo-location where the resource lives. + [WirePath("location")] + public AzureLocation? Location { get; set; } + /// SKU details. [WirePath("sku")] public ManagedHsmSku Sku { get; set; } + /// Managed service identity. [WirePath("identity")] public ManagedServiceIdentity Identity { get; set; } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionCollection.cs index 18033464e994..9e7516fdf46b 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionCollection.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionCollection.cs @@ -8,67 +8,66 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Globalization; +using System.Diagnostics; using System.Threading; using System.Threading.Tasks; -using Autorest.CSharp.Core; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; 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 GetManagedHsmPrivateEndpointConnections 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 GetManagedHsmPrivateEndpointConnections method from an instance of the parent resource. /// public partial class ManagedHsmPrivateEndpointConnectionCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsClientDiagnostics; - private readonly MhsmPrivateEndpointConnectionsRestOperations _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient; + private readonly ClientDiagnostics _mhsmPrivateEndpointConnectionsClientDiagnostics; + private readonly MhsmPrivateEndpointConnections _mhsmPrivateEndpointConnectionsRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of ManagedHsmPrivateEndpointConnectionCollection for mocking. protected ManagedHsmPrivateEndpointConnectionCollection() { } - /// 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 ManagedHsmPrivateEndpointConnectionCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", ManagedHsmPrivateEndpointConnectionResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ManagedHsmPrivateEndpointConnectionResource.ResourceType, out string managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsApiVersion); - _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient = new MhsmPrivateEndpointConnectionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ManagedHsmPrivateEndpointConnectionResource.ResourceType, out string managedHsmPrivateEndpointConnectionApiVersion); + _mhsmPrivateEndpointConnectionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", ManagedHsmPrivateEndpointConnectionResource.ResourceType.Namespace, Diagnostics); + _mhsmPrivateEndpointConnectionsRestClient = new MhsmPrivateEndpointConnections(_mhsmPrivateEndpointConnectionsClientDiagnostics, Pipeline, Endpoint, managedHsmPrivateEndpointConnectionApiVersion ?? "2025-05-01"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != ManagedHsmResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ManagedHsmResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ManagedHsmResource.ResourceType), id); + } } /// /// Updates the specified private endpoint connection associated with the managed hsm pool. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Operation Id - /// MHSMPrivateEndpointConnections_Put + /// Operation Id. + /// MhsmPrivateEndpointConnections_Put. /// /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-05-01. /// /// /// @@ -76,23 +75,31 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// Name of the private endpoint connection associated with the managed hsm pool. /// The intended state of private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// or is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string privateEndpointConnectionName, ManagedHsmPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionCollection.CreateOrUpdate"); + using DiagnosticScope scope = _mhsmPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient.PutAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data, cancellationToken).ConfigureAwait(false); - var uri = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient.CreatePutRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new KeyVaultArmOperation(Response.FromValue(new ManagedHsmPrivateEndpointConnectionResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _mhsmPrivateEndpointConnectionsRestClient.CreatePutRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, ManagedHsmPrivateEndpointConnectionData.ToRequestContent(data), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ManagedHsmPrivateEndpointConnectionData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + KeyVaultArmOperation operation = new KeyVaultArmOperation(Response.FromValue(new ManagedHsmPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -106,20 +113,16 @@ public virtual async Task /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// MHSMPrivateEndpointConnections_Put + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Default Api Version - /// 2025-05-01 + /// Operation Id. + /// MhsmPrivateEndpointConnections_Put. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-05-01. /// /// /// @@ -127,23 +130,31 @@ public virtual async Task Name of the private endpoint connection associated with the managed hsm pool. /// The intended state of private endpoint connection. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// or is null. + /// is an empty string, and was expected to be non-empty. public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string privateEndpointConnectionName, ManagedHsmPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionCollection.CreateOrUpdate"); + using DiagnosticScope scope = _mhsmPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionCollection.CreateOrUpdate"); scope.Start(); try { - var response = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient.Put(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data, cancellationToken); - var uri = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient.CreatePutRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new KeyVaultArmOperation(Response.FromValue(new ManagedHsmPrivateEndpointConnectionResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _mhsmPrivateEndpointConnectionsRestClient.CreatePutRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, ManagedHsmPrivateEndpointConnectionData.ToRequestContent(data), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ManagedHsmPrivateEndpointConnectionData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + KeyVaultArmOperation operation = new KeyVaultArmOperation(Response.FromValue(new ManagedHsmPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -157,38 +168,42 @@ public virtual ArmOperation CreateO /// Gets the specified private endpoint connection associated with the managed HSM Pool. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// MHSMPrivateEndpointConnections_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Default Api Version - /// 2025-05-01 + /// Operation Id. + /// MhsmPrivateEndpointConnections_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-05-01. /// /// /// /// Name of the private endpoint connection associated with the managed hsm pool. /// 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> GetAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - using var scope = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionCollection.Get"); + using DiagnosticScope scope = _mhsmPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionCollection.Get"); scope.Start(); try { - var response = await _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _mhsmPrivateEndpointConnectionsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ManagedHsmPrivateEndpointConnectionData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new ManagedHsmPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -202,38 +217,42 @@ public virtual async Task> /// Gets the specified private endpoint connection associated with the managed HSM Pool. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// MHSMPrivateEndpointConnections_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Default Api Version - /// 2025-05-01 + /// Operation Id. + /// MhsmPrivateEndpointConnections_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-05-01. /// /// /// /// Name of the private endpoint connection associated with the managed hsm pool. /// 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 Get(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - using var scope = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionCollection.Get"); + using DiagnosticScope scope = _mhsmPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionCollection.Get"); scope.Start(); try { - var response = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _mhsmPrivateEndpointConnectionsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ManagedHsmPrivateEndpointConnectionData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new ManagedHsmPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -243,100 +262,78 @@ public virtual Response Get(string } } - /// - /// The List operation gets information about the private endpoint connections associated with the managed HSM Pool. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections - /// - /// - /// Operation Id - /// MHSMPrivateEndpointConnections_ListByResource - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// The List operation gets information about the private endpoint connections associated with the managed HSM Pool. /// 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 GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient.CreateListByResourceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient.CreateListByResourceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedHsmPrivateEndpointConnectionResource(Client, ManagedHsmPrivateEndpointConnectionData.DeserializeManagedHsmPrivateEndpointConnectionData(e)), _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsClientDiagnostics, Pipeline, "ManagedHsmPrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new MhsmPrivateEndpointConnectionsGetByResourceAsyncCollectionResultOfT(_mhsmPrivateEndpointConnectionsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context), data => new ManagedHsmPrivateEndpointConnectionResource(Client, data)); } - /// - /// The List operation gets information about the private endpoint connections associated with the managed HSM Pool. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections - /// - /// - /// Operation Id - /// MHSMPrivateEndpointConnections_ListByResource - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// The List operation gets information about the private endpoint connections associated with the managed HSM Pool. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient.CreateListByResourceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient.CreateListByResourceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedHsmPrivateEndpointConnectionResource(Client, ManagedHsmPrivateEndpointConnectionData.DeserializeManagedHsmPrivateEndpointConnectionData(e)), _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsClientDiagnostics, Pipeline, "ManagedHsmPrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new MhsmPrivateEndpointConnectionsGetByResourceCollectionResultOfT(_mhsmPrivateEndpointConnectionsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context), data => new ManagedHsmPrivateEndpointConnectionResource(Client, data)); } /// - /// Checks to see if the resource exists in azure. + /// Gets the specified private endpoint connection associated with the managed HSM Pool. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Operation Id - /// MHSMPrivateEndpointConnections_Get + /// Operation Id. + /// MhsmPrivateEndpointConnections_Get. /// /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-05-01. /// /// /// /// Name of the private endpoint connection associated with the managed hsm pool. /// 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(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - using var scope = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionCollection.Exists"); + using DiagnosticScope scope = _mhsmPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionCollection.Exists"); scope.Start(); try { - var response = await _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _mhsmPrivateEndpointConnectionsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ManagedHsmPrivateEndpointConnectionData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ManagedHsmPrivateEndpointConnectionData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -347,39 +344,53 @@ public virtual async Task> ExistsAsync(string privateEndpointConn } /// - /// Checks to see if the resource exists in azure. + /// Gets the specified private endpoint connection associated with the managed HSM Pool. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// MHSMPrivateEndpointConnections_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Default Api Version - /// 2025-05-01 + /// Operation Id. + /// MhsmPrivateEndpointConnections_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-05-01. /// /// /// /// Name of the private endpoint connection associated with the managed hsm pool. /// 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(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - using var scope = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionCollection.Exists"); + using DiagnosticScope scope = _mhsmPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionCollection.Exists"); scope.Start(); try { - var response = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _mhsmPrivateEndpointConnectionsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ManagedHsmPrivateEndpointConnectionData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ManagedHsmPrivateEndpointConnectionData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -390,41 +401,57 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance } /// - /// Tries to get details for this resource from the service. + /// Gets the specified private endpoint connection associated with the managed HSM Pool. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// MHSMPrivateEndpointConnections_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Default Api Version - /// 2025-05-01 + /// Operation Id. + /// MhsmPrivateEndpointConnections_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-05-01. /// /// /// /// Name of the private endpoint connection associated with the managed hsm pool. /// 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(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - using var scope = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionCollection.GetIfExists"); + using DiagnosticScope scope = _mhsmPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionCollection.GetIfExists"); scope.Start(); try { - var response = await _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _mhsmPrivateEndpointConnectionsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ManagedHsmPrivateEndpointConnectionData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ManagedHsmPrivateEndpointConnectionData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new ManagedHsmPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -435,41 +462,57 @@ public virtual async Task - /// Tries to get details for this resource from the service. + /// Gets the specified private endpoint connection associated with the managed HSM Pool. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// MHSMPrivateEndpointConnections_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Default Api Version - /// 2025-05-01 + /// Operation Id. + /// MhsmPrivateEndpointConnections_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-05-01. /// /// /// /// Name of the private endpoint connection associated with the managed hsm pool. /// 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(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - using var scope = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionCollection.GetIfExists"); + using DiagnosticScope scope = _mhsmPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionCollection.GetIfExists"); scope.Start(); try { - var response = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _mhsmPrivateEndpointConnectionsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ManagedHsmPrivateEndpointConnectionData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ManagedHsmPrivateEndpointConnectionData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new ManagedHsmPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -489,6 +532,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } + /// The cancellation token to use. IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionData.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionData.Serialization.cs index a982f188c4b0..829088672cf7 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionData.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionData.Serialization.cs @@ -8,20 +8,20 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.KeyVault.Models; using Azure.ResourceManager.Models; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.KeyVault { - public partial class ManagedHsmPrivateEndpointConnectionData : IUtf8JsonSerializable, IJsonModel + /// Private endpoint connection resource. + public partial class ManagedHsmPrivateEndpointConnectionData : 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(); @@ -33,13 +33,38 @@ void IJsonModel.Write(Utf8JsonWriter wr /// 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(ManagedHsmPrivateEndpointConnectionData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location.Value); + } if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); @@ -48,439 +73,200 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri if (Optional.IsDefined(Identity)) { writer.WritePropertyName("identity"u8); - ((IJsonModel)Identity).Write(writer, ModelSerializationExtensions.WireV3Options); + ((IJsonModel)Identity).Write(writer, options); } if (Optional.IsDefined(ETag)) { writer.WritePropertyName("etag"u8); writer.WriteStringValue(ETag.Value.ToString()); } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(PrivateEndpoint)) - { - writer.WritePropertyName("privateEndpoint"u8); - ((IJsonModel)PrivateEndpoint).Write(writer, options); - } - if (Optional.IsDefined(PrivateLinkServiceConnectionState)) - { - writer.WritePropertyName("privateLinkServiceConnectionState"u8); - writer.WriteObjectValue(PrivateLinkServiceConnectionState, options); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); - } - writer.WriteEndObject(); } - ManagedHsmPrivateEndpointConnectionData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ManagedHsmPrivateEndpointConnectionData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (ManagedHsmPrivateEndpointConnectionData)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(ManagedHsmPrivateEndpointConnectionData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeManagedHsmPrivateEndpointConnectionData(document.RootElement, options); } - internal static ManagedHsmPrivateEndpointConnectionData DeserializeManagedHsmPrivateEndpointConnectionData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ManagedHsmPrivateEndpointConnectionData DeserializeManagedHsmPrivateEndpointConnectionData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - ManagedHsmSku sku = default; - ManagedServiceIdentity identity = default; - ETag? etag = default; - IDictionary tags = default; - AzureLocation location = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - SubResource privateEndpoint = default; - ManagedHsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState = default; - ManagedHsmPrivateEndpointConnectionProvisioningState? provisioningState = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + ManagedHsmPrivateEndpointConnectionProperties properties = default; + IDictionary tags = default; + AzureLocation? location = default; + ManagedHsmSku sku = default; + ManagedServiceIdentity identity = default; + ETag? eTag = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("sku"u8)) + if (prop.NameEquals("id"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - sku = ManagedHsmSku.DeserializeManagedHsmSku(property.Value, options); + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("identity"u8)) + if (prop.NameEquals("systemData"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - identity = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireV3Options, AzureResourceManagerKeyVaultContext.Default); + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerKeyVaultContext.Default); continue; } - if (property.NameEquals("etag"u8)) + if (prop.NameEquals("properties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - etag = new ETag(property.Value.GetString()); + properties = ManagedHsmPrivateEndpointConnectionProperties.DeserializeManagedHsmPrivateEndpointConnectionProperties(prop.Value, options); continue; } - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) + foreach (var prop0 in prop.Value.EnumerateObject()) { - dictionary.Add(property0.Name, property0.Value.GetString()); + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } } tags = dictionary; continue; } - if (property.NameEquals("location"u8)) - { - location = new AzureLocation(property.Value.GetString()); - continue; - } - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("location"u8)) { - name = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(prop.Value.GetString()); continue; } - if (property.NameEquals("type"u8)) + if (prop.NameEquals("sku"u8)) { - type = new ResourceType(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = ManagedHsmSku.DeserializeManagedHsmSku(prop.Value, options); continue; } - if (property.NameEquals("systemData"u8)) + if (prop.NameEquals("identity"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); + identity = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerKeyVaultContext.Default); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("etag"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("privateEndpoint"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - privateEndpoint = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property0.Value.GetRawText())), options, AzureResourceManagerKeyVaultContext.Default); - continue; - } - if (property0.NameEquals("privateLinkServiceConnectionState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - privateLinkServiceConnectionState = ManagedHsmPrivateLinkServiceConnectionState.DeserializeManagedHsmPrivateLinkServiceConnectionState(property0.Value, options); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new ManagedHsmPrivateEndpointConnectionProvisioningState(property0.Value.GetString()); - continue; - } - } + eTag = new ETag(prop.Value.GetString()); 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 ManagedHsmPrivateEndpointConnectionData( id, name, - type, + resourceType, systemData, + additionalBinaryDataProperties, + properties, tags ?? new ChangeTrackingDictionary(), location, sku, identity, - etag, - privateEndpoint, - privateLinkServiceConnectionState, - provisioningState, - serializedAdditionalRawData); + eTag); } - 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(Location), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" location: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" location: "); - builder.AppendLine($"'{Location.ToString()}'"); - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Tags), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" tags: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Tags)) - { - if (Tags.Any()) - { - builder.Append(" tags: "); - builder.AppendLine("{"); - foreach (var item in Tags) - { - builder.Append($" '{item.Key}': "); - if (item.Value == null) - { - builder.Append("null"); - continue; - } - if (item.Value.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{item.Value}'''"); - } - else - { - builder.AppendLine($"'{item.Value}'"); - } - } - builder.AppendLine(" }"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Sku), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" sku: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Sku)) - { - builder.Append(" sku: "); - BicepSerializationHelpers.AppendChildObject(builder, Sku, options, 2, false, " sku: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Identity), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" identity: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Identity)) - { - builder.Append(" identity: "); - BicepSerializationHelpers.AppendChildObject(builder, Identity, options, 2, false, " identity: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ETag), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" etag: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ETag)) - { - builder.Append(" etag: "); - builder.AppendLine($"'{ETag.Value.ToString()}'"); - } - } - - 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.Append(" properties:"); - builder.AppendLine(" {"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("PrivateEndpointId", out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" privateEndpoint: "); - builder.AppendLine("{"); - builder.AppendLine(" privateEndpoint: {"); - builder.Append(" id: "); - builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - builder.AppendLine(" }"); - } - else - { - if (Optional.IsDefined(PrivateEndpoint)) - { - builder.Append(" privateEndpoint: "); - BicepSerializationHelpers.AppendChildObject(builder, PrivateEndpoint, options, 4, false, " privateEndpoint: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PrivateLinkServiceConnectionState), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" privateLinkServiceConnectionState: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PrivateLinkServiceConnectionState)) - { - builder.Append(" privateLinkServiceConnectionState: "); - BicepSerializationHelpers.AppendChildObject(builder, PrivateLinkServiceConnectionState, options, 4, false, " privateLinkServiceConnectionState: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" provisioningState: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ProvisioningState)) - { - builder.Append(" provisioningState: "); - builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); - } - } - - builder.AppendLine(" }"); - 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(ManagedHsmPrivateEndpointConnectionData)} does not support writing '{options.Format}' format."); } } - ManagedHsmPrivateEndpointConnectionData 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. + ManagedHsmPrivateEndpointConnectionData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (ManagedHsmPrivateEndpointConnectionData)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 DeserializeManagedHsmPrivateEndpointConnectionData(document.RootElement, options); } default: @@ -488,6 +274,27 @@ ManagedHsmPrivateEndpointConnectionData IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(ManagedHsmPrivateEndpointConnectionData managedHsmPrivateEndpointConnectionData) + { + if (managedHsmPrivateEndpointConnectionData == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(managedHsmPrivateEndpointConnectionData, ModelSerializationExtensions.WireOptions); + return content; + } + + /// The to deserialize the from. + internal static ManagedHsmPrivateEndpointConnectionData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeManagedHsmPrivateEndpointConnectionData(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionData.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionData.cs index cf2ef8f0f544..ac74a0a373ef 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionData.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionData.cs @@ -7,110 +7,108 @@ using System; using System.Collections.Generic; +using Azure; using Azure.Core; using Azure.ResourceManager.KeyVault.Models; using Azure.ResourceManager.Models; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.KeyVault { - /// - /// A class representing the ManagedHsmPrivateEndpointConnection data model. - /// Private endpoint connection resource. - /// - public partial class ManagedHsmPrivateEndpointConnectionData : TrackedResourceData + /// Private endpoint connection resource. + public partial class ManagedHsmPrivateEndpointConnectionData : 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 . - /// The location. - public ManagedHsmPrivateEndpointConnectionData(AzureLocation location) : base(location) + public ManagedHsmPrivateEndpointConnectionData() { + Tags = new ChangeTrackingDictionary(); } /// 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. + /// Keeps track of any properties unknown to the library. + /// Resource properties. + /// 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. - /// Properties of the private endpoint object. - /// Approval state of the private link connection. - /// Provisioning state of the private endpoint connection. - /// Keeps track of any properties unknown to the library. - internal ManagedHsmPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedHsmSku sku, ManagedServiceIdentity identity, ETag? etag, SubResource privateEndpoint, ManagedHsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState, ManagedHsmPrivateEndpointConnectionProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + /// Modified whenever there is a change in the state of private endpoint connection. + internal ManagedHsmPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, ManagedHsmPrivateEndpointConnectionProperties properties, IDictionary tags, AzureLocation? location, ManagedHsmSku sku, ManagedServiceIdentity identity, ETag? eTag) : base(id, name, resourceType, systemData) { + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; + Tags = tags; + Location = location; Sku = sku; Identity = identity; - ETag = etag; - PrivateEndpoint = privateEndpoint; - PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; - ProvisioningState = provisioningState; - _serializedAdditionalRawData = serializedAdditionalRawData; + ETag = eTag; } - /// Initializes a new instance of for deserialization. - internal ManagedHsmPrivateEndpointConnectionData() - { - } + /// Resource properties. + [WirePath("properties")] + internal ManagedHsmPrivateEndpointConnectionProperties Properties { get; set; } + + /// Resource tags. + [WirePath("tags")] + public IDictionary Tags { get; } + + /// The geo-location where the resource lives. + [WirePath("location")] + public AzureLocation? Location { get; set; } /// SKU details. [WirePath("sku")] public ManagedHsmSku Sku { get; set; } + /// Managed service identity. [WirePath("identity")] public ManagedServiceIdentity Identity { get; set; } + /// Modified whenever there is a change in the state of private endpoint connection. [WirePath("etag")] public ETag? ETag { get; set; } - /// Properties of the private endpoint object. - internal SubResource PrivateEndpoint { get; set; } - /// Gets Id. - [WirePath("properties.privateEndpoint.id")] - public ResourceIdentifier PrivateEndpointId - { - get => PrivateEndpoint is null ? default : PrivateEndpoint.Id; - } /// Approval state of the private link connection. [WirePath("properties.privateLinkServiceConnectionState")] - public ManagedHsmPrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get; set; } + public ManagedHsmPrivateLinkServiceConnectionState PrivateLinkServiceConnectionState + { + get + { + return Properties is null ? default : Properties.PrivateLinkServiceConnectionState; + } + set + { + if (Properties is null) + { + Properties = new ManagedHsmPrivateEndpointConnectionProperties(); + } + Properties.PrivateLinkServiceConnectionState = value; + } + } + /// Provisioning state of the private endpoint connection. [WirePath("properties.provisioningState")] - public ManagedHsmPrivateEndpointConnectionProvisioningState? ProvisioningState { get; } + public ManagedHsmPrivateEndpointConnectionProvisioningState? ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + + /// Full identifier of the private endpoint resource. + [WirePath("properties.privateEndpoint.id")] + public string PrivateEndpointId + { + get + { + return Properties is null ? default : Properties.PrivateEndpointId; + } + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionResource.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionResource.Serialization.cs index 28fd38a2659b..5bbb50eec31e 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionResource.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.KeyVault { + /// public partial class ManagedHsmPrivateEndpointConnectionResource : IJsonModel { - private static ManagedHsmPrivateEndpointConnectionData s_dataDeserializationInstance; - private static ManagedHsmPrivateEndpointConnectionData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new ManagedHsmPrivateEndpointConnectionData(); + + /// 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); - ManagedHsmPrivateEndpointConnectionData 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. + ManagedHsmPrivateEndpointConnectionData 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. ManagedHsmPrivateEndpointConnectionData 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/ManagedHsmPrivateEndpointConnectionResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionResource.cs index 0e985793511b..f760bc4638f2 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionResource.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionResource.cs @@ -7,46 +7,36 @@ using System; using System.Collections.Generic; -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 ManagedHsmPrivateEndpointConnection 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 GetManagedHsmPrivateEndpointConnectionResource method. - /// Otherwise you can get one from its parent resource using the GetManagedHsmPrivateEndpointConnection method. + /// A class representing a ManagedHsmPrivateEndpointConnection 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 GetManagedHsmPrivateEndpointConnections method. /// public partial class ManagedHsmPrivateEndpointConnectionResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The name. - /// The privateEndpointConnectionName. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string privateEndpointConnectionName) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsClientDiagnostics; - private readonly MhsmPrivateEndpointConnectionsRestOperations _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient; + private readonly ClientDiagnostics _mhsmPrivateEndpointConnectionsClientDiagnostics; + private readonly MhsmPrivateEndpointConnections _mhsmPrivateEndpointConnectionsRestClient; private readonly ManagedHsmPrivateEndpointConnectionData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.KeyVault/managedHSMs/privateEndpointConnections"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of ManagedHsmPrivateEndpointConnectionResource for mocking. protected ManagedHsmPrivateEndpointConnectionResource() { } - /// 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 ManagedHsmPrivateEndpointConnectionResource(ArmClient client, ManagedHsmPrivateEndpointConnectionData data) : this(client, data.Id) @@ -55,71 +45,93 @@ internal ManagedHsmPrivateEndpointConnectionResource(ArmClient client, ManagedHs _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 ManagedHsmPrivateEndpointConnectionResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsApiVersion); - _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient = new MhsmPrivateEndpointConnectionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ResourceType, out string managedHsmPrivateEndpointConnectionApiVersion); + _mhsmPrivateEndpointConnectionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", ResourceType.Namespace, Diagnostics); + _mhsmPrivateEndpointConnectionsRestClient = new MhsmPrivateEndpointConnections(_mhsmPrivateEndpointConnectionsClientDiagnostics, Pipeline, Endpoint, managedHsmPrivateEndpointConnectionApiVersion ?? "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 ManagedHsmPrivateEndpointConnectionData 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 resourceGroupName. + /// The name. + /// The privateEndpointConnectionName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string privateEndpointConnectionName) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}"; + 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 private endpoint connection associated with the managed HSM Pool. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Operation Id - /// MHSMPrivateEndpointConnections_Get + /// Operation Id. + /// MhsmPrivateEndpointConnections_Get. /// /// - /// 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) { - using var scope = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionResource.Get"); + using DiagnosticScope scope = _mhsmPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionResource.Get"); scope.Start(); try { - var response = await _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _mhsmPrivateEndpointConnectionsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ManagedHsmPrivateEndpointConnectionData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new ManagedHsmPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -133,33 +145,41 @@ public virtual async Task> /// Gets the specified private endpoint connection associated with the managed HSM Pool. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Operation Id - /// MHSMPrivateEndpointConnections_Get + /// Operation Id. + /// MhsmPrivateEndpointConnections_Get. /// /// - /// 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) { - using var scope = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionResource.Get"); + using DiagnosticScope scope = _mhsmPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionResource.Get"); scope.Start(); try { - var response = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _mhsmPrivateEndpointConnectionsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ManagedHsmPrivateEndpointConnectionData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new ManagedHsmPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -173,20 +193,20 @@ public virtual Response Get(Cancell /// Deletes the specified private endpoint connection associated with the managed hsm pool. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Operation Id - /// MHSMPrivateEndpointConnections_Delete + /// Operation Id. + /// MhsmPrivateEndpointConnections_Delete. /// /// - /// Default Api Version - /// 2025-05-01 + /// Default Api Version. + /// 2025-05-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -194,14 +214,27 @@ public virtual Response Get(Cancell /// The cancellation token to use. public virtual async Task> DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionResource.Delete"); + using DiagnosticScope scope = _mhsmPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionResource.Delete"); scope.Start(); try { - var response = await _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new KeyVaultArmOperation(new ManagedHsmPrivateEndpointConnectionOperationSource(Client), _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsClientDiagnostics, Pipeline, _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _mhsmPrivateEndpointConnectionsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + KeyVaultArmOperation operation = new KeyVaultArmOperation( + new ManagedHsmPrivateEndpointConnectionOperationSource(Client), + _mhsmPrivateEndpointConnectionsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -215,20 +248,20 @@ public virtual async Task /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Operation Id - /// MHSMPrivateEndpointConnections_Delete + /// Operation Id. + /// MhsmPrivateEndpointConnections_Delete. /// /// - /// Default Api Version - /// 2025-05-01 + /// Default Api Version. + /// 2025-05-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -236,14 +269,27 @@ public virtual async Task The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionResource.Delete"); + using DiagnosticScope scope = _mhsmPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionResource.Delete"); scope.Start(); try { - var response = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new KeyVaultArmOperation(new ManagedHsmPrivateEndpointConnectionOperationSource(Client), _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsClientDiagnostics, Pipeline, _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _mhsmPrivateEndpointConnectionsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + KeyVaultArmOperation operation = new KeyVaultArmOperation( + new ManagedHsmPrivateEndpointConnectionOperationSource(Client), + _mhsmPrivateEndpointConnectionsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -257,20 +303,20 @@ public virtual ArmOperation Delete( /// Updates the specified private endpoint connection associated with the managed hsm pool. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Operation Id - /// MHSMPrivateEndpointConnections_Put + /// Operation Id. + /// MhsmPrivateEndpointConnections_Put. /// /// - /// Default Api Version - /// 2025-05-01 + /// Default Api Version. + /// 2025-05-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -282,16 +328,24 @@ public virtual async Task(Response.FromValue(new ManagedHsmPrivateEndpointConnectionResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _mhsmPrivateEndpointConnectionsRestClient.CreatePutRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, ManagedHsmPrivateEndpointConnectionData.ToRequestContent(data), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ManagedHsmPrivateEndpointConnectionData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + KeyVaultArmOperation operation = new KeyVaultArmOperation(Response.FromValue(new ManagedHsmPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -305,20 +359,20 @@ public virtual async Task /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}. /// /// - /// Operation Id - /// MHSMPrivateEndpointConnections_Put + /// Operation Id. + /// MhsmPrivateEndpointConnections_Put. /// /// - /// Default Api Version - /// 2025-05-01 + /// Default Api Version. + /// 2025-05-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -330,16 +384,24 @@ public virtual ArmOperation Update( { Argument.AssertNotNull(data, nameof(data)); - using var scope = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionResource.Update"); + using DiagnosticScope scope = _mhsmPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionResource.Update"); scope.Start(); try { - var response = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient.Put(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); - var uri = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient.CreatePutRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new KeyVaultArmOperation(Response.FromValue(new ManagedHsmPrivateEndpointConnectionResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _mhsmPrivateEndpointConnectionsRestClient.CreatePutRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, ManagedHsmPrivateEndpointConnectionData.ToRequestContent(data), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ManagedHsmPrivateEndpointConnectionData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + KeyVaultArmOperation operation = new KeyVaultArmOperation(Response.FromValue(new ManagedHsmPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -349,27 +411,7 @@ public virtual ArmOperation Update( } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// MHSMPrivateEndpointConnections_Get - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -379,23 +421,29 @@ public virtual async Task> Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionResource.AddTag"); + using DiagnosticScope scope = _mhsmPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionResource.AddTag"); scope.Start(); try { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) { - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + Response 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 _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ManagedHsmPrivateEndpointConnectionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _mhsmPrivateEndpointConnectionsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ManagedHsmPrivateEndpointConnectionData.FromResponse(result), result); + return Response.FromValue(new ManagedHsmPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + ManagedHsmPrivateEndpointConnectionData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; current.Tags[key] = value; - var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + ArmOperation result = await this.UpdateAsync(WaitUntil.Completed, current, cancellationToken).ConfigureAwait(false); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -406,27 +454,7 @@ public virtual async Task> } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// MHSMPrivateEndpointConnections_Get - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -436,23 +464,29 @@ public virtual Response AddTag(stri Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionResource.AddTag"); + using DiagnosticScope scope = _mhsmPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionResource.AddTag"); scope.Start(); try { - if (CanUseTagResource(cancellationToken: cancellationToken)) + if (CanUseTagResource(cancellationToken)) { - var originalTags = GetTagResource().Get(cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues[key] = value; - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return Response.FromValue(new ManagedHsmPrivateEndpointConnectionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _mhsmPrivateEndpointConnectionsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ManagedHsmPrivateEndpointConnectionData.FromResponse(result), result); + return Response.FromValue(new ManagedHsmPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; + ManagedHsmPrivateEndpointConnectionData current = Get(cancellationToken: cancellationToken).Value.Data; current.Tags[key] = value; - var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + ArmOperation result = this.Update(WaitUntil.Completed, current, cancellationToken); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -463,52 +497,38 @@ public virtual Response AddTag(stri } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// MHSMPrivateEndpointConnections_Get - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. /// The cancellation token to use. /// is null. public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionResource.SetTags"); + using DiagnosticScope scope = _mhsmPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionResource.SetTags"); scope.Start(); try { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) { - await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken).ConfigureAwait(false); + Response 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 _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ManagedHsmPrivateEndpointConnectionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _mhsmPrivateEndpointConnectionsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ManagedHsmPrivateEndpointConnectionData.FromResponse(result), result); + return Response.FromValue(new ManagedHsmPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + ManagedHsmPrivateEndpointConnectionData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; current.Tags.ReplaceWith(tags); - var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + ArmOperation result = await this.UpdateAsync(WaitUntil.Completed, current, cancellationToken).ConfigureAwait(false); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -519,52 +539,38 @@ public virtual async Task> } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// MHSMPrivateEndpointConnections_Get - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. /// The cancellation token to use. /// is null. public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionResource.SetTags"); + using DiagnosticScope scope = _mhsmPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionResource.SetTags"); scope.Start(); try { - if (CanUseTagResource(cancellationToken: cancellationToken)) + if (CanUseTagResource(cancellationToken)) { - GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); - var originalTags = GetTagResource().Get(cancellationToken); + GetTagResource().Delete(WaitUntil.Completed, cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues.ReplaceWith(tags); - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return Response.FromValue(new ManagedHsmPrivateEndpointConnectionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _mhsmPrivateEndpointConnectionsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ManagedHsmPrivateEndpointConnectionData.FromResponse(result), result); + return Response.FromValue(new ManagedHsmPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; + ManagedHsmPrivateEndpointConnectionData current = Get(cancellationToken: cancellationToken).Value.Data; current.Tags.ReplaceWith(tags); - var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + ArmOperation result = this.Update(WaitUntil.Completed, current, cancellationToken); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -575,27 +581,7 @@ public virtual Response SetTags(IDi } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// MHSMPrivateEndpointConnections_Get - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -603,23 +589,29 @@ public virtual async Task> { Argument.AssertNotNull(key, nameof(key)); - using var scope = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionResource.RemoveTag"); + using DiagnosticScope scope = _mhsmPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionResource.RemoveTag"); scope.Start(); try { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) { - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + Response 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 _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ManagedHsmPrivateEndpointConnectionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _mhsmPrivateEndpointConnectionsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ManagedHsmPrivateEndpointConnectionData.FromResponse(result), result); + return Response.FromValue(new ManagedHsmPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + ManagedHsmPrivateEndpointConnectionData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; current.Tags.Remove(key); - var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + ArmOperation result = await this.UpdateAsync(WaitUntil.Completed, current, cancellationToken).ConfigureAwait(false); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -630,27 +622,7 @@ public virtual async Task> } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// MHSMPrivateEndpointConnections_Get - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -658,23 +630,29 @@ public virtual Response RemoveTag(s { Argument.AssertNotNull(key, nameof(key)); - using var scope = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionResource.RemoveTag"); + using DiagnosticScope scope = _mhsmPrivateEndpointConnectionsClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionResource.RemoveTag"); scope.Start(); try { - if (CanUseTagResource(cancellationToken: cancellationToken)) + if (CanUseTagResource(cancellationToken)) { - var originalTags = GetTagResource().Get(cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues.Remove(key); - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _managedHsmPrivateEndpointConnectionMHSMPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return Response.FromValue(new ManagedHsmPrivateEndpointConnectionResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _mhsmPrivateEndpointConnectionsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ManagedHsmPrivateEndpointConnectionData.FromResponse(result), result); + return Response.FromValue(new ManagedHsmPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; + ManagedHsmPrivateEndpointConnectionData current = Get(cancellationToken: cancellationToken).Value.Data; current.Tags.Remove(key); - var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + ArmOperation result = this.Update(WaitUntil.Completed, current, cancellationToken); return Response.FromValue(result.Value, result.GetRawResponse()); } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmResource.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmResource.Serialization.cs index 3d5e0982970a..45f4e25e76f5 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmResource.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.KeyVault { + /// public partial class ManagedHsmResource : IJsonModel { - private static ManagedHsmData s_dataDeserializationInstance; - private static ManagedHsmData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new ManagedHsmData(); + + /// 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); - ManagedHsmData 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. + ManagedHsmData 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. ManagedHsmData 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/ManagedHsmResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmResource.cs index b1a2dcabee76..38306ddfaa1a 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmResource.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmResource.cs @@ -7,52 +7,37 @@ using System; using System.Collections.Generic; -using System.Globalization; +using System.Diagnostics; 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.Models; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.KeyVault { /// - /// A Class representing a ManagedHsm 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 GetManagedHsmResource method. - /// Otherwise you can get one from its parent resource using the GetManagedHsm method. + /// A class representing a ManagedHsm 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 GetManagedHsms method. /// public partial class ManagedHsmResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The name. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _managedHsmClientDiagnostics; - private readonly ManagedHsmsRestOperations _managedHsmRestClient; - private readonly ClientDiagnostics _mhsmPrivateLinkResourcesClientDiagnostics; - private readonly MhsmPrivateLinkResourcesRestOperations _mhsmPrivateLinkResourcesRestClient; - private readonly ClientDiagnostics _mhsmRegionsClientDiagnostics; - private readonly MhsmRegionsRestOperations _mhsmRegionsRestClient; + private readonly ClientDiagnostics _managedHsmsClientDiagnostics; + private readonly ManagedHsms _managedHsmsRestClient; private readonly ManagedHsmData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.KeyVault/managedHSMs"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of ManagedHsmResource for mocking. protected ManagedHsmResource() { } - /// 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 ManagedHsmResource(ArmClient client, ManagedHsmData data) : this(client, data.Id) @@ -61,144 +46,92 @@ internal ManagedHsmResource(ArmClient client, ManagedHsmData data) : this(client _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 ManagedHsmResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _managedHsmClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", ResourceType.Namespace, Diagnostics); TryGetApiVersion(ResourceType, out string managedHsmApiVersion); - _managedHsmRestClient = new ManagedHsmsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, managedHsmApiVersion); - _mhsmPrivateLinkResourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _mhsmPrivateLinkResourcesRestClient = new MhsmPrivateLinkResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - _mhsmRegionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _mhsmRegionsRestClient = new MhsmRegionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); -#if DEBUG - ValidateResourceId(Id); -#endif + _managedHsmsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", ResourceType.Namespace, Diagnostics); + _managedHsmsRestClient = new ManagedHsms(_managedHsmsClientDiagnostics, Pipeline, Endpoint, managedHsmApiVersion ?? "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 ManagedHsmData Data { get { if (!HasData) + { throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } return _data; } } - 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)); - } - - /// Gets a collection of ManagedHsmPrivateEndpointConnectionResources in the ManagedHsm. - /// An object representing collection of ManagedHsmPrivateEndpointConnectionResources and their operations over a ManagedHsmPrivateEndpointConnectionResource. - public virtual ManagedHsmPrivateEndpointConnectionCollection GetManagedHsmPrivateEndpointConnections() - { - return GetCachedClient(client => new ManagedHsmPrivateEndpointConnectionCollection(client, Id)); - } - - /// - /// Gets the specified private endpoint connection associated with the managed HSM Pool. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// MHSMPrivateEndpointConnections_Get - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// Name of the private endpoint connection associated with the managed hsm pool. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetManagedHsmPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) { - return await GetManagedHsmPrivateEndpointConnections().GetAsync(privateEndpointConnectionName, cancellationToken).ConfigureAwait(false); + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}"; + return new ResourceIdentifier(resourceId); } - /// - /// Gets the specified private endpoint connection associated with the managed HSM Pool. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// MHSMPrivateEndpointConnections_Get - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// Name of the private endpoint connection associated with the managed hsm pool. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetManagedHsmPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) { - return GetManagedHsmPrivateEndpointConnections().Get(privateEndpointConnectionName, cancellationToken); + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } } /// /// Gets the specified managed HSM Pool. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}. /// /// - /// Operation Id - /// ManagedHsms_Get + /// Operation Id. + /// ManagedHsms_Get. /// /// - /// 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) { - using var scope = _managedHsmClientDiagnostics.CreateScope("ManagedHsmResource.Get"); + using DiagnosticScope scope = _managedHsmsClientDiagnostics.CreateScope("ManagedHsmResource.Get"); scope.Start(); try { - var response = await _managedHsmRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _managedHsmsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ManagedHsmData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new ManagedHsmResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -212,33 +145,41 @@ public virtual async Task> GetAsync(CancellationTok /// Gets the specified managed HSM Pool. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}. /// /// - /// Operation Id - /// ManagedHsms_Get + /// Operation Id. + /// ManagedHsms_Get. /// /// - /// 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) { - using var scope = _managedHsmClientDiagnostics.CreateScope("ManagedHsmResource.Get"); + using DiagnosticScope scope = _managedHsmsClientDiagnostics.CreateScope("ManagedHsmResource.Get"); scope.Start(); try { - var response = _managedHsmRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _managedHsmsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ManagedHsmData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new ManagedHsmResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -249,38 +190,55 @@ public virtual Response Get(CancellationToken cancellationTo } /// - /// Deletes the specified managed HSM Pool. + /// Update a managed HSM Pool in the specified subscription. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}. /// /// - /// Operation Id - /// ManagedHsms_Delete + /// Operation Id. + /// ManagedHsms_Update. /// /// - /// Default Api Version - /// 2025-05-01 + /// Default Api Version. + /// 2025-05-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Parameters to patch the managed HSM Pool. /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ManagedHsmData data, CancellationToken cancellationToken = default) { - using var scope = _managedHsmClientDiagnostics.CreateScope("ManagedHsmResource.Delete"); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _managedHsmsClientDiagnostics.CreateScope("ManagedHsmResource.Update"); scope.Start(); try { - var response = await _managedHsmRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new KeyVaultArmOperation(_managedHsmClientDiagnostics, Pipeline, _managedHsmRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _managedHsmsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, ManagedHsmData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + KeyVaultArmOperation operation = new KeyVaultArmOperation( + new ManagedHsmOperationSource(Client), + _managedHsmsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -291,38 +249,55 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Deletes the specified managed HSM Pool. + /// Update a managed HSM Pool in the specified subscription. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}. /// /// - /// Operation Id - /// ManagedHsms_Delete + /// Operation Id. + /// ManagedHsms_Update. /// /// - /// Default Api Version - /// 2025-05-01 + /// Default Api Version. + /// 2025-05-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Parameters to patch the managed HSM Pool. /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ManagedHsmData data, CancellationToken cancellationToken = default) { - using var scope = _managedHsmClientDiagnostics.CreateScope("ManagedHsmResource.Delete"); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _managedHsmsClientDiagnostics.CreateScope("ManagedHsmResource.Update"); scope.Start(); try { - var response = _managedHsmRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new KeyVaultArmOperation(_managedHsmClientDiagnostics, Pipeline, _managedHsmRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _managedHsmsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, ManagedHsmData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + KeyVaultArmOperation operation = new KeyVaultArmOperation( + new ManagedHsmOperationSource(Client), + _managedHsmsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); + { + operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -333,42 +308,45 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Update a managed HSM Pool in the specified subscription. + /// Deletes the specified managed HSM Pool. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}. /// /// - /// Operation Id - /// ManagedHsms_Update + /// Operation Id. + /// ManagedHsms_Delete. /// /// - /// Default Api Version - /// 2025-05-01 + /// Default Api Version. + /// 2025-05-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Parameters to patch the managed HSM Pool. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, ManagedHsmData data, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _managedHsmClientDiagnostics.CreateScope("ManagedHsmResource.Update"); + using DiagnosticScope scope = _managedHsmsClientDiagnostics.CreateScope("ManagedHsmResource.Delete"); scope.Start(); try { - var response = await _managedHsmRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data, cancellationToken).ConfigureAwait(false); - var operation = new KeyVaultArmOperation(new ManagedHsmOperationSource(Client), _managedHsmClientDiagnostics, Pipeline, _managedHsmRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _managedHsmsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + KeyVaultArmOperation operation = new KeyVaultArmOperation(_managedHsmsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -379,42 +357,45 @@ public virtual async Task> UpdateAsync(WaitUnti } /// - /// Update a managed HSM Pool in the specified subscription. + /// Deletes the specified managed HSM Pool. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}. /// /// - /// Operation Id - /// ManagedHsms_Update + /// Operation Id. + /// ManagedHsms_Delete. /// /// - /// Default Api Version - /// 2025-05-01 + /// Default Api Version. + /// 2025-05-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Parameters to patch the managed HSM Pool. /// The cancellation token to use. - /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, ManagedHsmData data, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _managedHsmClientDiagnostics.CreateScope("ManagedHsmResource.Update"); + using DiagnosticScope scope = _managedHsmsClientDiagnostics.CreateScope("ManagedHsmResource.Delete"); scope.Start(); try { - var response = _managedHsmRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data, cancellationToken); - var operation = new KeyVaultArmOperation(new ManagedHsmOperationSource(Client), _managedHsmClientDiagnostics, Pipeline, _managedHsmRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _managedHsmsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + KeyVaultArmOperation operation = new KeyVaultArmOperation(_managedHsmsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); + { + operation.WaitForCompletionResponse(cancellationToken); + } return operation; } catch (Exception e) @@ -428,125 +409,123 @@ public virtual ArmOperation Update(WaitUntil waitUntil, Mana /// Gets the private link resources supported for the managed hsm pool. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateLinkResources + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateLinkResources. /// /// - /// Operation Id - /// MHSMPrivateLinkResources_ListByManagedHsmResource + /// Operation Id. + /// ManagedHsms_ListByMHSMResource. /// /// - /// Default Api Version - /// 2025-05-01 + /// Default Api Version. + /// 2025-05-01. + /// + /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMHSMPrivateLinkResourcesByManagedHsmResourceAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetPrivateLinkResourcesAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _mhsmPrivateLinkResourcesRestClient.CreateListByManagedHsmResourceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => ManagedHsmPrivateLinkResourceData.DeserializeManagedHsmPrivateLinkResourceData(e), _mhsmPrivateLinkResourcesClientDiagnostics, Pipeline, "ManagedHsmResource.GetMHSMPrivateLinkResourcesByManagedHsmResource", "value", null, cancellationToken); + using DiagnosticScope scope = _managedHsmsClientDiagnostics.CreateScope("ManagedHsmResource.GetPrivateLinkResources"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _managedHsmsRestClient.CreateGetPrivateLinkResourcesRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ManagedHsmPrivateLinkResourceListResult.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// /// Gets the private link resources supported for the managed hsm pool. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateLinkResources + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateLinkResources. + /// + /// + /// Operation Id. + /// ManagedHsms_ListByMHSMResource. /// /// - /// Operation Id - /// MHSMPrivateLinkResources_ListByManagedHsmResource + /// Default Api Version. + /// 2025-05-01. /// /// - /// Default Api Version - /// 2025-05-01 + /// Resource. + /// . /// /// /// /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMHSMPrivateLinkResourcesByManagedHsmResource(CancellationToken cancellationToken = default) + public virtual Response GetPrivateLinkResources(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _mhsmPrivateLinkResourcesRestClient.CreateListByManagedHsmResourceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => ManagedHsmPrivateLinkResourceData.DeserializeManagedHsmPrivateLinkResourceData(e), _mhsmPrivateLinkResourcesClientDiagnostics, Pipeline, "ManagedHsmResource.GetMHSMPrivateLinkResourcesByManagedHsmResource", "value", null, cancellationToken); + using DiagnosticScope scope = _managedHsmsClientDiagnostics.CreateScope("ManagedHsmResource.GetPrivateLinkResources"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _managedHsmsRestClient.CreateGetPrivateLinkResourcesRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ManagedHsmPrivateLinkResourceListResult.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } - /// - /// The List operation gets information about the regions associated with the managed HSM Pool. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/regions - /// - /// - /// Operation Id - /// MHSMRegions_ListByResource - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// + /// The List operation gets information about the regions associated with the managed HSM Pool. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMHSMRegionsByResourceAsync(CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetRegionsAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _mhsmRegionsRestClient.CreateListByResourceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _mhsmRegionsRestClient.CreateListByResourceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => ManagedHsmGeoReplicatedRegion.DeserializeManagedHsmGeoReplicatedRegion(e), _mhsmRegionsClientDiagnostics, Pipeline, "ManagedHsmResource.GetMHSMRegionsByResource", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new ManagedHsmsGetRegionsAsyncCollectionResultOfT(_managedHsmsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); } - /// - /// The List operation gets information about the regions associated with the managed HSM Pool. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/regions - /// - /// - /// Operation Id - /// MHSMRegions_ListByResource - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// + /// The List operation gets information about the regions associated with the managed HSM Pool. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMHSMRegionsByResource(CancellationToken cancellationToken = default) + public virtual Pageable GetRegions(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _mhsmRegionsRestClient.CreateListByResourceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _mhsmRegionsRestClient.CreateListByResourceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => ManagedHsmGeoReplicatedRegion.DeserializeManagedHsmGeoReplicatedRegion(e), _mhsmRegionsClientDiagnostics, Pipeline, "ManagedHsmResource.GetMHSMRegionsByResource", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new ManagedHsmsGetRegionsCollectionResultOfT(_managedHsmsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name} - /// - /// - /// Operation Id - /// ManagedHsms_Get - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -556,28 +535,34 @@ public virtual async Task> AddTagAsync(string key, Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _managedHsmClientDiagnostics.CreateScope("ManagedHsmResource.AddTag"); + using DiagnosticScope scope = _managedHsmsClientDiagnostics.CreateScope("ManagedHsmResource.AddTag"); scope.Start(); try { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) { - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + Response 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 _managedHsmRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ManagedHsmResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _managedHsmsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ManagedHsmData.FromResponse(result), result); + return Response.FromValue(new ManagedHsmResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new ManagedHsmData(current.Location); - foreach (var tag in current.Tags) + ManagedHsmData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + ManagedHsmData patch = new ManagedHsmData(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags[key] = value; - var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -588,27 +573,7 @@ public virtual async Task> AddTagAsync(string key, } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name} - /// - /// - /// Operation Id - /// ManagedHsms_Get - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -618,28 +583,34 @@ public virtual Response AddTag(string key, string value, Can Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _managedHsmClientDiagnostics.CreateScope("ManagedHsmResource.AddTag"); + using DiagnosticScope scope = _managedHsmsClientDiagnostics.CreateScope("ManagedHsmResource.AddTag"); scope.Start(); try { - if (CanUseTagResource(cancellationToken: cancellationToken)) + if (CanUseTagResource(cancellationToken)) { - var originalTags = GetTagResource().Get(cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues[key] = value; - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _managedHsmRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new ManagedHsmResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _managedHsmsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ManagedHsmData.FromResponse(result), result); + return Response.FromValue(new ManagedHsmResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new ManagedHsmData(current.Location); - foreach (var tag in current.Tags) + ManagedHsmData current = Get(cancellationToken: cancellationToken).Value.Data; + ManagedHsmData patch = new ManagedHsmData(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags[key] = value; - var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -650,53 +621,39 @@ public virtual Response AddTag(string key, string value, Can } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name} - /// - /// - /// Operation Id - /// ManagedHsms_Get - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. /// The cancellation token to use. /// is null. public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _managedHsmClientDiagnostics.CreateScope("ManagedHsmResource.SetTags"); + using DiagnosticScope scope = _managedHsmsClientDiagnostics.CreateScope("ManagedHsmResource.SetTags"); scope.Start(); try { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) { - await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken).ConfigureAwait(false); + Response 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 _managedHsmRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ManagedHsmResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _managedHsmsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ManagedHsmData.FromResponse(result), result); + return Response.FromValue(new ManagedHsmResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new ManagedHsmData(current.Location); + ManagedHsmData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + ManagedHsmData patch = new ManagedHsmData(); patch.Tags.ReplaceWith(tags); - var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -707,53 +664,39 @@ public virtual async Task> SetTagsAsync(IDictionary } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name} - /// - /// - /// Operation Id - /// ManagedHsms_Get - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. /// The cancellation token to use. /// is null. public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _managedHsmClientDiagnostics.CreateScope("ManagedHsmResource.SetTags"); + using DiagnosticScope scope = _managedHsmsClientDiagnostics.CreateScope("ManagedHsmResource.SetTags"); scope.Start(); try { - if (CanUseTagResource(cancellationToken: cancellationToken)) + if (CanUseTagResource(cancellationToken)) { - GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); - var originalTags = GetTagResource().Get(cancellationToken); + GetTagResource().Delete(WaitUntil.Completed, cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues.ReplaceWith(tags); - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _managedHsmRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new ManagedHsmResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _managedHsmsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ManagedHsmData.FromResponse(result), result); + return Response.FromValue(new ManagedHsmResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new ManagedHsmData(current.Location); + ManagedHsmData current = Get(cancellationToken: cancellationToken).Value.Data; + ManagedHsmData patch = new ManagedHsmData(); patch.Tags.ReplaceWith(tags); - var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -764,27 +707,7 @@ public virtual Response SetTags(IDictionary } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name} - /// - /// - /// Operation Id - /// ManagedHsms_Get - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -792,28 +715,34 @@ public virtual async Task> RemoveTagAsync(string ke { Argument.AssertNotNull(key, nameof(key)); - using var scope = _managedHsmClientDiagnostics.CreateScope("ManagedHsmResource.RemoveTag"); + using DiagnosticScope scope = _managedHsmsClientDiagnostics.CreateScope("ManagedHsmResource.RemoveTag"); scope.Start(); try { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) { - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + Response 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 _managedHsmRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ManagedHsmResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _managedHsmsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ManagedHsmData.FromResponse(result), result); + return Response.FromValue(new ManagedHsmResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new ManagedHsmData(current.Location); - foreach (var tag in current.Tags) + ManagedHsmData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + ManagedHsmData patch = new ManagedHsmData(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags.Remove(key); - var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -824,27 +753,7 @@ public virtual async Task> RemoveTagAsync(string ke } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name} - /// - /// - /// Operation Id - /// ManagedHsms_Get - /// - /// - /// Default Api Version - /// 2025-05-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -852,28 +761,34 @@ public virtual Response RemoveTag(string key, CancellationTo { Argument.AssertNotNull(key, nameof(key)); - using var scope = _managedHsmClientDiagnostics.CreateScope("ManagedHsmResource.RemoveTag"); + using DiagnosticScope scope = _managedHsmsClientDiagnostics.CreateScope("ManagedHsmResource.RemoveTag"); scope.Start(); try { - if (CanUseTagResource(cancellationToken: cancellationToken)) + if (CanUseTagResource(cancellationToken)) { - var originalTags = GetTagResource().Get(cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues.Remove(key); - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _managedHsmRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new ManagedHsmResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _managedHsmsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ManagedHsmData.FromResponse(result), result); + return Response.FromValue(new ManagedHsmResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new ManagedHsmData(current.Location); - foreach (var tag in current.Tags) + ManagedHsmData current = Get(cancellationToken: cancellationToken).Value.Data; + ManagedHsmData patch = new ManagedHsmData(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags.Remove(key); - var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -883,5 +798,38 @@ public virtual Response RemoveTag(string key, CancellationTo throw; } } + + /// Gets a collection of ManagedHsmPrivateEndpointConnections in the . + /// An object representing collection of ManagedHsmPrivateEndpointConnections and their operations over a ManagedHsmPrivateEndpointConnectionResource. + public virtual ManagedHsmPrivateEndpointConnectionCollection GetManagedHsmPrivateEndpointConnections() + { + return GetCachedClient(client => new ManagedHsmPrivateEndpointConnectionCollection(client, Id)); + } + + /// Gets the specified private endpoint connection associated with the managed HSM Pool. + /// Name of the private endpoint connection associated with the managed hsm pool. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetManagedHsmPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + return await GetManagedHsmPrivateEndpointConnections().GetAsync(privateEndpointConnectionName, cancellationToken).ConfigureAwait(false); + } + + /// Gets the specified private endpoint connection associated with the managed HSM Pool. + /// Name of the private endpoint connection associated with the managed hsm pool. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetManagedHsmPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + return GetManagedHsmPrivateEndpointConnections().Get(privateEndpointConnectionName, cancellationToken); + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmsGetByResourceGroupAsyncCollectionResultOfT.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmsGetByResourceGroupAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..aaa8ad99cf98 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmsGetByResourceGroupAsyncCollectionResultOfT.cs @@ -0,0 +1,88 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.KeyVault.Models; + +namespace Azure.ResourceManager.KeyVault +{ + internal partial class ManagedHsmsGetByResourceGroupAsyncCollectionResultOfT : AsyncPageable + { + private readonly ManagedHsms _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly int? _top; + private readonly RequestContext _context; + + /// Initializes a new instance of ManagedHsmsGetByResourceGroupAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ManagedHsms client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Maximum number of results to return. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + public ManagedHsmsGetByResourceGroupAsyncCollectionResultOfT(ManagedHsms client, Guid subscriptionId, string resourceGroupName, int? top, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _top = top; + _context = context; + } + + /// Gets the pages of ManagedHsmsGetByResourceGroupAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ManagedHsmsGetByResourceGroupAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + ManagedHsmListResult result = ManagedHsmListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByResourceGroupRequest(nextLink, _subscriptionId, _resourceGroupName, _top, _context) : _client.CreateGetByResourceGroupRequest(_subscriptionId, _resourceGroupName, _top, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("ManagedHsmCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmsGetByResourceGroupCollectionResultOfT.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmsGetByResourceGroupCollectionResultOfT.cs new file mode 100644 index 000000000000..be16bd2e4d07 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmsGetByResourceGroupCollectionResultOfT.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.KeyVault.Models; + +namespace Azure.ResourceManager.KeyVault +{ + internal partial class ManagedHsmsGetByResourceGroupCollectionResultOfT : Pageable + { + private readonly ManagedHsms _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly int? _top; + private readonly RequestContext _context; + + /// Initializes a new instance of ManagedHsmsGetByResourceGroupCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ManagedHsms client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Maximum number of results to return. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + public ManagedHsmsGetByResourceGroupCollectionResultOfT(ManagedHsms client, Guid subscriptionId, string resourceGroupName, int? top, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _top = top; + _context = context; + } + + /// Gets the pages of ManagedHsmsGetByResourceGroupCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ManagedHsmsGetByResourceGroupCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + ManagedHsmListResult result = ManagedHsmListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByResourceGroupRequest(nextLink, _subscriptionId, _resourceGroupName, _top, _context) : _client.CreateGetByResourceGroupRequest(_subscriptionId, _resourceGroupName, _top, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("ManagedHsmCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmsGetBySubscriptionAsyncCollectionResultOfT.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmsGetBySubscriptionAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..3a922b584c15 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmsGetBySubscriptionAsyncCollectionResultOfT.cs @@ -0,0 +1,81 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.KeyVault.Models; + +namespace Azure.ResourceManager.KeyVault +{ + internal partial class ManagedHsmsGetBySubscriptionAsyncCollectionResultOfT : AsyncPageable + { + private readonly ManagedHsms _client; + private readonly Guid _subscriptionId; + private readonly int? _top; + private readonly RequestContext _context; + + /// Initializes a new instance of ManagedHsmsGetBySubscriptionAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ManagedHsms client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// Maximum number of results to return. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public ManagedHsmsGetBySubscriptionAsyncCollectionResultOfT(ManagedHsms client, Guid subscriptionId, int? top, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _top = top; + _context = context; + } + + /// Gets the pages of ManagedHsmsGetBySubscriptionAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ManagedHsmsGetBySubscriptionAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + ManagedHsmListResult result = ManagedHsmListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetBySubscriptionRequest(nextLink, _subscriptionId, _top, _context) : _client.CreateGetBySubscriptionRequest(_subscriptionId, _top, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableKeyVaultSubscriptionResource.GetManagedHsms"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmsGetBySubscriptionCollectionResultOfT.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmsGetBySubscriptionCollectionResultOfT.cs new file mode 100644 index 000000000000..5a5111efd6b7 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmsGetBySubscriptionCollectionResultOfT.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.KeyVault.Models; + +namespace Azure.ResourceManager.KeyVault +{ + internal partial class ManagedHsmsGetBySubscriptionCollectionResultOfT : Pageable + { + private readonly ManagedHsms _client; + private readonly Guid _subscriptionId; + private readonly int? _top; + private readonly RequestContext _context; + + /// Initializes a new instance of ManagedHsmsGetBySubscriptionCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ManagedHsms client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// Maximum number of results to return. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public ManagedHsmsGetBySubscriptionCollectionResultOfT(ManagedHsms client, Guid subscriptionId, int? top, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _top = top; + _context = context; + } + + /// Gets the pages of ManagedHsmsGetBySubscriptionCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ManagedHsmsGetBySubscriptionCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + ManagedHsmListResult result = ManagedHsmListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetBySubscriptionRequest(nextLink, _subscriptionId, _top, _context) : _client.CreateGetBySubscriptionRequest(_subscriptionId, _top, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableKeyVaultSubscriptionResource.GetManagedHsms"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmsGetRegionsAsyncCollectionResultOfT.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmsGetRegionsAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..55b2a16dca2e --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmsGetRegionsAsyncCollectionResultOfT.cs @@ -0,0 +1,89 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.KeyVault.Models; + +namespace Azure.ResourceManager.KeyVault +{ + internal partial class ManagedHsmsGetRegionsAsyncCollectionResultOfT : AsyncPageable + { + private readonly ManagedHsms _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _name; + private readonly RequestContext _context; + + /// Initializes a new instance of ManagedHsmsGetRegionsAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ManagedHsms client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed HSM Pool. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public ManagedHsmsGetRegionsAsyncCollectionResultOfT(ManagedHsms client, Guid subscriptionId, string resourceGroupName, string name, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _name = name; + _context = context; + } + + /// Gets the pages of ManagedHsmsGetRegionsAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ManagedHsmsGetRegionsAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + ManagedHsmRegionsListResult result = ManagedHsmRegionsListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetRegionsRequest(nextLink, _subscriptionId, _resourceGroupName, _name, _context) : _client.CreateGetRegionsRequest(_subscriptionId, _resourceGroupName, _name, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("ManagedHsmResource.GetRegions"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmsGetRegionsCollectionResultOfT.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmsGetRegionsCollectionResultOfT.cs new file mode 100644 index 000000000000..76e7cde3aee6 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmsGetRegionsCollectionResultOfT.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.KeyVault.Models; + +namespace Azure.ResourceManager.KeyVault +{ + internal partial class ManagedHsmsGetRegionsCollectionResultOfT : Pageable + { + private readonly ManagedHsms _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _name; + private readonly RequestContext _context; + + /// Initializes a new instance of ManagedHsmsGetRegionsCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ManagedHsms client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed HSM Pool. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public ManagedHsmsGetRegionsCollectionResultOfT(ManagedHsms client, Guid subscriptionId, string resourceGroupName, string name, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _name = name; + _context = context; + } + + /// Gets the pages of ManagedHsmsGetRegionsCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ManagedHsmsGetRegionsCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + ManagedHsmRegionsListResult result = ManagedHsmRegionsListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetRegionsRequest(nextLink, _subscriptionId, _resourceGroupName, _name, _context) : _client.CreateGetRegionsRequest(_subscriptionId, _resourceGroupName, _name, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("ManagedHsmResource.GetRegions"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmsOperationGroupGetDeletedManagedHsmsAsyncCollectionResultOfT.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmsOperationGroupGetDeletedManagedHsmsAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..e63901c60fe0 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmsOperationGroupGetDeletedManagedHsmsAsyncCollectionResultOfT.cs @@ -0,0 +1,78 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.KeyVault.Models; + +namespace Azure.ResourceManager.KeyVault +{ + internal partial class ManagedHsmsOperationGroupGetDeletedManagedHsmsAsyncCollectionResultOfT : AsyncPageable + { + private readonly ManagedHsmsOperationGroup _client; + private readonly Guid _subscriptionId; + private readonly RequestContext _context; + + /// Initializes a new instance of ManagedHsmsOperationGroupGetDeletedManagedHsmsAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ManagedHsmsOperationGroup client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public ManagedHsmsOperationGroupGetDeletedManagedHsmsAsyncCollectionResultOfT(ManagedHsmsOperationGroup client, Guid subscriptionId, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _context = context; + } + + /// Gets the pages of ManagedHsmsOperationGroupGetDeletedManagedHsmsAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ManagedHsmsOperationGroupGetDeletedManagedHsmsAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + DeletedManagedHsmListResult result = DeletedManagedHsmListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetDeletedManagedHsmsRequest(nextLink, _subscriptionId, _context) : _client.CreateGetDeletedManagedHsmsRequest(_subscriptionId, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableKeyVaultSubscriptionResource.GetDeletedManagedHsms"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmsOperationGroupGetDeletedManagedHsmsCollectionResultOfT.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmsOperationGroupGetDeletedManagedHsmsCollectionResultOfT.cs new file mode 100644 index 000000000000..46f98c09c5c8 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmsOperationGroupGetDeletedManagedHsmsCollectionResultOfT.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.KeyVault.Models; + +namespace Azure.ResourceManager.KeyVault +{ + internal partial class ManagedHsmsOperationGroupGetDeletedManagedHsmsCollectionResultOfT : Pageable + { + private readonly ManagedHsmsOperationGroup _client; + private readonly Guid _subscriptionId; + private readonly RequestContext _context; + + /// Initializes a new instance of ManagedHsmsOperationGroupGetDeletedManagedHsmsCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ManagedHsmsOperationGroup client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public ManagedHsmsOperationGroupGetDeletedManagedHsmsCollectionResultOfT(ManagedHsmsOperationGroup client, Guid subscriptionId, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _context = context; + } + + /// Gets the pages of ManagedHsmsOperationGroupGetDeletedManagedHsmsCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ManagedHsmsOperationGroupGetDeletedManagedHsmsCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + DeletedManagedHsmListResult result = DeletedManagedHsmListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetDeletedManagedHsmsRequest(nextLink, _subscriptionId, _context) : _client.CreateGetDeletedManagedHsmsRequest(_subscriptionId, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableKeyVaultSubscriptionResource.GetDeletedManagedHsms"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/MhsmPrivateEndpointConnectionsGetByResourceAsyncCollectionResultOfT.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/MhsmPrivateEndpointConnectionsGetByResourceAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..4ec09824d6a9 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/MhsmPrivateEndpointConnectionsGetByResourceAsyncCollectionResultOfT.cs @@ -0,0 +1,89 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.KeyVault.Models; + +namespace Azure.ResourceManager.KeyVault +{ + internal partial class MhsmPrivateEndpointConnectionsGetByResourceAsyncCollectionResultOfT : AsyncPageable + { + private readonly MhsmPrivateEndpointConnections _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _name; + private readonly RequestContext _context; + + /// Initializes a new instance of MhsmPrivateEndpointConnectionsGetByResourceAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The MhsmPrivateEndpointConnections client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed HSM Pool. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public MhsmPrivateEndpointConnectionsGetByResourceAsyncCollectionResultOfT(MhsmPrivateEndpointConnections client, Guid subscriptionId, string resourceGroupName, string name, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _name = name; + _context = context; + } + + /// Gets the pages of MhsmPrivateEndpointConnectionsGetByResourceAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of MhsmPrivateEndpointConnectionsGetByResourceAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + MHSMPrivateEndpointConnectionsListResult result = MHSMPrivateEndpointConnectionsListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByResourceRequest(nextLink, _subscriptionId, _resourceGroupName, _name, _context) : _client.CreateGetByResourceRequest(_subscriptionId, _resourceGroupName, _name, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/MhsmPrivateEndpointConnectionsGetByResourceCollectionResultOfT.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/MhsmPrivateEndpointConnectionsGetByResourceCollectionResultOfT.cs new file mode 100644 index 000000000000..d57d0f00ab36 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/MhsmPrivateEndpointConnectionsGetByResourceCollectionResultOfT.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.KeyVault.Models; + +namespace Azure.ResourceManager.KeyVault +{ + internal partial class MhsmPrivateEndpointConnectionsGetByResourceCollectionResultOfT : Pageable + { + private readonly MhsmPrivateEndpointConnections _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _name; + private readonly RequestContext _context; + + /// Initializes a new instance of MhsmPrivateEndpointConnectionsGetByResourceCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The MhsmPrivateEndpointConnections client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the managed HSM Pool. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public MhsmPrivateEndpointConnectionsGetByResourceCollectionResultOfT(MhsmPrivateEndpointConnections client, Guid subscriptionId, string resourceGroupName, string name, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _name = name; + _context = context; + } + + /// Gets the pages of MhsmPrivateEndpointConnectionsGetByResourceCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of MhsmPrivateEndpointConnectionsGetByResourceCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + MHSMPrivateEndpointConnectionsListResult result = MHSMPrivateEndpointConnectionsListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByResourceRequest(nextLink, _subscriptionId, _resourceGroupName, _name, _context) : _client.CreateGetByResourceRequest(_subscriptionId, _resourceGroupName, _name, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("ManagedHsmPrivateEndpointConnectionCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/AccessPolicyUpdateKind.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/AccessPolicyUpdateKind.Serialization.cs index 0c09c6f03952..9c786c9f1271 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/AccessPolicyUpdateKind.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/AccessPolicyUpdateKind.Serialization.cs @@ -11,6 +11,7 @@ namespace Azure.ResourceManager.KeyVault.Models { internal static partial class AccessPolicyUpdateKindExtensions { + /// The value to serialize. public static string ToSerialString(this AccessPolicyUpdateKind value) => value switch { AccessPolicyUpdateKind.Add => "add", @@ -19,11 +20,21 @@ internal static partial class AccessPolicyUpdateKindExtensions _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown AccessPolicyUpdateKind value.") }; + /// The value to deserialize. public static AccessPolicyUpdateKind ToAccessPolicyUpdateKind(this string value) { - if (StringComparer.OrdinalIgnoreCase.Equals(value, "add")) return AccessPolicyUpdateKind.Add; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "replace")) return AccessPolicyUpdateKind.Replace; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "remove")) return AccessPolicyUpdateKind.Remove; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "add")) + { + return AccessPolicyUpdateKind.Add; + } + if (StringComparer.OrdinalIgnoreCase.Equals(value, "replace")) + { + return AccessPolicyUpdateKind.Replace; + } + if (StringComparer.OrdinalIgnoreCase.Equals(value, "remove")) + { + return AccessPolicyUpdateKind.Remove; + } throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown AccessPolicyUpdateKind value."); } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/AccessPolicyUpdateKind.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/AccessPolicyUpdateKind.cs index 7da87f7c73e2..2e58fff51a8d 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/AccessPolicyUpdateKind.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/AccessPolicyUpdateKind.cs @@ -7,14 +7,14 @@ namespace Azure.ResourceManager.KeyVault.Models { - /// The AccessPolicyUpdateKind. + /// public enum AccessPolicyUpdateKind { - /// add. + /// Add. Add, - /// replace. + /// Replace. Replace, - /// remove. + /// Remove. Remove } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/AzureResourceManagerKeyVaultContext.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/AzureResourceManagerKeyVaultContext.cs index 2701d7184caf..40bb5a722ea4 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/AzureResourceManagerKeyVaultContext.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/AzureResourceManagerKeyVaultContext.cs @@ -6,15 +6,15 @@ #nullable disable using System.ClientModel.Primitives; +using Azure; using Azure.ResourceManager.KeyVault.Models; using Azure.ResourceManager.Models; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.KeyVault { /// /// Context class which will be filled in by the System.ClientModel.SourceGeneration. - /// For more information see 'https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/System.ClientModel/src/docs/ModelReaderWriterContext.md' + /// For more information /// [ModelReaderWriterBuildable(typeof(DeletedKeyVaultData))] [ModelReaderWriterBuildable(typeof(DeletedKeyVaultProperties))] @@ -28,7 +28,6 @@ namespace Azure.ResourceManager.KeyVault [ModelReaderWriterBuildable(typeof(KeyVaultAccessPolicy))] [ModelReaderWriterBuildable(typeof(KeyVaultAccessPolicyParameters))] [ModelReaderWriterBuildable(typeof(KeyVaultAccessPolicyProperties))] - [ModelReaderWriterBuildable(typeof(KeyVaultCreateOrUpdateContent))] [ModelReaderWriterBuildable(typeof(KeyVaultData))] [ModelReaderWriterBuildable(typeof(KeyVaultIPRule))] [ModelReaderWriterBuildable(typeof(KeyVaultNameAvailabilityContent))] @@ -42,10 +41,10 @@ namespace Azure.ResourceManager.KeyVault [ModelReaderWriterBuildable(typeof(KeyVaultPrivateEndpointConnectionResource))] [ModelReaderWriterBuildable(typeof(KeyVaultPrivateLinkResourceData))] [ModelReaderWriterBuildable(typeof(KeyVaultPrivateLinkResourceListResult))] + [ModelReaderWriterBuildable(typeof(KeyVaultPrivateLinkResourceProperties))] [ModelReaderWriterBuildable(typeof(KeyVaultPrivateLinkServiceConnectionState))] [ModelReaderWriterBuildable(typeof(Models.KeyVaultProperties))] [ModelReaderWriterBuildable(typeof(KeyVaultResource))] - [ModelReaderWriterBuildable(typeof(KeyVaultSecretCreateOrUpdateContent))] [ModelReaderWriterBuildable(typeof(KeyVaultSecretData))] [ModelReaderWriterBuildable(typeof(KeyVaultSecretPatch))] [ModelReaderWriterBuildable(typeof(KeyVaultSecretResource))] @@ -55,13 +54,14 @@ namespace Azure.ResourceManager.KeyVault [ModelReaderWriterBuildable(typeof(ManagedHsmGeoReplicatedRegion))] [ModelReaderWriterBuildable(typeof(ManagedHsmIPRule))] [ModelReaderWriterBuildable(typeof(ManagedHsmListResult))] - [ModelReaderWriterBuildable(typeof(ManagedHsmNameAvailabilityContent))] + [ModelReaderWriterBuildable(typeof(ManagedHsmNameAvailabilityParameters))] [ModelReaderWriterBuildable(typeof(ManagedHsmNameAvailabilityResult))] [ModelReaderWriterBuildable(typeof(ManagedHsmNetworkRuleSet))] + [ModelReaderWriterBuildable(typeof(ManagedHsmPrivateEndpoint))] [ModelReaderWriterBuildable(typeof(ManagedHsmPrivateEndpointConnectionData))] [ModelReaderWriterBuildable(typeof(ManagedHsmPrivateEndpointConnectionItemData))] + [ModelReaderWriterBuildable(typeof(ManagedHsmPrivateEndpointConnectionProperties))] [ModelReaderWriterBuildable(typeof(ManagedHsmPrivateEndpointConnectionResource))] - [ModelReaderWriterBuildable(typeof(ManagedHsmPrivateEndpointConnectionsListResult))] [ModelReaderWriterBuildable(typeof(ManagedHsmPrivateLinkResourceData))] [ModelReaderWriterBuildable(typeof(ManagedHsmPrivateLinkResourceListResult))] [ModelReaderWriterBuildable(typeof(ManagedHsmPrivateLinkServiceConnectionState))] @@ -73,14 +73,20 @@ namespace Azure.ResourceManager.KeyVault [ModelReaderWriterBuildable(typeof(ManagedHsmSku))] [ModelReaderWriterBuildable(typeof(ManagedHsmVirtualNetworkRule))] [ModelReaderWriterBuildable(typeof(ManagedServiceIdentity))] + [ModelReaderWriterBuildable(typeof(MHSMPrivateEndpointConnectionsListResult))] + [ModelReaderWriterBuildable(typeof(MhsmPrivateLinkResourceProperties))] + [ModelReaderWriterBuildable(typeof(PrivateEndpoint))] + [ModelReaderWriterBuildable(typeof(PrivateEndpointConnectionProperties))] + [ModelReaderWriterBuildable(typeof(ResponseError))] [ModelReaderWriterBuildable(typeof(SecretAttributes))] [ModelReaderWriterBuildable(typeof(SecretBaseAttributes))] + [ModelReaderWriterBuildable(typeof(SecretCreateOrUpdateParameters))] [ModelReaderWriterBuildable(typeof(SecretListResult))] [ModelReaderWriterBuildable(typeof(SecretPatchProperties))] [ModelReaderWriterBuildable(typeof(SecretProperties))] - [ModelReaderWriterBuildable(typeof(SubResource))] [ModelReaderWriterBuildable(typeof(SystemData))] [ModelReaderWriterBuildable(typeof(UserAssignedIdentity))] + [ModelReaderWriterBuildable(typeof(VaultCreateOrUpdateParameters))] [ModelReaderWriterBuildable(typeof(VaultListResult))] public partial class AzureResourceManagerKeyVaultContext : ModelReaderWriterContext { diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletedKeyVaultProperties.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletedKeyVaultProperties.Serialization.cs index d8ef9b563d33..0ace9d8a3156 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletedKeyVaultProperties.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletedKeyVaultProperties.Serialization.cs @@ -8,17 +8,17 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class DeletedKeyVaultProperties : IUtf8JsonSerializable, IJsonModel + /// Properties of the deleted vault. + public partial class DeletedKeyVaultProperties : 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(); @@ -30,12 +30,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea /// The client options for reading and writing models. protected virtual 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(DeletedKeyVaultProperties)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsDefined(VaultId)) { writer.WritePropertyName("vaultId"u8); @@ -63,6 +62,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit foreach (var item in Tags) { writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } writer.WriteStringValue(item.Value); } writer.WriteEndObject(); @@ -72,15 +76,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("purgeProtectionEnabled"u8); writer.WriteBooleanValue(PurgeProtectionEnabled.Value); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -89,265 +93,151 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DeletedKeyVaultProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DeletedKeyVaultProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DeletedKeyVaultProperties 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(DeletedKeyVaultProperties)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDeletedKeyVaultProperties(document.RootElement, options); } - internal static DeletedKeyVaultProperties DeserializeDeletedKeyVaultProperties(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DeletedKeyVaultProperties DeserializeDeletedKeyVaultProperties(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } ResourceIdentifier vaultId = default; AzureLocation? location = default; - DateTimeOffset? deletionDate = default; - DateTimeOffset? scheduledPurgeDate = default; + DateTimeOffset? deletedOn = default; + DateTimeOffset? scheduledPurgeOn = default; IReadOnlyDictionary tags = default; bool? purgeProtectionEnabled = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("vaultId"u8)) + if (prop.NameEquals("vaultId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - vaultId = new ResourceIdentifier(property.Value.GetString()); + vaultId = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("location"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - location = new AzureLocation(property.Value.GetString()); + location = new AzureLocation(prop.Value.GetString()); continue; } - if (property.NameEquals("deletionDate"u8)) + if (prop.NameEquals("deletionDate"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - deletionDate = property.Value.GetDateTimeOffset("O"); + deletedOn = prop.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("scheduledPurgeDate"u8)) + if (prop.NameEquals("scheduledPurgeDate"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - scheduledPurgeDate = property.Value.GetDateTimeOffset("O"); + scheduledPurgeOn = prop.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) + foreach (var prop0 in prop.Value.EnumerateObject()) { - dictionary.Add(property0.Name, property0.Value.GetString()); + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } } tags = dictionary; continue; } - if (property.NameEquals("purgeProtectionEnabled"u8)) + if (prop.NameEquals("purgeProtectionEnabled"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - purgeProtectionEnabled = property.Value.GetBoolean(); + purgeProtectionEnabled = prop.Value.GetBoolean(); 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 DeletedKeyVaultProperties( vaultId, location, - deletionDate, - scheduledPurgeDate, + deletedOn, + scheduledPurgeOn, tags ?? new ChangeTrackingDictionary(), purgeProtectionEnabled, - serializedAdditionalRawData); + additionalBinaryDataProperties); } - 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(VaultId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" vaultId: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(VaultId)) - { - builder.Append(" vaultId: "); - builder.AppendLine($"'{VaultId.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Location), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" location: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Location)) - { - builder.Append(" location: "); - builder.AppendLine($"'{Location.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DeletedOn), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" deletionDate: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(DeletedOn)) - { - builder.Append(" deletionDate: "); - var formattedDateTimeString = TypeFormatters.ToString(DeletedOn.Value, "o"); - builder.AppendLine($"'{formattedDateTimeString}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ScheduledPurgeOn), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" scheduledPurgeDate: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ScheduledPurgeOn)) - { - builder.Append(" scheduledPurgeDate: "); - var formattedDateTimeString = TypeFormatters.ToString(ScheduledPurgeOn.Value, "o"); - builder.AppendLine($"'{formattedDateTimeString}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Tags), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" tags: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Tags)) - { - if (Tags.Any()) - { - builder.Append(" tags: "); - builder.AppendLine("{"); - foreach (var item in Tags) - { - builder.Append($" '{item.Key}': "); - if (item.Value == null) - { - builder.Append("null"); - continue; - } - if (item.Value.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{item.Value}'''"); - } - else - { - builder.AppendLine($"'{item.Value}'"); - } - } - builder.AppendLine(" }"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PurgeProtectionEnabled), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" purgeProtectionEnabled: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PurgeProtectionEnabled)) - { - builder.Append(" purgeProtectionEnabled: "); - var boolValue = PurgeProtectionEnabled.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - 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(DeletedKeyVaultProperties)} does not support writing '{options.Format}' format."); } } - DeletedKeyVaultProperties 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. + DeletedKeyVaultProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DeletedKeyVaultProperties 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 DeserializeDeletedKeyVaultProperties(document.RootElement, options); } default: @@ -355,6 +245,7 @@ DeletedKeyVaultProperties IPersistableModel.Create(Bi } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletedKeyVaultProperties.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletedKeyVaultProperties.cs index a208605e121e..9d63652d93c7 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletedKeyVaultProperties.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletedKeyVaultProperties.cs @@ -8,43 +8,15 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// Properties of the deleted vault. public partial class DeletedKeyVaultProperties { - /// - /// 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 DeletedKeyVaultProperties() @@ -59,8 +31,8 @@ internal DeletedKeyVaultProperties() /// The scheduled purged date. /// Tags of the original vault. /// Purge protection status of the original vault. - /// Keeps track of any properties unknown to the library. - internal DeletedKeyVaultProperties(ResourceIdentifier vaultId, AzureLocation? location, DateTimeOffset? deletedOn, DateTimeOffset? scheduledPurgeOn, IReadOnlyDictionary tags, bool? purgeProtectionEnabled, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DeletedKeyVaultProperties(ResourceIdentifier vaultId, AzureLocation? location, DateTimeOffset? deletedOn, DateTimeOffset? scheduledPurgeOn, IReadOnlyDictionary tags, bool? purgeProtectionEnabled, IDictionary additionalBinaryDataProperties) { VaultId = vaultId; Location = location; @@ -68,24 +40,29 @@ internal DeletedKeyVaultProperties(ResourceIdentifier vaultId, AzureLocation? lo ScheduledPurgeOn = scheduledPurgeOn; Tags = tags; PurgeProtectionEnabled = purgeProtectionEnabled; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The resource id of the original vault. [WirePath("vaultId")] public ResourceIdentifier VaultId { get; } + /// The location of the original vault. [WirePath("location")] public AzureLocation? Location { get; } + /// The deleted date. [WirePath("deletionDate")] public DateTimeOffset? DeletedOn { get; } + /// The scheduled purged date. [WirePath("scheduledPurgeDate")] public DateTimeOffset? ScheduledPurgeOn { get; } + /// Tags of the original vault. [WirePath("tags")] public IReadOnlyDictionary Tags { get; } + /// Purge protection status of the original vault. [WirePath("purgeProtectionEnabled")] public bool? PurgeProtectionEnabled { get; } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletedManagedHsmListResult.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletedManagedHsmListResult.Serialization.cs index 8fc172b693e8..8ef8d45d3686 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletedManagedHsmListResult.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletedManagedHsmListResult.Serialization.cs @@ -8,17 +8,22 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - internal partial class DeletedManagedHsmListResult : IUtf8JsonSerializable, IJsonModel + /// The response of a DeletedManagedHsm list operation. + internal partial class DeletedManagedHsmListResult : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal DeletedManagedHsmListResult() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -30,15 +35,14 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR /// The client options for reading and writing models. protected virtual 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(DeletedManagedHsmListResult)} does not support writing '{format}' format."); } - writer.WritePropertyName("value"u8); writer.WriteStartArray(); - foreach (var item in Value) + foreach (DeletedManagedHsmData item in Value) { writer.WriteObjectValue(item, options); } @@ -48,15 +52,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("nextLink"u8); writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -65,137 +69,93 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DeletedManagedHsmListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DeletedManagedHsmListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DeletedManagedHsmListResult 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(DeletedManagedHsmListResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDeletedManagedHsmListResult(document.RootElement, options); } - internal static DeletedManagedHsmListResult DeserializeDeletedManagedHsmListResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DeletedManagedHsmListResult DeserializeDeletedManagedHsmListResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; + IList value = default; Uri nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(DeletedManagedHsmData.DeserializeDeletedManagedHsmData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - nextLink = new Uri(property.Value.GetString()); + nextLink = new Uri(prop.Value.GetString()); 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 DeletedManagedHsmListResult(value, nextLink, serializedAdditionalRawData); + return new DeletedManagedHsmListResult(value, nextLink, additionalBinaryDataProperties); } - 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(Value), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" value: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Value)) - { - if (Value.Any()) - { - builder.Append(" value: "); - builder.AppendLine("["); - foreach (var item in Value) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nextLink: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NextLink)) - { - builder.Append(" nextLink: "); - builder.AppendLine($"'{NextLink.AbsoluteUri}'"); - } - } - - 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(DeletedManagedHsmListResult)} does not support writing '{options.Format}' format."); } } - DeletedManagedHsmListResult 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. + DeletedManagedHsmListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DeletedManagedHsmListResult 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 DeserializeDeletedManagedHsmListResult(document.RootElement, options); } default: @@ -203,6 +163,15 @@ DeletedManagedHsmListResult IPersistableModel.Creat } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static DeletedManagedHsmListResult FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeDeletedManagedHsmListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletedManagedHsmListResult.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletedManagedHsmListResult.cs index 93e609469182..1cf19cd2e927 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletedManagedHsmListResult.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletedManagedHsmListResult.cs @@ -8,73 +8,40 @@ using System; using System.Collections.Generic; using System.Linq; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// The response of a DeletedManagedHsm list operation. internal partial class DeletedManagedHsmListResult { - /// - /// 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 . /// The DeletedManagedHsm items on this page. - /// is null. internal DeletedManagedHsmListResult(IEnumerable value) { - Argument.AssertNotNull(value, nameof(value)); - Value = value.ToList(); } /// Initializes a new instance of . /// The DeletedManagedHsm items on this page. /// The link to the next page of items. - /// Keeps track of any properties unknown to the library. - internal DeletedManagedHsmListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DeletedManagedHsmListResult(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal DeletedManagedHsmListResult() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The DeletedManagedHsm items on this page. - public IReadOnlyList Value { get; } + [WirePath("value")] + public IList Value { get; } + /// The link to the next page of items. + [WirePath("nextLink")] public Uri NextLink { get; } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletedManagedHsmProperties.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletedManagedHsmProperties.Serialization.cs index 4105282a543d..62c4c61e79a4 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletedManagedHsmProperties.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletedManagedHsmProperties.Serialization.cs @@ -8,17 +8,17 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class DeletedManagedHsmProperties : IUtf8JsonSerializable, IJsonModel + /// Properties of the deleted managed HSM. + public partial class DeletedManagedHsmProperties : 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(); @@ -30,12 +30,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR /// The client options for reading and writing models. protected virtual 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(DeletedManagedHsmProperties)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsDefined(ManagedHsmId)) { writer.WritePropertyName("mhsmId"u8); @@ -68,19 +67,24 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit foreach (var item in Tags) { writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } writer.WriteStringValue(item.Value); } writer.WriteEndObject(); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -89,265 +93,151 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DeletedManagedHsmProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DeletedManagedHsmProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DeletedManagedHsmProperties 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(DeletedManagedHsmProperties)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDeletedManagedHsmProperties(document.RootElement, options); } - internal static DeletedManagedHsmProperties DeserializeDeletedManagedHsmProperties(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DeletedManagedHsmProperties DeserializeDeletedManagedHsmProperties(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } ResourceIdentifier managedHsmId = default; AzureLocation? location = default; - DateTimeOffset? deletionDate = default; - DateTimeOffset? scheduledPurgeDate = default; + DateTimeOffset? deletedOn = default; + DateTimeOffset? scheduledPurgeOn = default; bool? purgeProtectionEnabled = default; IReadOnlyDictionary tags = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("mhsmId"u8)) + if (prop.NameEquals("mhsmId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - managedHsmId = new ResourceIdentifier(property.Value.GetString()); + managedHsmId = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("location"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - location = new AzureLocation(property.Value.GetString()); + location = new AzureLocation(prop.Value.GetString()); continue; } - if (property.NameEquals("deletionDate"u8)) + if (prop.NameEquals("deletionDate"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - deletionDate = property.Value.GetDateTimeOffset("O"); + deletedOn = prop.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("scheduledPurgeDate"u8)) + if (prop.NameEquals("scheduledPurgeDate"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - scheduledPurgeDate = property.Value.GetDateTimeOffset("O"); + scheduledPurgeOn = prop.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("purgeProtectionEnabled"u8)) + if (prop.NameEquals("purgeProtectionEnabled"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - purgeProtectionEnabled = property.Value.GetBoolean(); + purgeProtectionEnabled = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) + foreach (var prop0 in prop.Value.EnumerateObject()) { - dictionary.Add(property0.Name, property0.Value.GetString()); + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } } tags = dictionary; 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 DeletedManagedHsmProperties( managedHsmId, location, - deletionDate, - scheduledPurgeDate, + deletedOn, + scheduledPurgeOn, purgeProtectionEnabled, tags ?? new ChangeTrackingDictionary(), - serializedAdditionalRawData); + additionalBinaryDataProperties); } - 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(ManagedHsmId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" mhsmId: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ManagedHsmId)) - { - builder.Append(" mhsmId: "); - builder.AppendLine($"'{ManagedHsmId.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Location), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" location: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Location)) - { - builder.Append(" location: "); - builder.AppendLine($"'{Location.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DeletedOn), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" deletionDate: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(DeletedOn)) - { - builder.Append(" deletionDate: "); - var formattedDateTimeString = TypeFormatters.ToString(DeletedOn.Value, "o"); - builder.AppendLine($"'{formattedDateTimeString}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ScheduledPurgeOn), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" scheduledPurgeDate: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ScheduledPurgeOn)) - { - builder.Append(" scheduledPurgeDate: "); - var formattedDateTimeString = TypeFormatters.ToString(ScheduledPurgeOn.Value, "o"); - builder.AppendLine($"'{formattedDateTimeString}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PurgeProtectionEnabled), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" purgeProtectionEnabled: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PurgeProtectionEnabled)) - { - builder.Append(" purgeProtectionEnabled: "); - var boolValue = PurgeProtectionEnabled.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Tags), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" tags: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Tags)) - { - if (Tags.Any()) - { - builder.Append(" tags: "); - builder.AppendLine("{"); - foreach (var item in Tags) - { - builder.Append($" '{item.Key}': "); - if (item.Value == null) - { - builder.Append("null"); - continue; - } - if (item.Value.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{item.Value}'''"); - } - else - { - builder.AppendLine($"'{item.Value}'"); - } - } - builder.AppendLine(" }"); - } - } - } - - 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(DeletedManagedHsmProperties)} does not support writing '{options.Format}' format."); } } - DeletedManagedHsmProperties 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. + DeletedManagedHsmProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DeletedManagedHsmProperties 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 DeserializeDeletedManagedHsmProperties(document.RootElement, options); } default: @@ -355,6 +245,7 @@ DeletedManagedHsmProperties IPersistableModel.Creat } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletedManagedHsmProperties.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletedManagedHsmProperties.cs index 0ca03d22b845..f2163637eb08 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletedManagedHsmProperties.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletedManagedHsmProperties.cs @@ -8,43 +8,15 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// Properties of the deleted managed HSM. public partial class DeletedManagedHsmProperties { - /// - /// 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 DeletedManagedHsmProperties() @@ -59,8 +31,8 @@ internal DeletedManagedHsmProperties() /// The scheduled purged date. /// Purge protection status of the original managed HSM. /// Tags of the original managed HSM. - /// Keeps track of any properties unknown to the library. - internal DeletedManagedHsmProperties(ResourceIdentifier managedHsmId, AzureLocation? location, DateTimeOffset? deletedOn, DateTimeOffset? scheduledPurgeOn, bool? purgeProtectionEnabled, IReadOnlyDictionary tags, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DeletedManagedHsmProperties(ResourceIdentifier managedHsmId, AzureLocation? location, DateTimeOffset? deletedOn, DateTimeOffset? scheduledPurgeOn, bool? purgeProtectionEnabled, IReadOnlyDictionary tags, IDictionary additionalBinaryDataProperties) { ManagedHsmId = managedHsmId; Location = location; @@ -68,24 +40,29 @@ internal DeletedManagedHsmProperties(ResourceIdentifier managedHsmId, AzureLocat ScheduledPurgeOn = scheduledPurgeOn; PurgeProtectionEnabled = purgeProtectionEnabled; Tags = tags; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The resource id of the original managed HSM. [WirePath("mhsmId")] public ResourceIdentifier ManagedHsmId { get; } + /// The location of the original managed HSM. [WirePath("location")] public AzureLocation? Location { get; } + /// The deleted date. [WirePath("deletionDate")] public DateTimeOffset? DeletedOn { get; } + /// The scheduled purged date. [WirePath("scheduledPurgeDate")] public DateTimeOffset? ScheduledPurgeOn { get; } + /// Purge protection status of the original managed HSM. [WirePath("purgeProtectionEnabled")] public bool? PurgeProtectionEnabled { get; } + /// Tags of the original managed HSM. [WirePath("tags")] public IReadOnlyDictionary Tags { get; } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletedVaultListResult.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletedVaultListResult.Serialization.cs index 3b74da044b33..7ac4e246e44b 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletedVaultListResult.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletedVaultListResult.Serialization.cs @@ -8,17 +8,22 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - internal partial class DeletedVaultListResult : IUtf8JsonSerializable, IJsonModel + /// The response of a DeletedVault list operation. + internal partial class DeletedVaultListResult : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal DeletedVaultListResult() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -30,15 +35,14 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReader /// The client options for reading and writing models. protected virtual 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(DeletedVaultListResult)} does not support writing '{format}' format."); } - writer.WritePropertyName("value"u8); writer.WriteStartArray(); - foreach (var item in Value) + foreach (DeletedKeyVaultData item in Value) { writer.WriteObjectValue(item, options); } @@ -48,15 +52,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("nextLink"u8); writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -65,137 +69,93 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DeletedVaultListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DeletedVaultListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DeletedVaultListResult 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(DeletedVaultListResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDeletedVaultListResult(document.RootElement, options); } - internal static DeletedVaultListResult DeserializeDeletedVaultListResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DeletedVaultListResult DeserializeDeletedVaultListResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; + IList value = default; Uri nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(DeletedKeyVaultData.DeserializeDeletedKeyVaultData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - nextLink = new Uri(property.Value.GetString()); + nextLink = new Uri(prop.Value.GetString()); 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 DeletedVaultListResult(value, nextLink, serializedAdditionalRawData); + return new DeletedVaultListResult(value, nextLink, additionalBinaryDataProperties); } - 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(Value), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" value: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Value)) - { - if (Value.Any()) - { - builder.Append(" value: "); - builder.AppendLine("["); - foreach (var item in Value) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nextLink: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NextLink)) - { - builder.Append(" nextLink: "); - builder.AppendLine($"'{NextLink.AbsoluteUri}'"); - } - } - - 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(DeletedVaultListResult)} does not support writing '{options.Format}' format."); } } - DeletedVaultListResult 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. + DeletedVaultListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DeletedVaultListResult 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 DeserializeDeletedVaultListResult(document.RootElement, options); } default: @@ -203,6 +163,15 @@ DeletedVaultListResult IPersistableModel.Create(BinaryDa } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static DeletedVaultListResult FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeDeletedVaultListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletedVaultListResult.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletedVaultListResult.cs index 5fda7d7b9676..e6d5c436036f 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletedVaultListResult.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletedVaultListResult.cs @@ -8,73 +8,40 @@ using System; using System.Collections.Generic; using System.Linq; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// The response of a DeletedVault list operation. internal partial class DeletedVaultListResult { - /// - /// 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 . /// The DeletedVault items on this page. - /// is null. internal DeletedVaultListResult(IEnumerable value) { - Argument.AssertNotNull(value, nameof(value)); - Value = value.ToList(); } /// Initializes a new instance of . /// The DeletedVault items on this page. /// The link to the next page of items. - /// Keeps track of any properties unknown to the library. - internal DeletedVaultListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DeletedVaultListResult(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal DeletedVaultListResult() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The DeletedVault items on this page. - public IReadOnlyList Value { get; } + [WirePath("value")] + public IList Value { get; } + /// The link to the next page of items. + [WirePath("nextLink")] public Uri NextLink { get; } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/IdentityAccessCertificatePermission.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/IdentityAccessCertificatePermission.cs index 6954674ff022..a1539c67442a 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/IdentityAccessCertificatePermission.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/IdentityAccessCertificatePermission.cs @@ -7,21 +7,14 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - /// The IdentityAccessCertificatePermission. + /// public readonly partial struct IdentityAccessCertificatePermission : IEquatable { private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public IdentityAccessCertificatePermission(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - private const string AllValue = "all"; private const string GetValue = "get"; private const string ListValue = "list"; @@ -40,57 +33,97 @@ public IdentityAccessCertificatePermission(string value) private const string BackupValue = "backup"; private const string RestoreValue = "restore"; - /// all. + /// Initializes a new instance of . + /// The value. + /// is null. + public IdentityAccessCertificatePermission(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Gets the All. public static IdentityAccessCertificatePermission All { get; } = new IdentityAccessCertificatePermission(AllValue); - /// get. + + /// Gets the Get. public static IdentityAccessCertificatePermission Get { get; } = new IdentityAccessCertificatePermission(GetValue); - /// list. + + /// Gets the List. public static IdentityAccessCertificatePermission List { get; } = new IdentityAccessCertificatePermission(ListValue); - /// delete. + + /// Gets the Delete. public static IdentityAccessCertificatePermission Delete { get; } = new IdentityAccessCertificatePermission(DeleteValue); - /// create. + + /// Gets the Create. public static IdentityAccessCertificatePermission Create { get; } = new IdentityAccessCertificatePermission(CreateValue); - /// import. + + /// Gets the Import. public static IdentityAccessCertificatePermission Import { get; } = new IdentityAccessCertificatePermission(ImportValue); - /// update. + + /// Gets the Update. public static IdentityAccessCertificatePermission Update { get; } = new IdentityAccessCertificatePermission(UpdateValue); - /// managecontacts. + + /// Gets the ManageContacts. public static IdentityAccessCertificatePermission ManageContacts { get; } = new IdentityAccessCertificatePermission(ManageContactsValue); - /// getissuers. + + /// Gets the GetIssuers. public static IdentityAccessCertificatePermission GetIssuers { get; } = new IdentityAccessCertificatePermission(GetIssuersValue); - /// listissuers. + + /// Gets the ListIssuers. public static IdentityAccessCertificatePermission ListIssuers { get; } = new IdentityAccessCertificatePermission(ListIssuersValue); - /// setissuers. + + /// Gets the SetIssuers. public static IdentityAccessCertificatePermission SetIssuers { get; } = new IdentityAccessCertificatePermission(SetIssuersValue); - /// deleteissuers. + + /// Gets the DeleteIssuers. public static IdentityAccessCertificatePermission DeleteIssuers { get; } = new IdentityAccessCertificatePermission(DeleteIssuersValue); - /// manageissuers. + + /// Gets the ManageIssuers. public static IdentityAccessCertificatePermission ManageIssuers { get; } = new IdentityAccessCertificatePermission(ManageIssuersValue); - /// recover. + + /// Gets the Recover. public static IdentityAccessCertificatePermission Recover { get; } = new IdentityAccessCertificatePermission(RecoverValue); - /// purge. + + /// Gets the Purge. public static IdentityAccessCertificatePermission Purge { get; } = new IdentityAccessCertificatePermission(PurgeValue); - /// backup. + + /// Gets the Backup. public static IdentityAccessCertificatePermission Backup { get; } = new IdentityAccessCertificatePermission(BackupValue); - /// restore. + + /// Gets the Restore. public static IdentityAccessCertificatePermission Restore { get; } = new IdentityAccessCertificatePermission(RestoreValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(IdentityAccessCertificatePermission left, IdentityAccessCertificatePermission right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(IdentityAccessCertificatePermission left, IdentityAccessCertificatePermission right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator IdentityAccessCertificatePermission(string value) => new IdentityAccessCertificatePermission(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator IdentityAccessCertificatePermission?(string value) => value == null ? null : new IdentityAccessCertificatePermission(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is IdentityAccessCertificatePermission other && Equals(other); - /// + + /// public bool Equals(IdentityAccessCertificatePermission other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/IdentityAccessKeyPermission.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/IdentityAccessKeyPermission.cs index 12012184d3ed..0476e2d7d5d0 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/IdentityAccessKeyPermission.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/IdentityAccessKeyPermission.cs @@ -7,21 +7,14 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - /// The IdentityAccessKeyPermission. + /// public readonly partial struct IdentityAccessKeyPermission : IEquatable { private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public IdentityAccessKeyPermission(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - private const string AllValue = "all"; private const string EncryptValue = "encrypt"; private const string DecryptValue = "decrypt"; @@ -44,65 +37,109 @@ public IdentityAccessKeyPermission(string value) private const string GetrotationpolicyValue = "getrotationpolicy"; private const string SetrotationpolicyValue = "setrotationpolicy"; - /// all. + /// Initializes a new instance of . + /// The value. + /// is null. + public IdentityAccessKeyPermission(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Gets the All. public static IdentityAccessKeyPermission All { get; } = new IdentityAccessKeyPermission(AllValue); - /// encrypt. + + /// Gets the Encrypt. public static IdentityAccessKeyPermission Encrypt { get; } = new IdentityAccessKeyPermission(EncryptValue); - /// decrypt. + + /// Gets the Decrypt. public static IdentityAccessKeyPermission Decrypt { get; } = new IdentityAccessKeyPermission(DecryptValue); - /// wrapKey. + + /// Gets the WrapKey. public static IdentityAccessKeyPermission WrapKey { get; } = new IdentityAccessKeyPermission(WrapKeyValue); - /// unwrapKey. + + /// Gets the UnwrapKey. public static IdentityAccessKeyPermission UnwrapKey { get; } = new IdentityAccessKeyPermission(UnwrapKeyValue); - /// sign. + + /// Gets the Sign. public static IdentityAccessKeyPermission Sign { get; } = new IdentityAccessKeyPermission(SignValue); - /// verify. + + /// Gets the Verify. public static IdentityAccessKeyPermission Verify { get; } = new IdentityAccessKeyPermission(VerifyValue); - /// get. + + /// Gets the Get. public static IdentityAccessKeyPermission Get { get; } = new IdentityAccessKeyPermission(GetValue); - /// list. + + /// Gets the List. public static IdentityAccessKeyPermission List { get; } = new IdentityAccessKeyPermission(ListValue); - /// create. + + /// Gets the Create. public static IdentityAccessKeyPermission Create { get; } = new IdentityAccessKeyPermission(CreateValue); - /// update. + + /// Gets the Update. public static IdentityAccessKeyPermission Update { get; } = new IdentityAccessKeyPermission(UpdateValue); - /// import. + + /// Gets the Import. public static IdentityAccessKeyPermission Import { get; } = new IdentityAccessKeyPermission(ImportValue); - /// delete. + + /// Gets the Delete. public static IdentityAccessKeyPermission Delete { get; } = new IdentityAccessKeyPermission(DeleteValue); - /// backup. + + /// Gets the Backup. public static IdentityAccessKeyPermission Backup { get; } = new IdentityAccessKeyPermission(BackupValue); - /// restore. + + /// Gets the Restore. public static IdentityAccessKeyPermission Restore { get; } = new IdentityAccessKeyPermission(RestoreValue); - /// recover. + + /// Gets the Recover. public static IdentityAccessKeyPermission Recover { get; } = new IdentityAccessKeyPermission(RecoverValue); - /// purge. + + /// Gets the Purge. public static IdentityAccessKeyPermission Purge { get; } = new IdentityAccessKeyPermission(PurgeValue); - /// release. + + /// Gets the Release. public static IdentityAccessKeyPermission Release { get; } = new IdentityAccessKeyPermission(ReleaseValue); - /// rotate. + + /// Gets the Rotate. public static IdentityAccessKeyPermission Rotate { get; } = new IdentityAccessKeyPermission(RotateValue); - /// getrotationpolicy. + + /// Gets the Getrotationpolicy. public static IdentityAccessKeyPermission Getrotationpolicy { get; } = new IdentityAccessKeyPermission(GetrotationpolicyValue); - /// setrotationpolicy. + + /// Gets the Setrotationpolicy. public static IdentityAccessKeyPermission Setrotationpolicy { get; } = new IdentityAccessKeyPermission(SetrotationpolicyValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(IdentityAccessKeyPermission left, IdentityAccessKeyPermission right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(IdentityAccessKeyPermission left, IdentityAccessKeyPermission right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator IdentityAccessKeyPermission(string value) => new IdentityAccessKeyPermission(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator IdentityAccessKeyPermission?(string value) => value == null ? null : new IdentityAccessKeyPermission(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is IdentityAccessKeyPermission other && Equals(other); - /// + + /// public bool Equals(IdentityAccessKeyPermission other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/IdentityAccessPermissions.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/IdentityAccessPermissions.Serialization.cs index 1d99c2cbcc87..d9782db840ef 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/IdentityAccessPermissions.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/IdentityAccessPermissions.Serialization.cs @@ -8,17 +8,16 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class IdentityAccessPermissions : IUtf8JsonSerializable, IJsonModel + /// Permissions the identity has for keys, secrets, certificates and storage. + public partial class IdentityAccessPermissions : 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(); @@ -30,17 +29,16 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea /// The client options for reading and writing models. protected virtual 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(IdentityAccessPermissions)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Keys)) { writer.WritePropertyName("keys"u8); writer.WriteStartArray(); - foreach (var item in Keys) + foreach (IdentityAccessKeyPermission item in Keys) { writer.WriteStringValue(item.ToString()); } @@ -50,7 +48,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("secrets"u8); writer.WriteStartArray(); - foreach (var item in Secrets) + foreach (IdentityAccessSecretPermission item in Secrets) { writer.WriteStringValue(item.ToString()); } @@ -60,7 +58,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("certificates"u8); writer.WriteStartArray(); - foreach (var item in Certificates) + foreach (IdentityAccessCertificatePermission item in Certificates) { writer.WriteStringValue(item.ToString()); } @@ -70,21 +68,21 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("storage"u8); writer.WriteStartArray(); - foreach (var item in Storage) + foreach (IdentityAccessStoragePermission item in Storage) { writer.WriteStringValue(item.ToString()); } writer.WriteEndArray(); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -93,22 +91,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - IdentityAccessPermissions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + IdentityAccessPermissions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual IdentityAccessPermissions 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(IdentityAccessPermissions)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeIdentityAccessPermissions(document.RootElement, options); } - internal static IdentityAccessPermissions DeserializeIdentityAccessPermissions(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static IdentityAccessPermissions DeserializeIdentityAccessPermissions(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -117,60 +120,59 @@ internal static IdentityAccessPermissions DeserializeIdentityAccessPermissions(J IList secrets = default; IList certificates = default; IList storage = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("keys"u8)) + if (prop.NameEquals("keys"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(new IdentityAccessKeyPermission(item.GetString())); } keys = array; continue; } - if (property.NameEquals("secrets"u8)) + if (prop.NameEquals("secrets"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(new IdentityAccessSecretPermission(item.GetString())); } secrets = array; continue; } - if (property.NameEquals("certificates"u8)) + if (prop.NameEquals("certificates"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(new IdentityAccessCertificatePermission(item.GetString())); } certificates = array; continue; } - if (property.NameEquals("storage"u8)) + if (prop.NameEquals("storage"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(new IdentityAccessStoragePermission(item.GetString())); } @@ -179,144 +181,42 @@ internal static IdentityAccessPermissions DeserializeIdentityAccessPermissions(J } 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 IdentityAccessPermissions(keys ?? new ChangeTrackingList(), secrets ?? new ChangeTrackingList(), certificates ?? new ChangeTrackingList(), storage ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new IdentityAccessPermissions(keys ?? new ChangeTrackingList(), secrets ?? new ChangeTrackingList(), certificates ?? new ChangeTrackingList(), storage ?? new ChangeTrackingList(), additionalBinaryDataProperties); } - 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(Keys), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" keys: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Keys)) - { - if (Keys.Any()) - { - builder.Append(" keys: "); - builder.AppendLine("["); - foreach (var item in Keys) - { - builder.AppendLine($" '{item.ToString()}'"); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Secrets), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" secrets: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Secrets)) - { - if (Secrets.Any()) - { - builder.Append(" secrets: "); - builder.AppendLine("["); - foreach (var item in Secrets) - { - builder.AppendLine($" '{item.ToString()}'"); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Certificates), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" certificates: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Certificates)) - { - if (Certificates.Any()) - { - builder.Append(" certificates: "); - builder.AppendLine("["); - foreach (var item in Certificates) - { - builder.AppendLine($" '{item.ToString()}'"); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Storage), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" storage: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Storage)) - { - if (Storage.Any()) - { - builder.Append(" storage: "); - builder.AppendLine("["); - foreach (var item in Storage) - { - builder.AppendLine($" '{item.ToString()}'"); - } - builder.AppendLine(" ]"); - } - } - } - - 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(IdentityAccessPermissions)} does not support writing '{options.Format}' format."); } } - IdentityAccessPermissions 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. + IdentityAccessPermissions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual IdentityAccessPermissions 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 DeserializeIdentityAccessPermissions(document.RootElement, options); } default: @@ -324,6 +224,7 @@ IdentityAccessPermissions IPersistableModel.Create(Bi } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/IdentityAccessPermissions.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/IdentityAccessPermissions.cs index f85edbf8df2d..4892fce51453 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/IdentityAccessPermissions.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/IdentityAccessPermissions.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// Permissions the identity has for keys, secrets, certificates and storage. public partial class IdentityAccessPermissions { - /// - /// 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 . public IdentityAccessPermissions() @@ -59,25 +31,28 @@ public IdentityAccessPermissions() /// Permissions to secrets. /// Permissions to certificates. /// Permissions to storage accounts. - /// Keeps track of any properties unknown to the library. - internal IdentityAccessPermissions(IList keys, IList secrets, IList certificates, IList storage, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal IdentityAccessPermissions(IList keys, IList secrets, IList certificates, IList storage, IDictionary additionalBinaryDataProperties) { Keys = keys; Secrets = secrets; Certificates = certificates; Storage = storage; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Permissions to keys. [WirePath("keys")] public IList Keys { get; } + /// Permissions to secrets. [WirePath("secrets")] public IList Secrets { get; } + /// Permissions to certificates. [WirePath("certificates")] public IList Certificates { get; } + /// Permissions to storage accounts. [WirePath("storage")] public IList Storage { get; } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/IdentityAccessSecretPermission.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/IdentityAccessSecretPermission.cs index 355f3f8e94c8..2d6d38145b9a 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/IdentityAccessSecretPermission.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/IdentityAccessSecretPermission.cs @@ -7,21 +7,14 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - /// The IdentityAccessSecretPermission. + /// public readonly partial struct IdentityAccessSecretPermission : IEquatable { private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public IdentityAccessSecretPermission(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - private const string AllValue = "all"; private const string GetValue = "get"; private const string ListValue = "list"; @@ -32,41 +25,73 @@ public IdentityAccessSecretPermission(string value) private const string RecoverValue = "recover"; private const string PurgeValue = "purge"; - /// all. + /// Initializes a new instance of . + /// The value. + /// is null. + public IdentityAccessSecretPermission(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Gets the All. public static IdentityAccessSecretPermission All { get; } = new IdentityAccessSecretPermission(AllValue); - /// get. + + /// Gets the Get. public static IdentityAccessSecretPermission Get { get; } = new IdentityAccessSecretPermission(GetValue); - /// list. + + /// Gets the List. public static IdentityAccessSecretPermission List { get; } = new IdentityAccessSecretPermission(ListValue); - /// set. + + /// Gets the Set. public static IdentityAccessSecretPermission Set { get; } = new IdentityAccessSecretPermission(SetValue); - /// delete. + + /// Gets the Delete. public static IdentityAccessSecretPermission Delete { get; } = new IdentityAccessSecretPermission(DeleteValue); - /// backup. + + /// Gets the Backup. public static IdentityAccessSecretPermission Backup { get; } = new IdentityAccessSecretPermission(BackupValue); - /// restore. + + /// Gets the Restore. public static IdentityAccessSecretPermission Restore { get; } = new IdentityAccessSecretPermission(RestoreValue); - /// recover. + + /// Gets the Recover. public static IdentityAccessSecretPermission Recover { get; } = new IdentityAccessSecretPermission(RecoverValue); - /// purge. + + /// Gets the Purge. public static IdentityAccessSecretPermission Purge { get; } = new IdentityAccessSecretPermission(PurgeValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(IdentityAccessSecretPermission left, IdentityAccessSecretPermission right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(IdentityAccessSecretPermission left, IdentityAccessSecretPermission right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator IdentityAccessSecretPermission(string value) => new IdentityAccessSecretPermission(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator IdentityAccessSecretPermission?(string value) => value == null ? null : new IdentityAccessSecretPermission(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is IdentityAccessSecretPermission other && Equals(other); - /// + + /// public bool Equals(IdentityAccessSecretPermission other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/IdentityAccessStoragePermission.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/IdentityAccessStoragePermission.cs index c53affaf3d57..4e7b7e785897 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/IdentityAccessStoragePermission.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/IdentityAccessStoragePermission.cs @@ -7,21 +7,14 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - /// The IdentityAccessStoragePermission. + /// public readonly partial struct IdentityAccessStoragePermission : IEquatable { private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public IdentityAccessStoragePermission(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - private const string AllValue = "all"; private const string GetValue = "get"; private const string ListValue = "list"; @@ -38,53 +31,91 @@ public IdentityAccessStoragePermission(string value) private const string GetSasValue = "getsas"; private const string DeleteSasValue = "deletesas"; - /// all. + /// Initializes a new instance of . + /// The value. + /// is null. + public IdentityAccessStoragePermission(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Gets the All. public static IdentityAccessStoragePermission All { get; } = new IdentityAccessStoragePermission(AllValue); - /// get. + + /// Gets the Get. public static IdentityAccessStoragePermission Get { get; } = new IdentityAccessStoragePermission(GetValue); - /// list. + + /// Gets the List. public static IdentityAccessStoragePermission List { get; } = new IdentityAccessStoragePermission(ListValue); - /// delete. + + /// Gets the Delete. public static IdentityAccessStoragePermission Delete { get; } = new IdentityAccessStoragePermission(DeleteValue); - /// set. + + /// Gets the Set. public static IdentityAccessStoragePermission Set { get; } = new IdentityAccessStoragePermission(SetValue); - /// update. + + /// Gets the Update. public static IdentityAccessStoragePermission Update { get; } = new IdentityAccessStoragePermission(UpdateValue); - /// regeneratekey. + + /// Gets the RegenerateKey. public static IdentityAccessStoragePermission RegenerateKey { get; } = new IdentityAccessStoragePermission(RegenerateKeyValue); - /// recover. + + /// Gets the Recover. public static IdentityAccessStoragePermission Recover { get; } = new IdentityAccessStoragePermission(RecoverValue); - /// purge. + + /// Gets the Purge. public static IdentityAccessStoragePermission Purge { get; } = new IdentityAccessStoragePermission(PurgeValue); - /// backup. + + /// Gets the Backup. public static IdentityAccessStoragePermission Backup { get; } = new IdentityAccessStoragePermission(BackupValue); - /// restore. + + /// Gets the Restore. public static IdentityAccessStoragePermission Restore { get; } = new IdentityAccessStoragePermission(RestoreValue); - /// setsas. + + /// Gets the SetSas. public static IdentityAccessStoragePermission SetSas { get; } = new IdentityAccessStoragePermission(SetSasValue); - /// listsas. + + /// Gets the ListSas. public static IdentityAccessStoragePermission ListSas { get; } = new IdentityAccessStoragePermission(ListSasValue); - /// getsas. + + /// Gets the GetSas. public static IdentityAccessStoragePermission GetSas { get; } = new IdentityAccessStoragePermission(GetSasValue); - /// deletesas. + + /// Gets the DeleteSas. public static IdentityAccessStoragePermission DeleteSas { get; } = new IdentityAccessStoragePermission(DeleteSasValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(IdentityAccessStoragePermission left, IdentityAccessStoragePermission right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(IdentityAccessStoragePermission left, IdentityAccessStoragePermission right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator IdentityAccessStoragePermission(string value) => new IdentityAccessStoragePermission(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator IdentityAccessStoragePermission?(string value) => value == null ? null : new IdentityAccessStoragePermission(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is IdentityAccessStoragePermission other && Equals(other); - /// + + /// public bool Equals(IdentityAccessStoragePermission other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultAccessPolicy.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultAccessPolicy.Serialization.cs index 8fcfe3f24180..e6364e2a0a7f 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultAccessPolicy.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultAccessPolicy.Serialization.cs @@ -8,16 +8,21 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class KeyVaultAccessPolicy : IUtf8JsonSerializable, IJsonModel + /// An identity that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. + public partial class KeyVaultAccessPolicy : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal KeyVaultAccessPolicy() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -29,12 +34,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr /// The client options for reading and writing models. protected virtual 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(KeyVaultAccessPolicy)} does not support writing '{format}' format."); } - writer.WritePropertyName("tenantId"u8); writer.WriteStringValue(TenantId); writer.WritePropertyName("objectId"u8); @@ -46,15 +50,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WritePropertyName("permissions"u8); writer.WriteObjectValue(Permissions, options); - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -63,22 +67,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - KeyVaultAccessPolicy IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + KeyVaultAccessPolicy IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual KeyVaultAccessPolicy 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(KeyVaultAccessPolicy)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeKeyVaultAccessPolicy(document.RootElement, options); } - internal static KeyVaultAccessPolicy DeserializeKeyVaultAccessPolicy(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static KeyVaultAccessPolicy DeserializeKeyVaultAccessPolicy(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -87,147 +96,71 @@ internal static KeyVaultAccessPolicy DeserializeKeyVaultAccessPolicy(JsonElement string objectId = default; Guid? applicationId = default; IdentityAccessPermissions permissions = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tenantId"u8)) + if (prop.NameEquals("tenantId"u8)) { - tenantId = property.Value.GetGuid(); + tenantId = new Guid(prop.Value.GetString()); continue; } - if (property.NameEquals("objectId"u8)) + if (prop.NameEquals("objectId"u8)) { - objectId = property.Value.GetString(); + objectId = prop.Value.GetString(); continue; } - if (property.NameEquals("applicationId"u8)) + if (prop.NameEquals("applicationId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - applicationId = property.Value.GetGuid(); + applicationId = new Guid(prop.Value.GetString()); continue; } - if (property.NameEquals("permissions"u8)) + if (prop.NameEquals("permissions"u8)) { - permissions = IdentityAccessPermissions.DeserializeIdentityAccessPermissions(property.Value, options); + permissions = IdentityAccessPermissions.DeserializeIdentityAccessPermissions(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 KeyVaultAccessPolicy(tenantId, objectId, applicationId, permissions, serializedAdditionalRawData); + return new KeyVaultAccessPolicy(tenantId, objectId, applicationId, permissions, additionalBinaryDataProperties); } - 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(TenantId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" tenantId: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" tenantId: "); - builder.AppendLine($"'{TenantId.ToString()}'"); - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ObjectId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" objectId: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ObjectId)) - { - builder.Append(" objectId: "); - if (ObjectId.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{ObjectId}'''"); - } - else - { - builder.AppendLine($"'{ObjectId}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ApplicationId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" applicationId: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ApplicationId)) - { - builder.Append(" applicationId: "); - builder.AppendLine($"'{ApplicationId.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Permissions), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" permissions: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Permissions)) - { - builder.Append(" permissions: "); - BicepSerializationHelpers.AppendChildObject(builder, Permissions, options, 2, false, " permissions: "); - } - } - - 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(KeyVaultAccessPolicy)} does not support writing '{options.Format}' format."); } } - KeyVaultAccessPolicy 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. + KeyVaultAccessPolicy IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual KeyVaultAccessPolicy 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 DeserializeKeyVaultAccessPolicy(document.RootElement, options); } default: @@ -235,6 +168,7 @@ KeyVaultAccessPolicy IPersistableModel.Create(BinaryData d } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultAccessPolicy.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultAccessPolicy.cs index aae5b357e8e6..780f7abf0582 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultAccessPolicy.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultAccessPolicy.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// An identity that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. public partial class KeyVaultAccessPolicy { - /// - /// 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 . /// The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. @@ -65,30 +37,28 @@ public KeyVaultAccessPolicy(Guid tenantId, string objectId, IdentityAccessPermis /// The object ID of a user, service principal or security group in the Azure Active Directory tenant for the vault. The object ID must be unique for the list of access policies. /// Application ID of the client making request on behalf of a principal. /// Permissions the identity has for keys, secrets and certificates. - /// Keeps track of any properties unknown to the library. - internal KeyVaultAccessPolicy(Guid tenantId, string objectId, Guid? applicationId, IdentityAccessPermissions permissions, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal KeyVaultAccessPolicy(Guid tenantId, string objectId, Guid? applicationId, IdentityAccessPermissions permissions, IDictionary additionalBinaryDataProperties) { TenantId = tenantId; ObjectId = objectId; ApplicationId = applicationId; Permissions = permissions; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal KeyVaultAccessPolicy() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. [WirePath("tenantId")] public Guid TenantId { get; set; } + /// The object ID of a user, service principal or security group in the Azure Active Directory tenant for the vault. The object ID must be unique for the list of access policies. [WirePath("objectId")] public string ObjectId { get; set; } + /// Application ID of the client making request on behalf of a principal. [WirePath("applicationId")] public Guid? ApplicationId { get; set; } + /// Permissions the identity has for keys, secrets and certificates. [WirePath("permissions")] public IdentityAccessPermissions Permissions { get; set; } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultAccessPolicyParameters.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultAccessPolicyParameters.Serialization.cs index fb708ed3ca8e..ac1c1c7f548b 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultAccessPolicyParameters.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultAccessPolicyParameters.Serialization.cs @@ -8,17 +8,23 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Text; using System.Text.Json; +using Azure; using Azure.Core; -using Azure.ResourceManager.Models; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class KeyVaultAccessPolicyParameters : IUtf8JsonSerializable, IJsonModel + /// Parameters for updating the access policy in a vault. + public partial class KeyVaultAccessPolicyParameters : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal KeyVaultAccessPolicyParameters() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,15 +34,28 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mod /// The JSON writer. /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + protected virtual 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(KeyVaultAccessPolicyParameters)} does not support writing '{format}' format."); } - - base.JsonModelWriteCore(writer, options); + if (options.Format != "W" && Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W" && Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W" && Optional.IsDefined(Type)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); + } if (options.Format != "W" && Optional.IsDefined(Location)) { writer.WritePropertyName("location"u8); @@ -44,217 +63,129 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } writer.WritePropertyName("properties"u8); writer.WriteObjectValue(Properties, options); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } } - KeyVaultAccessPolicyParameters IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + KeyVaultAccessPolicyParameters IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual KeyVaultAccessPolicyParameters 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(KeyVaultAccessPolicyParameters)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeKeyVaultAccessPolicyParameters(document.RootElement, options); } - internal static KeyVaultAccessPolicyParameters DeserializeKeyVaultAccessPolicyParameters(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static KeyVaultAccessPolicyParameters DeserializeKeyVaultAccessPolicyParameters(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } + string id = default; + string name = default; + string @type = default; AzureLocation? location = default; KeyVaultAccessPolicyProperties properties = default; - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("location"u8)) + if (prop.NameEquals("id"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - location = new AzureLocation(property.Value.GetString()); - continue; - } - if (property.NameEquals("properties"u8)) - { - properties = KeyVaultAccessPolicyProperties.DeserializeKeyVaultAccessPolicyProperties(property.Value, options); + id = 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(); + @type = prop.Value.GetString(); continue; } - if (property.NameEquals("type"u8)) + if (prop.NameEquals("location"u8)) { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData"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); + location = new AzureLocation(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("properties"u8)) + { + properties = KeyVaultAccessPolicyProperties.DeserializeKeyVaultAccessPolicyProperties(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 KeyVaultAccessPolicyParameters( id, name, - type, - systemData, + @type, location, properties, - serializedAdditionalRawData); + additionalBinaryDataProperties); } - 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(Location), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" location: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Location)) - { - builder.Append(" location: "); - builder.AppendLine($"'{Location.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("AccessPolicies", out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" properties: "); - builder.AppendLine("{"); - builder.Append(" accessPolicies: "); - builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - } - 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(KeyVaultAccessPolicyParameters)} does not support writing '{options.Format}' format."); } } - KeyVaultAccessPolicyParameters 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. + KeyVaultAccessPolicyParameters IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual KeyVaultAccessPolicyParameters 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 DeserializeKeyVaultAccessPolicyParameters(document.RootElement, options); } default: @@ -262,6 +193,27 @@ KeyVaultAccessPolicyParameters IPersistableModel } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(KeyVaultAccessPolicyParameters keyVaultAccessPolicyParameters) + { + if (keyVaultAccessPolicyParameters == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(keyVaultAccessPolicyParameters, ModelSerializationExtensions.WireOptions); + return content; + } + + /// The to deserialize the from. + internal static KeyVaultAccessPolicyParameters FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeKeyVaultAccessPolicyParameters(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultAccessPolicyParameters.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultAccessPolicyParameters.cs index 602e9d5544b4..c82db4f0ba7d 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultAccessPolicyParameters.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultAccessPolicyParameters.cs @@ -8,44 +8,15 @@ using System; using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.Models; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// Parameters for updating the access policy in a vault. - public partial class KeyVaultAccessPolicyParameters : ResourceData + public partial class KeyVaultAccessPolicyParameters { - /// - /// 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 . /// Properties of the access policy. @@ -58,36 +29,58 @@ public KeyVaultAccessPolicyParameters(KeyVaultAccessPolicyProperties properties) } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. + /// 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. /// Properties of the access policy. - /// Keeps track of any properties unknown to the library. - internal KeyVaultAccessPolicyParameters(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, KeyVaultAccessPolicyProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal KeyVaultAccessPolicyParameters(string id, string name, string @type, AzureLocation? location, KeyVaultAccessPolicyProperties properties, IDictionary additionalBinaryDataProperties) { + Id = id; + Name = name; + Type = @type; Location = location; Properties = properties; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// Initializes a new instance of for deserialization. - internal KeyVaultAccessPolicyParameters() - { - } + /// The resource id of the access policy. + [WirePath("id")] + public string Id { get; } + + /// The resource name of the access policy. + [WirePath("name")] + public string Name { get; } + + /// The resource name of the access policy. + [WirePath("type")] + public string Type { get; } /// The resource type of the access policy. [WirePath("location")] public AzureLocation? Location { get; } + /// Properties of the access policy. + [WirePath("properties")] internal KeyVaultAccessPolicyProperties Properties { get; set; } + /// 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. [WirePath("properties.accessPolicies")] public IList AccessPolicies { - get => Properties is null ? default : Properties.AccessPolicies; - set => Properties = new KeyVaultAccessPolicyProperties(value); + get + { + if (Properties is null) + { + Properties = new KeyVaultAccessPolicyProperties(); + } + return Properties.AccessPolicies; + } + set + { + Properties = new KeyVaultAccessPolicyProperties(value); + } } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultAccessPolicyProperties.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultAccessPolicyProperties.Serialization.cs index ffca12032f9f..2c03160a808b 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultAccessPolicyProperties.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultAccessPolicyProperties.Serialization.cs @@ -8,17 +8,21 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class KeyVaultAccessPolicyProperties : IUtf8JsonSerializable, IJsonModel + /// Properties of the vault access policy. + public partial class KeyVaultAccessPolicyProperties : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal KeyVaultAccessPolicyProperties() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -30,28 +34,27 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mod /// The client options for reading and writing models. protected virtual 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(KeyVaultAccessPolicyProperties)} does not support writing '{format}' format."); } - writer.WritePropertyName("accessPolicies"u8); writer.WriteStartArray(); - foreach (var item in AccessPolicies) + foreach (KeyVaultAccessPolicy item in AccessPolicies) { writer.WriteObjectValue(item, options); } writer.WriteEndArray(); - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -60,35 +63,39 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - KeyVaultAccessPolicyProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + KeyVaultAccessPolicyProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual KeyVaultAccessPolicyProperties 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(KeyVaultAccessPolicyProperties)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeKeyVaultAccessPolicyProperties(document.RootElement, options); } - internal static KeyVaultAccessPolicyProperties DeserializeKeyVaultAccessPolicyProperties(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static KeyVaultAccessPolicyProperties DeserializeKeyVaultAccessPolicyProperties(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IList accessPolicies = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("accessPolicies"u8)) + if (prop.NameEquals("accessPolicies"u8)) { List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(KeyVaultAccessPolicy.DeserializeKeyVaultAccessPolicy(item, options)); } @@ -97,75 +104,42 @@ internal static KeyVaultAccessPolicyProperties DeserializeKeyVaultAccessPolicyPr } 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 KeyVaultAccessPolicyProperties(accessPolicies, serializedAdditionalRawData); + return new KeyVaultAccessPolicyProperties(accessPolicies, additionalBinaryDataProperties); } - 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(AccessPolicies), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" accessPolicies: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(AccessPolicies)) - { - if (AccessPolicies.Any()) - { - builder.Append(" accessPolicies: "); - builder.AppendLine("["); - foreach (var item in AccessPolicies) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " accessPolicies: "); - } - builder.AppendLine(" ]"); - } - } - } - - 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(KeyVaultAccessPolicyProperties)} does not support writing '{options.Format}' format."); } } - KeyVaultAccessPolicyProperties 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. + KeyVaultAccessPolicyProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual KeyVaultAccessPolicyProperties 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 DeserializeKeyVaultAccessPolicyProperties(document.RootElement, options); } default: @@ -173,6 +147,7 @@ KeyVaultAccessPolicyProperties IPersistableModel } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultAccessPolicyProperties.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultAccessPolicyProperties.cs index 78c26f4fca92..fbaa608d3d82 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultAccessPolicyProperties.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultAccessPolicyProperties.cs @@ -8,43 +8,15 @@ using System; using System.Collections.Generic; using System.Linq; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// Properties of the vault access policy. public partial class KeyVaultAccessPolicyProperties { - /// - /// 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 . /// 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. @@ -58,16 +30,11 @@ public KeyVaultAccessPolicyProperties(IEnumerable accessPo /// Initializes a new instance of . /// 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. - /// Keeps track of any properties unknown to the library. - internal KeyVaultAccessPolicyProperties(IList accessPolicies, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal KeyVaultAccessPolicyProperties(IList accessPolicies, IDictionary additionalBinaryDataProperties) { AccessPolicies = accessPolicies; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal KeyVaultAccessPolicyProperties() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// 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. diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultActionsRequiredMessage.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultActionsRequiredMessage.cs index 68c9ff90e088..14cd464fe9a2 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultActionsRequiredMessage.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultActionsRequiredMessage.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { @@ -14,35 +15,51 @@ namespace Azure.ResourceManager.KeyVault.Models public readonly partial struct KeyVaultActionsRequiredMessage : IEquatable { private readonly string _value; + private const string NoneValue = "None"; /// Initializes a new instance of . + /// The value. /// is null. public KeyVaultActionsRequiredMessage(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string NoneValue = "None"; + _value = value; + } - /// None. + /// Gets the None. public static KeyVaultActionsRequiredMessage None { get; } = new KeyVaultActionsRequiredMessage(NoneValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(KeyVaultActionsRequiredMessage left, KeyVaultActionsRequiredMessage right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(KeyVaultActionsRequiredMessage left, KeyVaultActionsRequiredMessage right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator KeyVaultActionsRequiredMessage(string value) => new KeyVaultActionsRequiredMessage(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator KeyVaultActionsRequiredMessage?(string value) => value == null ? null : new KeyVaultActionsRequiredMessage(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is KeyVaultActionsRequiredMessage other && Equals(other); - /// + + /// public bool Equals(KeyVaultActionsRequiredMessage other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultCreateMode.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultCreateMode.Serialization.cs index 65bce180566e..22f6a5a7baa0 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultCreateMode.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultCreateMode.Serialization.cs @@ -11,6 +11,7 @@ namespace Azure.ResourceManager.KeyVault.Models { internal static partial class KeyVaultCreateModeExtensions { + /// The value to serialize. public static string ToSerialString(this KeyVaultCreateMode value) => value switch { KeyVaultCreateMode.Default => "default", @@ -18,10 +19,17 @@ internal static partial class KeyVaultCreateModeExtensions _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown KeyVaultCreateMode value.") }; + /// The value to deserialize. public static KeyVaultCreateMode ToKeyVaultCreateMode(this string value) { - if (StringComparer.OrdinalIgnoreCase.Equals(value, "default")) return KeyVaultCreateMode.Default; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "recover")) return KeyVaultCreateMode.Recover; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "default")) + { + return KeyVaultCreateMode.Default; + } + if (StringComparer.OrdinalIgnoreCase.Equals(value, "recover")) + { + return KeyVaultCreateMode.Recover; + } throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown KeyVaultCreateMode value."); } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultCreateMode.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultCreateMode.cs index ca60f7c06de8..b0dc8c76d426 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultCreateMode.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultCreateMode.cs @@ -10,9 +10,9 @@ namespace Azure.ResourceManager.KeyVault.Models /// The vault's create mode to indicate whether the vault need to be recovered or not. public enum KeyVaultCreateMode { - /// default. + /// Default. Default, - /// recover. + /// Recover. Recover } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultCreateOrUpdateContent.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultCreateOrUpdateContent.Serialization.cs deleted file mode 100644 index 90bc0bde10ef..000000000000 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultCreateOrUpdateContent.Serialization.cs +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.KeyVault.Models -{ - public partial class KeyVaultCreateOrUpdateContent : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(KeyVaultCreateOrUpdateContent)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("location"u8); - writer.WriteStringValue(Location); - if (Optional.IsCollectionDefined(Tags)) - { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties, options); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - KeyVaultCreateOrUpdateContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(KeyVaultCreateOrUpdateContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeKeyVaultCreateOrUpdateContent(document.RootElement, options); - } - - internal static KeyVaultCreateOrUpdateContent DeserializeKeyVaultCreateOrUpdateContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - AzureLocation location = default; - IDictionary tags = default; - KeyVaultProperties properties = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("location"u8)) - { - location = new AzureLocation(property.Value.GetString()); - continue; - } - if (property.NameEquals("tags"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("properties"u8)) - { - properties = KeyVaultProperties.DeserializeKeyVaultProperties(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new KeyVaultCreateOrUpdateContent(location, tags ?? new ChangeTrackingDictionary(), properties, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerKeyVaultContext.Default); - default: - throw new FormatException($"The model {nameof(KeyVaultCreateOrUpdateContent)} does not support writing '{options.Format}' format."); - } - } - - KeyVaultCreateOrUpdateContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeKeyVaultCreateOrUpdateContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(KeyVaultCreateOrUpdateContent)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultCreateOrUpdateContent.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultCreateOrUpdateContent.cs deleted file mode 100644 index 6d72a105868e..000000000000 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultCreateOrUpdateContent.cs +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.KeyVault.Models -{ - /// Parameters for creating or updating a vault. - public partial class KeyVaultCreateOrUpdateContent - { - /// - /// 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; - - /// Initializes a new instance of . - /// The supported Azure location where the key vault should be created. - /// Properties of the vault. - /// is null. - public KeyVaultCreateOrUpdateContent(AzureLocation location, KeyVaultProperties properties) - { - Argument.AssertNotNull(properties, nameof(properties)); - - Location = location; - Tags = new ChangeTrackingDictionary(); - Properties = properties; - } - - /// 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. - /// Keeps track of any properties unknown to the library. - internal KeyVaultCreateOrUpdateContent(AzureLocation location, IDictionary tags, KeyVaultProperties properties, IDictionary serializedAdditionalRawData) - { - Location = location; - Tags = tags; - Properties = properties; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal KeyVaultCreateOrUpdateContent() - { - } - - /// The supported Azure location where the key vault should be created. - [WirePath("location")] - public AzureLocation Location { get; } - /// The tags that will be assigned to the key vault. - [WirePath("tags")] - public IDictionary Tags { get; } - /// Properties of the vault. - [WirePath("properties")] - public KeyVaultProperties Properties { get; } - } -} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultIPRule.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultIPRule.Serialization.cs index 79f354e8e4f0..982f2cfdfdd4 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultIPRule.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultIPRule.Serialization.cs @@ -8,16 +8,21 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class KeyVaultIPRule : IUtf8JsonSerializable, IJsonModel + /// A rule governing the accessibility of a vault from a specific ip address or ip range. + public partial class KeyVaultIPRule : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal KeyVaultIPRule() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -29,23 +34,22 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOp /// The client options for reading and writing models. protected virtual 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(KeyVaultIPRule)} does not support writing '{format}' format."); } - writer.WritePropertyName("value"u8); writer.WriteStringValue(AddressRange); - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -54,107 +58,78 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - KeyVaultIPRule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + KeyVaultIPRule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual KeyVaultIPRule 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(KeyVaultIPRule)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeKeyVaultIPRule(document.RootElement, options); } - internal static KeyVaultIPRule DeserializeKeyVaultIPRule(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static KeyVaultIPRule DeserializeKeyVaultIPRule(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - string value = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + string addressRange = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - value = property.Value.GetString(); + addressRange = prop.Value.GetString(); 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 KeyVaultIPRule(value, serializedAdditionalRawData); + return new KeyVaultIPRule(addressRange, additionalBinaryDataProperties); } - 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(AddressRange), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" value: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(AddressRange)) - { - builder.Append(" value: "); - if (AddressRange.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{AddressRange}'''"); - } - else - { - builder.AppendLine($"'{AddressRange}'"); - } - } - } - - 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(KeyVaultIPRule)} does not support writing '{options.Format}' format."); } } - KeyVaultIPRule 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. + KeyVaultIPRule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual KeyVaultIPRule 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 DeserializeKeyVaultIPRule(document.RootElement, options); } default: @@ -162,6 +137,7 @@ KeyVaultIPRule IPersistableModel.Create(BinaryData data, ModelRe } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultIPRule.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultIPRule.cs index 2293d578cb60..9b92a0e71b98 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultIPRule.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultIPRule.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// A rule governing the accessibility of a vault from a specific ip address or ip range. public partial class KeyVaultIPRule { - /// - /// 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 . /// An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). @@ -57,16 +29,11 @@ public KeyVaultIPRule(string addressRange) /// Initializes a new instance of . /// An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). - /// Keeps track of any properties unknown to the library. - internal KeyVaultIPRule(string addressRange, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal KeyVaultIPRule(string addressRange, IDictionary additionalBinaryDataProperties) { AddressRange = addressRange; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal KeyVaultIPRule() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNameAvailabilityContent.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNameAvailabilityContent.Serialization.cs index ff3a6929ca91..8983d63114fa 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNameAvailabilityContent.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNameAvailabilityContent.Serialization.cs @@ -10,13 +10,20 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class KeyVaultNameAvailabilityContent : IUtf8JsonSerializable, IJsonModel + /// The parameters used to check the availability of the vault name. + public partial class KeyVaultNameAvailabilityContent : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal KeyVaultNameAvailabilityContent() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,25 +35,24 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mo /// The client options for reading and writing models. protected virtual 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(KeyVaultNameAvailabilityContent)} does not support writing '{format}' format."); } - writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); writer.WritePropertyName("type"u8); writer.WriteStringValue(ResourceType); - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -55,55 +61,61 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - KeyVaultNameAvailabilityContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + KeyVaultNameAvailabilityContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual KeyVaultNameAvailabilityContent 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(KeyVaultNameAvailabilityContent)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeKeyVaultNameAvailabilityContent(document.RootElement, options); } - internal static KeyVaultNameAvailabilityContent DeserializeKeyVaultNameAvailabilityContent(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static KeyVaultNameAvailabilityContent DeserializeKeyVaultNameAvailabilityContent(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } string name = default; - ResourceType type = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + ResourceType resourceType = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("name"u8)) + if (prop.NameEquals("name"u8)) { - name = property.Value.GetString(); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("type"u8)) + if (prop.NameEquals("type"u8)) { - type = new ResourceType(property.Value.GetString()); + resourceType = new ResourceType(prop.Value.GetString()); 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 KeyVaultNameAvailabilityContent(name, type, serializedAdditionalRawData); + return new KeyVaultNameAvailabilityContent(name, resourceType, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -113,15 +125,20 @@ BinaryData IPersistableModel.Write(ModelReaderW } } - KeyVaultNameAvailabilityContent 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. + KeyVaultNameAvailabilityContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual KeyVaultNameAvailabilityContent 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 DeserializeKeyVaultNameAvailabilityContent(document.RootElement, options); } default: @@ -129,6 +146,19 @@ KeyVaultNameAvailabilityContent IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(KeyVaultNameAvailabilityContent keyVaultNameAvailabilityContent) + { + if (keyVaultNameAvailabilityContent == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(keyVaultNameAvailabilityContent, ModelSerializationExtensions.WireOptions); + return content; + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNameAvailabilityContent.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNameAvailabilityContent.cs index a42af3ea60cf..f988a76e59af 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNameAvailabilityContent.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNameAvailabilityContent.cs @@ -8,74 +8,43 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// The parameters used to check the availability of the vault name. public partial class KeyVaultNameAvailabilityContent { - /// - /// 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 . /// The vault name. + /// The type of resource, Microsoft.KeyVault/vaults. /// is null. - public KeyVaultNameAvailabilityContent(string name) + public KeyVaultNameAvailabilityContent(string name, ResourceType resourceType) { Argument.AssertNotNull(name, nameof(name)); Name = name; - ResourceType = "Microsoft.KeyVault/vaults"; + ResourceType = resourceType; } /// Initializes a new instance of . /// The vault name. /// The type of resource, Microsoft.KeyVault/vaults. - /// Keeps track of any properties unknown to the library. - internal KeyVaultNameAvailabilityContent(string name, ResourceType resourceType, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal KeyVaultNameAvailabilityContent(string name, ResourceType resourceType, IDictionary additionalBinaryDataProperties) { Name = name; ResourceType = resourceType; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal KeyVaultNameAvailabilityContent() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The vault name. [WirePath("name")] public string Name { get; } + /// The type of resource, Microsoft.KeyVault/vaults. [WirePath("type")] public ResourceType ResourceType { get; } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNameAvailabilityResult.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNameAvailabilityResult.Serialization.cs index 5ca078d0f899..2b59d43934f8 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNameAvailabilityResult.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNameAvailabilityResult.Serialization.cs @@ -8,16 +8,17 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class KeyVaultNameAvailabilityResult : IUtf8JsonSerializable, IJsonModel + /// The CheckNameAvailability operation response. + public partial class KeyVaultNameAvailabilityResult : 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(); @@ -29,12 +30,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mod /// The client options for reading and writing models. protected virtual 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(KeyVaultNameAvailabilityResult)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsDefined(NameAvailable)) { writer.WritePropertyName("nameAvailable"u8); @@ -50,15 +50,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("message"u8); writer.WriteStringValue(Message); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -67,22 +67,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - KeyVaultNameAvailabilityResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + KeyVaultNameAvailabilityResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual KeyVaultNameAvailabilityResult 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(KeyVaultNameAvailabilityResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeKeyVaultNameAvailabilityResult(document.RootElement, options); } - internal static KeyVaultNameAvailabilityResult DeserializeKeyVaultNameAvailabilityResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static KeyVaultNameAvailabilityResult DeserializeKeyVaultNameAvailabilityResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -90,135 +95,70 @@ internal static KeyVaultNameAvailabilityResult DeserializeKeyVaultNameAvailabili bool? nameAvailable = default; KeyVaultNameUnavailableReason? reason = default; string message = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("nameAvailable"u8)) + if (prop.NameEquals("nameAvailable"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - nameAvailable = property.Value.GetBoolean(); + nameAvailable = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("reason"u8)) + if (prop.NameEquals("reason"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - reason = property.Value.GetString().ToKeyVaultNameUnavailableReason(); + reason = prop.Value.GetString().ToKeyVaultNameUnavailableReason(); continue; } - if (property.NameEquals("message"u8)) + if (prop.NameEquals("message"u8)) { - message = property.Value.GetString(); + message = prop.Value.GetString(); 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 KeyVaultNameAvailabilityResult(nameAvailable, reason, message, serializedAdditionalRawData); + return new KeyVaultNameAvailabilityResult(nameAvailable, reason, message, additionalBinaryDataProperties); } - 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(NameAvailable), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nameAvailable: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NameAvailable)) - { - builder.Append(" nameAvailable: "); - var boolValue = NameAvailable.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Reason), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" reason: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Reason)) - { - builder.Append(" reason: "); - builder.AppendLine($"'{Reason.Value.ToSerialString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Message), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" message: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Message)) - { - builder.Append(" message: "); - if (Message.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Message}'''"); - } - else - { - builder.AppendLine($"'{Message}'"); - } - } - } - - 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(KeyVaultNameAvailabilityResult)} does not support writing '{options.Format}' format."); } } - KeyVaultNameAvailabilityResult 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. + KeyVaultNameAvailabilityResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual KeyVaultNameAvailabilityResult 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 DeserializeKeyVaultNameAvailabilityResult(document.RootElement, options); } default: @@ -226,6 +166,15 @@ KeyVaultNameAvailabilityResult IPersistableModel } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static KeyVaultNameAvailabilityResult FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeKeyVaultNameAvailabilityResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNameAvailabilityResult.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNameAvailabilityResult.cs index 893ea7bb5b7c..3dbc0c9e5631 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNameAvailabilityResult.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNameAvailabilityResult.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// The CheckNameAvailability operation response. public partial class KeyVaultNameAvailabilityResult { - /// - /// 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 KeyVaultNameAvailabilityResult() @@ -54,21 +26,23 @@ internal KeyVaultNameAvailabilityResult() /// 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. - /// Keeps track of any properties unknown to the library. - internal KeyVaultNameAvailabilityResult(bool? nameAvailable, KeyVaultNameUnavailableReason? reason, string message, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal KeyVaultNameAvailabilityResult(bool? nameAvailable, KeyVaultNameUnavailableReason? reason, string message, IDictionary additionalBinaryDataProperties) { NameAvailable = nameAvailable; Reason = reason; Message = message; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// 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. [WirePath("nameAvailable")] public bool? NameAvailable { get; } + /// The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false. [WirePath("reason")] public KeyVaultNameUnavailableReason? Reason { get; } + /// An error message explaining the Reason value in more detail. [WirePath("message")] public string Message { get; } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNameUnavailableReason.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNameUnavailableReason.Serialization.cs index b16319c3638a..85d1a7137f7c 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNameUnavailableReason.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNameUnavailableReason.Serialization.cs @@ -11,6 +11,7 @@ namespace Azure.ResourceManager.KeyVault.Models { internal static partial class KeyVaultNameUnavailableReasonExtensions { + /// The value to serialize. public static string ToSerialString(this KeyVaultNameUnavailableReason value) => value switch { KeyVaultNameUnavailableReason.AccountNameInvalid => "AccountNameInvalid", @@ -18,10 +19,17 @@ internal static partial class KeyVaultNameUnavailableReasonExtensions _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown KeyVaultNameUnavailableReason value.") }; + /// The value to deserialize. public static KeyVaultNameUnavailableReason ToKeyVaultNameUnavailableReason(this string value) { - if (StringComparer.OrdinalIgnoreCase.Equals(value, "AccountNameInvalid")) return KeyVaultNameUnavailableReason.AccountNameInvalid; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "AlreadyExists")) return KeyVaultNameUnavailableReason.AlreadyExists; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "AccountNameInvalid")) + { + return KeyVaultNameUnavailableReason.AccountNameInvalid; + } + if (StringComparer.OrdinalIgnoreCase.Equals(value, "AlreadyExists")) + { + return KeyVaultNameUnavailableReason.AlreadyExists; + } throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown KeyVaultNameUnavailableReason value."); } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNetworkRuleAction.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNetworkRuleAction.cs index 14edee116a27..432f697b858d 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNetworkRuleAction.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNetworkRuleAction.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { @@ -14,38 +15,55 @@ namespace Azure.ResourceManager.KeyVault.Models public readonly partial struct KeyVaultNetworkRuleAction : IEquatable { private readonly string _value; + private const string AllowValue = "Allow"; + private const string DenyValue = "Deny"; /// Initializes a new instance of . + /// The value. /// is null. public KeyVaultNetworkRuleAction(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string AllowValue = "Allow"; - private const string DenyValue = "Deny"; + _value = value; + } - /// Allow. + /// Gets the Allow. public static KeyVaultNetworkRuleAction Allow { get; } = new KeyVaultNetworkRuleAction(AllowValue); - /// Deny. + + /// Gets the Deny. public static KeyVaultNetworkRuleAction Deny { get; } = new KeyVaultNetworkRuleAction(DenyValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(KeyVaultNetworkRuleAction left, KeyVaultNetworkRuleAction right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(KeyVaultNetworkRuleAction left, KeyVaultNetworkRuleAction right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator KeyVaultNetworkRuleAction(string value) => new KeyVaultNetworkRuleAction(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator KeyVaultNetworkRuleAction?(string value) => value == null ? null : new KeyVaultNetworkRuleAction(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is KeyVaultNetworkRuleAction other && Equals(other); - /// + + /// public bool Equals(KeyVaultNetworkRuleAction other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNetworkRuleBypassOption.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNetworkRuleBypassOption.cs index 5f761d65b6d2..420fbc5438ce 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNetworkRuleBypassOption.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNetworkRuleBypassOption.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { @@ -14,38 +15,55 @@ namespace Azure.ResourceManager.KeyVault.Models public readonly partial struct KeyVaultNetworkRuleBypassOption : IEquatable { private readonly string _value; + private const string AzureServicesValue = "AzureServices"; + private const string NoneValue = "None"; /// Initializes a new instance of . + /// The value. /// is null. public KeyVaultNetworkRuleBypassOption(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string AzureServicesValue = "AzureServices"; - private const string NoneValue = "None"; + _value = value; + } - /// AzureServices. + /// Gets the AzureServices. public static KeyVaultNetworkRuleBypassOption AzureServices { get; } = new KeyVaultNetworkRuleBypassOption(AzureServicesValue); - /// None. + + /// Gets the None. public static KeyVaultNetworkRuleBypassOption None { get; } = new KeyVaultNetworkRuleBypassOption(NoneValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(KeyVaultNetworkRuleBypassOption left, KeyVaultNetworkRuleBypassOption right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(KeyVaultNetworkRuleBypassOption left, KeyVaultNetworkRuleBypassOption right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator KeyVaultNetworkRuleBypassOption(string value) => new KeyVaultNetworkRuleBypassOption(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator KeyVaultNetworkRuleBypassOption?(string value) => value == null ? null : new KeyVaultNetworkRuleBypassOption(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is KeyVaultNetworkRuleBypassOption other && Equals(other); - /// + + /// public bool Equals(KeyVaultNetworkRuleBypassOption other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNetworkRuleSet.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNetworkRuleSet.Serialization.cs index d1b92642786f..584945edf3ca 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNetworkRuleSet.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNetworkRuleSet.Serialization.cs @@ -8,17 +8,16 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class KeyVaultNetworkRuleSet : IUtf8JsonSerializable, IJsonModel + /// A set of rules governing the network accessibility of a vault. + public partial class KeyVaultNetworkRuleSet : 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(); @@ -30,12 +29,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReader /// The client options for reading and writing models. protected virtual 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(KeyVaultNetworkRuleSet)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Bypass)) { writer.WritePropertyName("bypass"u8); @@ -46,11 +44,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("defaultAction"u8); writer.WriteStringValue(DefaultAction.Value.ToString()); } - if (Optional.IsCollectionDefined(IPRules)) + if (Optional.IsCollectionDefined(IpRules)) { writer.WritePropertyName("ipRules"u8); writer.WriteStartArray(); - foreach (var item in IPRules) + foreach (KeyVaultIPRule item in IpRules) { writer.WriteObjectValue(item, options); } @@ -60,21 +58,21 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("virtualNetworkRules"u8); writer.WriteStartArray(); - foreach (var item in VirtualNetworkRules) + foreach (KeyVaultVirtualNetworkRule item in VirtualNetworkRules) { writer.WriteObjectValue(item, options); } writer.WriteEndArray(); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -83,22 +81,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - KeyVaultNetworkRuleSet IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + KeyVaultNetworkRuleSet IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual KeyVaultNetworkRuleSet 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(KeyVaultNetworkRuleSet)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeKeyVaultNetworkRuleSet(document.RootElement, options); } - internal static KeyVaultNetworkRuleSet DeserializeKeyVaultNetworkRuleSet(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static KeyVaultNetworkRuleSet DeserializeKeyVaultNetworkRuleSet(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -107,50 +110,49 @@ internal static KeyVaultNetworkRuleSet DeserializeKeyVaultNetworkRuleSet(JsonEle KeyVaultNetworkRuleAction? defaultAction = default; IList ipRules = default; IList virtualNetworkRules = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("bypass"u8)) + if (prop.NameEquals("bypass"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - bypass = new KeyVaultNetworkRuleBypassOption(property.Value.GetString()); + bypass = new KeyVaultNetworkRuleBypassOption(prop.Value.GetString()); continue; } - if (property.NameEquals("defaultAction"u8)) + if (prop.NameEquals("defaultAction"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - defaultAction = new KeyVaultNetworkRuleAction(property.Value.GetString()); + defaultAction = new KeyVaultNetworkRuleAction(prop.Value.GetString()); continue; } - if (property.NameEquals("ipRules"u8)) + if (prop.NameEquals("ipRules"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(KeyVaultIPRule.DeserializeKeyVaultIPRule(item, options)); } ipRules = array; continue; } - if (property.NameEquals("virtualNetworkRules"u8)) + if (prop.NameEquals("virtualNetworkRules"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(KeyVaultVirtualNetworkRule.DeserializeKeyVaultVirtualNetworkRule(item, options)); } @@ -159,128 +161,42 @@ internal static KeyVaultNetworkRuleSet DeserializeKeyVaultNetworkRuleSet(JsonEle } 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 KeyVaultNetworkRuleSet(bypass, defaultAction, ipRules ?? new ChangeTrackingList(), virtualNetworkRules ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new KeyVaultNetworkRuleSet(bypass, defaultAction, ipRules ?? new ChangeTrackingList(), virtualNetworkRules ?? new ChangeTrackingList(), additionalBinaryDataProperties); } - 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(Bypass), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" bypass: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Bypass)) - { - builder.Append(" bypass: "); - builder.AppendLine($"'{Bypass.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DefaultAction), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" defaultAction: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(DefaultAction)) - { - builder.Append(" defaultAction: "); - builder.AppendLine($"'{DefaultAction.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IPRules), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" ipRules: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(IPRules)) - { - if (IPRules.Any()) - { - builder.Append(" ipRules: "); - builder.AppendLine("["); - foreach (var item in IPRules) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " ipRules: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VirtualNetworkRules), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" virtualNetworkRules: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(VirtualNetworkRules)) - { - if (VirtualNetworkRules.Any()) - { - builder.Append(" virtualNetworkRules: "); - builder.AppendLine("["); - foreach (var item in VirtualNetworkRules) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " virtualNetworkRules: "); - } - builder.AppendLine(" ]"); - } - } - } - - 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(KeyVaultNetworkRuleSet)} does not support writing '{options.Format}' format."); } } - KeyVaultNetworkRuleSet 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. + KeyVaultNetworkRuleSet IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual KeyVaultNetworkRuleSet 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 DeserializeKeyVaultNetworkRuleSet(document.RootElement, options); } default: @@ -288,6 +204,7 @@ KeyVaultNetworkRuleSet IPersistableModel.Create(BinaryDa } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNetworkRuleSet.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNetworkRuleSet.cs index c132b5526183..6b659a8b3ee7 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNetworkRuleSet.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultNetworkRuleSet.cs @@ -7,48 +7,20 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// A set of rules governing the network accessibility of a vault. public partial class KeyVaultNetworkRuleSet { - /// - /// 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 . public KeyVaultNetworkRuleSet() { - IPRules = new ChangeTrackingList(); + IpRules = new ChangeTrackingList(); VirtualNetworkRules = new ChangeTrackingList(); } @@ -57,25 +29,28 @@ public KeyVaultNetworkRuleSet() /// 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. - /// Keeps track of any properties unknown to the library. - internal KeyVaultNetworkRuleSet(KeyVaultNetworkRuleBypassOption? bypass, KeyVaultNetworkRuleAction? defaultAction, IList ipRules, IList virtualNetworkRules, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal KeyVaultNetworkRuleSet(KeyVaultNetworkRuleBypassOption? bypass, KeyVaultNetworkRuleAction? defaultAction, IList ipRules, IList virtualNetworkRules, IDictionary additionalBinaryDataProperties) { Bypass = bypass; DefaultAction = defaultAction; - IPRules = ipRules; + IpRules = ipRules; VirtualNetworkRules = virtualNetworkRules; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. [WirePath("bypass")] public KeyVaultNetworkRuleBypassOption? Bypass { get; set; } + /// The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. [WirePath("defaultAction")] public KeyVaultNetworkRuleAction? DefaultAction { get; set; } + /// The list of IP address rules. [WirePath("ipRules")] - public IList IPRules { get; } + public IList IpRules { get; } + /// The list of virtual network rules. [WirePath("virtualNetworkRules")] public IList VirtualNetworkRules { get; } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatch.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatch.Serialization.cs index ff67e36ac9f3..0862094cbd9b 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatch.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatch.Serialization.cs @@ -10,13 +10,15 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class KeyVaultPatch : IUtf8JsonSerializable, IJsonModel + /// Parameters for creating or updating a vault. + public partial class KeyVaultPatch : 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(); @@ -28,12 +30,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOpt /// The client options for reading and writing models. protected virtual 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(KeyVaultPatch)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"u8); @@ -41,6 +42,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit foreach (var item in Tags) { writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } writer.WriteStringValue(item.Value); } writer.WriteEndObject(); @@ -50,15 +56,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("properties"u8); writer.WriteObjectValue(Properties, options); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -67,68 +73,81 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - KeyVaultPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + KeyVaultPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual KeyVaultPatch 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(KeyVaultPatch)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeKeyVaultPatch(document.RootElement, options); } - internal static KeyVaultPatch DeserializeKeyVaultPatch(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static KeyVaultPatch DeserializeKeyVaultPatch(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IDictionary tags = default; KeyVaultPatchProperties properties = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) + foreach (var prop0 in prop.Value.EnumerateObject()) { - dictionary.Add(property0.Name, property0.Value.GetString()); + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } } tags = dictionary; continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("properties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - properties = KeyVaultPatchProperties.DeserializeKeyVaultPatchProperties(property.Value, options); + properties = KeyVaultPatchProperties.DeserializeKeyVaultPatchProperties(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 KeyVaultPatch(tags ?? new ChangeTrackingDictionary(), properties, serializedAdditionalRawData); + return new KeyVaultPatch(tags ?? new ChangeTrackingDictionary(), properties, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -138,15 +157,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions optio } } - KeyVaultPatch 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. + KeyVaultPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual KeyVaultPatch 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 DeserializeKeyVaultPatch(document.RootElement, options); } default: @@ -154,6 +178,19 @@ KeyVaultPatch IPersistableModel.Create(BinaryData data, ModelRead } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(KeyVaultPatch keyVaultPatch) + { + if (keyVaultPatch == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(keyVaultPatch, ModelSerializationExtensions.WireOptions); + return content; + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatch.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatch.cs index 43fccf1bbf45..bcc8d1ed1c5f 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatch.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatch.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// Parameters for creating or updating a vault. public partial class KeyVaultPatch { - /// - /// 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 . public KeyVaultPatch() @@ -54,17 +26,18 @@ public KeyVaultPatch() /// Initializes a new instance of . /// The tags that will be assigned to the key vault. /// Properties of the vault. - /// Keeps track of any properties unknown to the library. - internal KeyVaultPatch(IDictionary tags, KeyVaultPatchProperties properties, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal KeyVaultPatch(IDictionary tags, KeyVaultPatchProperties properties, IDictionary additionalBinaryDataProperties) { Tags = tags; Properties = properties; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The tags that will be assigned to the key vault. [WirePath("tags")] public IDictionary Tags { get; } + /// Properties of the vault. [WirePath("properties")] public KeyVaultPatchProperties Properties { get; set; } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatchMode.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatchMode.Serialization.cs index 562f2beb7c5b..5396b26df704 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatchMode.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatchMode.Serialization.cs @@ -11,6 +11,7 @@ namespace Azure.ResourceManager.KeyVault.Models { internal static partial class KeyVaultPatchModeExtensions { + /// The value to serialize. public static string ToSerialString(this KeyVaultPatchMode value) => value switch { KeyVaultPatchMode.Default => "default", @@ -18,10 +19,17 @@ internal static partial class KeyVaultPatchModeExtensions _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown KeyVaultPatchMode value.") }; + /// The value to deserialize. public static KeyVaultPatchMode ToKeyVaultPatchMode(this string value) { - if (StringComparer.OrdinalIgnoreCase.Equals(value, "default")) return KeyVaultPatchMode.Default; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "recover")) return KeyVaultPatchMode.Recover; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "default")) + { + return KeyVaultPatchMode.Default; + } + if (StringComparer.OrdinalIgnoreCase.Equals(value, "recover")) + { + return KeyVaultPatchMode.Recover; + } throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown KeyVaultPatchMode value."); } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatchMode.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatchMode.cs index 0a21b41a40dc..baad697f6956 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatchMode.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatchMode.cs @@ -10,9 +10,9 @@ namespace Azure.ResourceManager.KeyVault.Models /// The vault's create mode to indicate whether the vault need to be recovered or not. public enum KeyVaultPatchMode { - /// default. + /// Default. Default, - /// recover. + /// Recover. Recover } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatchProperties.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatchProperties.Serialization.cs index d52a9065b411..32a63f379e3c 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatchProperties.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatchProperties.Serialization.cs @@ -9,14 +9,15 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class KeyVaultPatchProperties : IUtf8JsonSerializable, IJsonModel + /// Properties of the vault. + public partial class KeyVaultPatchProperties : 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(); @@ -28,12 +29,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade /// The client options for reading and writing models. protected virtual 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(KeyVaultPatchProperties)} does not support writing '{format}' format."); } - if (Optional.IsDefined(TenantId)) { writer.WritePropertyName("tenantId"u8); @@ -48,7 +48,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("accessPolicies"u8); writer.WriteStartArray(); - foreach (var item in AccessPolicies) + foreach (KeyVaultAccessPolicy item in AccessPolicies) { writer.WriteObjectValue(item, options); } @@ -104,15 +104,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("publicNetworkAccess"u8); writer.WriteStringValue(PublicNetworkAccess); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -121,22 +121,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - KeyVaultPatchProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + KeyVaultPatchProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual KeyVaultPatchProperties 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(KeyVaultPatchProperties)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeKeyVaultPatchProperties(document.RootElement, options); } - internal static KeyVaultPatchProperties DeserializeKeyVaultPatchProperties(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static KeyVaultPatchProperties DeserializeKeyVaultPatchProperties(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -152,136 +157,134 @@ internal static KeyVaultPatchProperties DeserializeKeyVaultPatchProperties(JsonE int? softDeleteRetentionInDays = default; KeyVaultPatchMode? createMode = default; bool? enablePurgeProtection = default; - KeyVaultNetworkRuleSet networkAcls = default; + KeyVaultNetworkRuleSet networkRuleSet = default; string publicNetworkAccess = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tenantId"u8)) + if (prop.NameEquals("tenantId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - tenantId = property.Value.GetGuid(); + tenantId = new Guid(prop.Value.GetString()); continue; } - if (property.NameEquals("sku"u8)) + if (prop.NameEquals("sku"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - sku = KeyVaultSku.DeserializeKeyVaultSku(property.Value, options); + sku = KeyVaultSku.DeserializeKeyVaultSku(prop.Value, options); continue; } - if (property.NameEquals("accessPolicies"u8)) + if (prop.NameEquals("accessPolicies"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(KeyVaultAccessPolicy.DeserializeKeyVaultAccessPolicy(item, options)); } accessPolicies = array; continue; } - if (property.NameEquals("enabledForDeployment"u8)) + if (prop.NameEquals("enabledForDeployment"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - enabledForDeployment = property.Value.GetBoolean(); + enabledForDeployment = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("enabledForDiskEncryption"u8)) + if (prop.NameEquals("enabledForDiskEncryption"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - enabledForDiskEncryption = property.Value.GetBoolean(); + enabledForDiskEncryption = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("enabledForTemplateDeployment"u8)) + if (prop.NameEquals("enabledForTemplateDeployment"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - enabledForTemplateDeployment = property.Value.GetBoolean(); + enabledForTemplateDeployment = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("enableSoftDelete"u8)) + if (prop.NameEquals("enableSoftDelete"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - enableSoftDelete = property.Value.GetBoolean(); + enableSoftDelete = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("enableRbacAuthorization"u8)) + if (prop.NameEquals("enableRbacAuthorization"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - enableRbacAuthorization = property.Value.GetBoolean(); + enableRbacAuthorization = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("softDeleteRetentionInDays"u8)) + if (prop.NameEquals("softDeleteRetentionInDays"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - softDeleteRetentionInDays = property.Value.GetInt32(); + softDeleteRetentionInDays = prop.Value.GetInt32(); continue; } - if (property.NameEquals("createMode"u8)) + if (prop.NameEquals("createMode"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - createMode = property.Value.GetString().ToKeyVaultPatchMode(); + createMode = prop.Value.GetString().ToKeyVaultPatchMode(); continue; } - if (property.NameEquals("enablePurgeProtection"u8)) + if (prop.NameEquals("enablePurgeProtection"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - enablePurgeProtection = property.Value.GetBoolean(); + enablePurgeProtection = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("networkAcls"u8)) + if (prop.NameEquals("networkAcls"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - networkAcls = KeyVaultNetworkRuleSet.DeserializeKeyVaultNetworkRuleSet(property.Value, options); + networkRuleSet = KeyVaultNetworkRuleSet.DeserializeKeyVaultNetworkRuleSet(prop.Value, options); continue; } - if (property.NameEquals("publicNetworkAccess"u8)) + if (prop.NameEquals("publicNetworkAccess"u8)) { - publicNetworkAccess = property.Value.GetString(); + publicNetworkAccess = prop.Value.GetString(); 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 KeyVaultPatchProperties( tenantId, sku, @@ -294,15 +297,18 @@ internal static KeyVaultPatchProperties DeserializeKeyVaultPatchProperties(JsonE softDeleteRetentionInDays, createMode, enablePurgeProtection, - networkAcls, + networkRuleSet, publicNetworkAccess, - serializedAdditionalRawData); + additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -312,15 +318,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpt } } - KeyVaultPatchProperties 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. + KeyVaultPatchProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual KeyVaultPatchProperties 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 DeserializeKeyVaultPatchProperties(document.RootElement, options); } default: @@ -328,6 +339,7 @@ KeyVaultPatchProperties IPersistableModel.Create(Binary } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatchProperties.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatchProperties.cs index 8aa5ce2cf91d..e8fecb970aec 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatchProperties.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatchProperties.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// Properties of the vault. public partial class KeyVaultPatchProperties { - /// - /// 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 . public KeyVaultPatchProperties() @@ -65,8 +37,8 @@ public KeyVaultPatchProperties() /// 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. - /// Keeps track of any properties unknown to the library. - internal KeyVaultPatchProperties(Guid? tenantId, KeyVaultSku sku, IList accessPolicies, bool? enabledForDeployment, bool? enabledForDiskEncryption, bool? enabledForTemplateDeployment, bool? enableSoftDelete, bool? enableRbacAuthorization, int? softDeleteRetentionInDays, KeyVaultPatchMode? createMode, bool? enablePurgeProtection, KeyVaultNetworkRuleSet networkRuleSet, string publicNetworkAccess, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal KeyVaultPatchProperties(Guid? tenantId, KeyVaultSku sku, IList accessPolicies, bool? enabledForDeployment, bool? enabledForDiskEncryption, bool? enabledForTemplateDeployment, bool? enableSoftDelete, bool? enableRbacAuthorization, int? softDeleteRetentionInDays, KeyVaultPatchMode? createMode, bool? enablePurgeProtection, KeyVaultNetworkRuleSet networkRuleSet, string publicNetworkAccess, IDictionary additionalBinaryDataProperties) { TenantId = tenantId; Sku = sku; @@ -81,45 +53,57 @@ internal KeyVaultPatchProperties(Guid? tenantId, KeyVaultSku sku, IList The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. [WirePath("tenantId")] public Guid? TenantId { get; set; } + /// SKU details. [WirePath("sku")] public KeyVaultSku Sku { get; set; } + /// 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. [WirePath("accessPolicies")] public IList AccessPolicies { get; } + /// Property to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from the key vault. [WirePath("enabledForDeployment")] public bool? EnabledForDeployment { get; set; } + /// Property to specify whether Azure Disk Encryption is permitted to retrieve secrets from the vault and unwrap keys. [WirePath("enabledForDiskEncryption")] public bool? EnabledForDiskEncryption { get; set; } + /// Property to specify whether Azure Resource Manager is permitted to retrieve secrets from the key vault. [WirePath("enabledForTemplateDeployment")] public bool? EnabledForTemplateDeployment { get; set; } + /// Property to specify whether the 'soft delete' functionality is enabled for this key vault. Once set to true, it cannot be reverted to false. [WirePath("enableSoftDelete")] public bool? EnableSoftDelete { get; set; } + /// 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. [WirePath("enableRbacAuthorization")] public bool? EnableRbacAuthorization { get; set; } + /// softDelete data retention days. It accepts >=7 and <=90. [WirePath("softDeleteRetentionInDays")] public int? SoftDeleteRetentionInDays { get; set; } + /// The vault's create mode to indicate whether the vault need to be recovered or not. [WirePath("createMode")] public KeyVaultPatchMode? CreateMode { get; set; } + /// 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. [WirePath("enablePurgeProtection")] public bool? EnablePurgeProtection { get; set; } + /// A collection of rules governing the accessibility of the vault from specific network locations. [WirePath("networkAcls")] public KeyVaultNetworkRuleSet NetworkRuleSet { get; set; } + /// 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. [WirePath("publicNetworkAccess")] public string PublicNetworkAccess { get; set; } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateEndpointConnectionItemData.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateEndpointConnectionItemData.Serialization.cs index 2ebed13d0118..da40b0717056 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateEndpointConnectionItemData.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateEndpointConnectionItemData.Serialization.cs @@ -8,17 +8,17 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Text; using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.Resources.Models; +using Azure; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class KeyVaultPrivateEndpointConnectionItemData : IUtf8JsonSerializable, IJsonModel + /// Private endpoint connection item. + public partial class KeyVaultPrivateEndpointConnectionItemData : 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(); @@ -30,12 +30,11 @@ void IJsonModel.Write(Utf8JsonWriter /// The client options for reading and writing models. protected virtual 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(KeyVaultPrivateEndpointConnectionItemData)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Id)) { writer.WritePropertyName("id"u8); @@ -46,33 +45,20 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("etag"u8); writer.WriteStringValue(ETag.Value.ToString()); } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(PrivateEndpoint)) - { - writer.WritePropertyName("privateEndpoint"u8); - ((IJsonModel)PrivateEndpoint).Write(writer, options); - } - if (Optional.IsDefined(ConnectionState)) - { - writer.WritePropertyName("privateLinkServiceConnectionState"u8); - writer.WriteObjectValue(ConnectionState, options); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - writer.WriteEndObject(); - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -81,233 +67,98 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - KeyVaultPrivateEndpointConnectionItemData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + KeyVaultPrivateEndpointConnectionItemData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual KeyVaultPrivateEndpointConnectionItemData 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(KeyVaultPrivateEndpointConnectionItemData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeKeyVaultPrivateEndpointConnectionItemData(document.RootElement, options); } - internal static KeyVaultPrivateEndpointConnectionItemData DeserializeKeyVaultPrivateEndpointConnectionItemData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static KeyVaultPrivateEndpointConnectionItemData DeserializeKeyVaultPrivateEndpointConnectionItemData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } string id = default; - ETag? etag = default; - SubResource privateEndpoint = default; - KeyVaultPrivateLinkServiceConnectionState privateLinkServiceConnectionState = default; - KeyVaultPrivateEndpointConnectionProvisioningState? provisioningState = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + ETag? eTag = default; + PrivateEndpointConnectionProperties properties = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("id"u8)) + if (prop.NameEquals("id"u8)) { - id = property.Value.GetString(); + id = prop.Value.GetString(); continue; } - if (property.NameEquals("etag"u8)) + if (prop.NameEquals("etag"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - etag = new ETag(property.Value.GetString()); + eTag = new ETag(prop.Value.GetString()); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("properties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("privateEndpoint"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - privateEndpoint = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property0.Value.GetRawText())), options, AzureResourceManagerKeyVaultContext.Default); - continue; - } - if (property0.NameEquals("privateLinkServiceConnectionState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - privateLinkServiceConnectionState = KeyVaultPrivateLinkServiceConnectionState.DeserializeKeyVaultPrivateLinkServiceConnectionState(property0.Value, options); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new KeyVaultPrivateEndpointConnectionProvisioningState(property0.Value.GetString()); - continue; - } - } + properties = PrivateEndpointConnectionProperties.DeserializePrivateEndpointConnectionProperties(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 KeyVaultPrivateEndpointConnectionItemData( - id, - etag, - privateEndpoint, - privateLinkServiceConnectionState, - provisioningState, - serializedAdditionalRawData); + return new KeyVaultPrivateEndpointConnectionItemData(id, eTag, properties, additionalBinaryDataProperties); } - 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(Id), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" id: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Id)) - { - builder.Append(" id: "); - if (Id.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Id}'''"); - } - else - { - builder.AppendLine($"'{Id}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ETag), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" etag: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ETag)) - { - builder.Append(" etag: "); - builder.AppendLine($"'{ETag.Value.ToString()}'"); - } - } - - builder.Append(" properties:"); - builder.AppendLine(" {"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("PrivateEndpointId", out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" privateEndpoint: "); - builder.AppendLine("{"); - builder.AppendLine(" privateEndpoint: {"); - builder.Append(" id: "); - builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - builder.AppendLine(" }"); - } - else - { - if (Optional.IsDefined(PrivateEndpoint)) - { - builder.Append(" privateEndpoint: "); - BicepSerializationHelpers.AppendChildObject(builder, PrivateEndpoint, options, 4, false, " privateEndpoint: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ConnectionState), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" privateLinkServiceConnectionState: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ConnectionState)) - { - builder.Append(" privateLinkServiceConnectionState: "); - BicepSerializationHelpers.AppendChildObject(builder, ConnectionState, options, 4, false, " privateLinkServiceConnectionState: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" provisioningState: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ProvisioningState)) - { - builder.Append(" provisioningState: "); - builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); - } - } - - builder.AppendLine(" }"); - 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(KeyVaultPrivateEndpointConnectionItemData)} does not support writing '{options.Format}' format."); } } - KeyVaultPrivateEndpointConnectionItemData 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. + KeyVaultPrivateEndpointConnectionItemData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual KeyVaultPrivateEndpointConnectionItemData 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 DeserializeKeyVaultPrivateEndpointConnectionItemData(document.RootElement, options); } default: @@ -315,6 +166,7 @@ KeyVaultPrivateEndpointConnectionItemData IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateEndpointConnectionItemData.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateEndpointConnectionItemData.cs index f84be29fa71c..80b5dead605a 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateEndpointConnectionItemData.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateEndpointConnectionItemData.cs @@ -7,45 +7,16 @@ using System; using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Resources.Models; +using Azure; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// Private endpoint connection item. public partial class KeyVaultPrivateEndpointConnectionItemData { - /// - /// 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 KeyVaultPrivateEndpointConnectionItemData() @@ -54,41 +25,57 @@ internal KeyVaultPrivateEndpointConnectionItemData() /// 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. - /// Keeps track of any properties unknown to the library. - internal KeyVaultPrivateEndpointConnectionItemData(string id, ETag? etag, SubResource privateEndpoint, KeyVaultPrivateLinkServiceConnectionState connectionState, KeyVaultPrivateEndpointConnectionProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + /// Modified whenever there is a change in the state of private endpoint connection. + /// Private endpoint connection properties. + /// Keeps track of any properties unknown to the library. + internal KeyVaultPrivateEndpointConnectionItemData(string id, ETag? eTag, PrivateEndpointConnectionProperties properties, IDictionary additionalBinaryDataProperties) { Id = id; - ETag = etag; - PrivateEndpoint = privateEndpoint; - ConnectionState = connectionState; - ProvisioningState = provisioningState; - _serializedAdditionalRawData = serializedAdditionalRawData; + ETag = eTag; + Properties = properties; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Id of private endpoint connection. [WirePath("id")] public string Id { get; } + /// Modified whenever there is a change in the state of private endpoint connection. [WirePath("etag")] public ETag? ETag { get; } - /// Properties of the private endpoint object. - internal SubResource PrivateEndpoint { get; } - /// Gets Id. - [WirePath("properties.privateEndpoint.id")] - public ResourceIdentifier PrivateEndpointId - { - get => PrivateEndpoint?.Id; - } + + /// Private endpoint connection properties. + [WirePath("properties")] + internal PrivateEndpointConnectionProperties Properties { get; } /// Approval state of the private link connection. [WirePath("properties.privateLinkServiceConnectionState")] - public KeyVaultPrivateLinkServiceConnectionState ConnectionState { get; } + public KeyVaultPrivateLinkServiceConnectionState ConnectionState + { + get + { + return Properties.ConnectionState; + } + } + /// Provisioning state of the private endpoint connection. [WirePath("properties.provisioningState")] - public KeyVaultPrivateEndpointConnectionProvisioningState? ProvisioningState { get; } + public KeyVaultPrivateEndpointConnectionProvisioningState? ProvisioningState + { + get + { + return Properties.ProvisioningState; + } + } + + /// Full identifier of the private endpoint resource. + [WirePath("properties.privateEndpoint.id")] + public string PrivateEndpointId + { + get + { + return Properties.PrivateEndpointId; + } + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateEndpointConnectionListResult.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateEndpointConnectionListResult.Serialization.cs index 83a4df45b8b2..cdb086bbb698 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateEndpointConnectionListResult.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateEndpointConnectionListResult.Serialization.cs @@ -8,17 +8,22 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - internal partial class KeyVaultPrivateEndpointConnectionListResult : IUtf8JsonSerializable, IJsonModel + /// The response of a PrivateEndpointConnection list operation. + internal partial class KeyVaultPrivateEndpointConnectionListResult : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal KeyVaultPrivateEndpointConnectionListResult() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -30,15 +35,14 @@ void IJsonModel.Write(Utf8JsonWrite /// The client options for reading and writing models. protected virtual 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(KeyVaultPrivateEndpointConnectionListResult)} does not support writing '{format}' format."); } - writer.WritePropertyName("value"u8); writer.WriteStartArray(); - foreach (var item in Value) + foreach (KeyVaultPrivateEndpointConnectionData item in Value) { writer.WriteObjectValue(item, options); } @@ -48,15 +52,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("nextLink"u8); writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -65,137 +69,93 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - KeyVaultPrivateEndpointConnectionListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + KeyVaultPrivateEndpointConnectionListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual KeyVaultPrivateEndpointConnectionListResult 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(KeyVaultPrivateEndpointConnectionListResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeKeyVaultPrivateEndpointConnectionListResult(document.RootElement, options); } - internal static KeyVaultPrivateEndpointConnectionListResult DeserializeKeyVaultPrivateEndpointConnectionListResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static KeyVaultPrivateEndpointConnectionListResult DeserializeKeyVaultPrivateEndpointConnectionListResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; + IList value = default; Uri nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(KeyVaultPrivateEndpointConnectionData.DeserializeKeyVaultPrivateEndpointConnectionData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - nextLink = new Uri(property.Value.GetString()); + nextLink = new Uri(prop.Value.GetString()); 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 KeyVaultPrivateEndpointConnectionListResult(value, nextLink, serializedAdditionalRawData); + return new KeyVaultPrivateEndpointConnectionListResult(value, nextLink, additionalBinaryDataProperties); } - 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(Value), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" value: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Value)) - { - if (Value.Any()) - { - builder.Append(" value: "); - builder.AppendLine("["); - foreach (var item in Value) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nextLink: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NextLink)) - { - builder.Append(" nextLink: "); - builder.AppendLine($"'{NextLink.AbsoluteUri}'"); - } - } - - 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(KeyVaultPrivateEndpointConnectionListResult)} does not support writing '{options.Format}' format."); } } - KeyVaultPrivateEndpointConnectionListResult 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. + KeyVaultPrivateEndpointConnectionListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual KeyVaultPrivateEndpointConnectionListResult 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 DeserializeKeyVaultPrivateEndpointConnectionListResult(document.RootElement, options); } default: @@ -203,6 +163,15 @@ KeyVaultPrivateEndpointConnectionListResult IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static KeyVaultPrivateEndpointConnectionListResult FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeKeyVaultPrivateEndpointConnectionListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateEndpointConnectionListResult.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateEndpointConnectionListResult.cs index 68f5dc7288ee..73a87413dabf 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateEndpointConnectionListResult.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateEndpointConnectionListResult.cs @@ -8,73 +8,40 @@ using System; using System.Collections.Generic; using System.Linq; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// The response of a PrivateEndpointConnection list operation. internal partial class KeyVaultPrivateEndpointConnectionListResult { - /// - /// 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 . /// The PrivateEndpointConnection items on this page. - /// is null. internal KeyVaultPrivateEndpointConnectionListResult(IEnumerable value) { - Argument.AssertNotNull(value, nameof(value)); - Value = value.ToList(); } /// Initializes a new instance of . /// The PrivateEndpointConnection items on this page. /// The link to the next page of items. - /// Keeps track of any properties unknown to the library. - internal KeyVaultPrivateEndpointConnectionListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal KeyVaultPrivateEndpointConnectionListResult(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal KeyVaultPrivateEndpointConnectionListResult() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The PrivateEndpointConnection items on this page. - public IReadOnlyList Value { get; } + [WirePath("value")] + public IList Value { get; } + /// The link to the next page of items. + [WirePath("nextLink")] public Uri NextLink { get; } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateEndpointConnectionProvisioningState.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateEndpointConnectionProvisioningState.cs index 5797420a3449..1621195d1558 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateEndpointConnectionProvisioningState.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateEndpointConnectionProvisioningState.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { @@ -14,14 +15,6 @@ namespace Azure.ResourceManager.KeyVault.Models public readonly partial struct KeyVaultPrivateEndpointConnectionProvisioningState : IEquatable { private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public KeyVaultPrivateEndpointConnectionProvisioningState(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - private const string SucceededValue = "Succeeded"; private const string CreatingValue = "Creating"; private const string UpdatingValue = "Updating"; @@ -29,35 +22,64 @@ public KeyVaultPrivateEndpointConnectionProvisioningState(string value) private const string FailedValue = "Failed"; private const string DisconnectedValue = "Disconnected"; - /// Succeeded. + /// Initializes a new instance of . + /// The value. + /// is null. + public KeyVaultPrivateEndpointConnectionProvisioningState(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Gets the Succeeded. public static KeyVaultPrivateEndpointConnectionProvisioningState Succeeded { get; } = new KeyVaultPrivateEndpointConnectionProvisioningState(SucceededValue); - /// Creating. + + /// Gets the Creating. public static KeyVaultPrivateEndpointConnectionProvisioningState Creating { get; } = new KeyVaultPrivateEndpointConnectionProvisioningState(CreatingValue); - /// Updating. + + /// Gets the Updating. public static KeyVaultPrivateEndpointConnectionProvisioningState Updating { get; } = new KeyVaultPrivateEndpointConnectionProvisioningState(UpdatingValue); - /// Deleting. + + /// Gets the Deleting. public static KeyVaultPrivateEndpointConnectionProvisioningState Deleting { get; } = new KeyVaultPrivateEndpointConnectionProvisioningState(DeletingValue); - /// Failed. + + /// Gets the Failed. public static KeyVaultPrivateEndpointConnectionProvisioningState Failed { get; } = new KeyVaultPrivateEndpointConnectionProvisioningState(FailedValue); - /// Disconnected. + + /// Gets the Disconnected. public static KeyVaultPrivateEndpointConnectionProvisioningState Disconnected { get; } = new KeyVaultPrivateEndpointConnectionProvisioningState(DisconnectedValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(KeyVaultPrivateEndpointConnectionProvisioningState left, KeyVaultPrivateEndpointConnectionProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(KeyVaultPrivateEndpointConnectionProvisioningState left, KeyVaultPrivateEndpointConnectionProvisioningState right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator KeyVaultPrivateEndpointConnectionProvisioningState(string value) => new KeyVaultPrivateEndpointConnectionProvisioningState(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator KeyVaultPrivateEndpointConnectionProvisioningState?(string value) => value == null ? null : new KeyVaultPrivateEndpointConnectionProvisioningState(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is KeyVaultPrivateEndpointConnectionProvisioningState other && Equals(other); - /// + + /// public bool Equals(KeyVaultPrivateEndpointConnectionProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateEndpointServiceConnectionStatus.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateEndpointServiceConnectionStatus.cs index c7078147ba9d..b8bce4e7597b 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateEndpointServiceConnectionStatus.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateEndpointServiceConnectionStatus.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { @@ -14,44 +15,63 @@ namespace Azure.ResourceManager.KeyVault.Models public readonly partial struct KeyVaultPrivateEndpointServiceConnectionStatus : IEquatable { private readonly string _value; + private const string PendingValue = "Pending"; + private const string ApprovedValue = "Approved"; + private const string RejectedValue = "Rejected"; + private const string DisconnectedValue = "Disconnected"; /// Initializes a new instance of . + /// The value. /// is null. public KeyVaultPrivateEndpointServiceConnectionStatus(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string PendingValue = "Pending"; - private const string ApprovedValue = "Approved"; - private const string RejectedValue = "Rejected"; - private const string DisconnectedValue = "Disconnected"; + _value = value; + } - /// Pending. + /// Gets the Pending. public static KeyVaultPrivateEndpointServiceConnectionStatus Pending { get; } = new KeyVaultPrivateEndpointServiceConnectionStatus(PendingValue); - /// Approved. + + /// Gets the Approved. public static KeyVaultPrivateEndpointServiceConnectionStatus Approved { get; } = new KeyVaultPrivateEndpointServiceConnectionStatus(ApprovedValue); - /// Rejected. + + /// Gets the Rejected. public static KeyVaultPrivateEndpointServiceConnectionStatus Rejected { get; } = new KeyVaultPrivateEndpointServiceConnectionStatus(RejectedValue); - /// Disconnected. + + /// Gets the Disconnected. public static KeyVaultPrivateEndpointServiceConnectionStatus Disconnected { get; } = new KeyVaultPrivateEndpointServiceConnectionStatus(DisconnectedValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(KeyVaultPrivateEndpointServiceConnectionStatus left, KeyVaultPrivateEndpointServiceConnectionStatus right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(KeyVaultPrivateEndpointServiceConnectionStatus left, KeyVaultPrivateEndpointServiceConnectionStatus right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator KeyVaultPrivateEndpointServiceConnectionStatus(string value) => new KeyVaultPrivateEndpointServiceConnectionStatus(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator KeyVaultPrivateEndpointServiceConnectionStatus?(string value) => value == null ? null : new KeyVaultPrivateEndpointServiceConnectionStatus(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is KeyVaultPrivateEndpointServiceConnectionStatus other && Equals(other); - /// + + /// public bool Equals(KeyVaultPrivateEndpointServiceConnectionStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateLinkResourceData.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateLinkResourceData.Serialization.cs index b40bd44e30b6..6738d3560ca1 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateLinkResourceData.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateLinkResourceData.Serialization.cs @@ -8,18 +8,19 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.KeyVault; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.KeyVault.Models { - public partial class KeyVaultPrivateLinkResourceData : IUtf8JsonSerializable, IJsonModel + /// A private link resource. + public partial class KeyVaultPrivateLinkResourceData : 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,13 +32,17 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mo /// 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(KeyVaultPrivateLinkResourceData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } if (options.Format != "W" && Optional.IsDefined(Location)) { writer.WritePropertyName("location"u8); @@ -50,426 +55,169 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri foreach (var item in Tags) { writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } writer.WriteStringValue(item.Value); } writer.WriteEndObject(); } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(GroupId)) - { - writer.WritePropertyName("groupId"u8); - writer.WriteStringValue(GroupId); - } - if (options.Format != "W" && Optional.IsCollectionDefined(RequiredMembers)) - { - writer.WritePropertyName("requiredMembers"u8); - writer.WriteStartArray(); - foreach (var item in RequiredMembers) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsCollectionDefined(RequiredZoneNames)) - { - writer.WritePropertyName("requiredZoneNames"u8); - writer.WriteStartArray(); - foreach (var item in RequiredZoneNames) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - writer.WriteEndObject(); } - KeyVaultPrivateLinkResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + KeyVaultPrivateLinkResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (KeyVaultPrivateLinkResourceData)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(KeyVaultPrivateLinkResourceData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeKeyVaultPrivateLinkResourceData(document.RootElement, options); } - internal static KeyVaultPrivateLinkResourceData DeserializeKeyVaultPrivateLinkResourceData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static KeyVaultPrivateLinkResourceData DeserializeKeyVaultPrivateLinkResourceData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - AzureLocation? location = default; - IReadOnlyDictionary tags = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - string groupId = default; - IReadOnlyList requiredMembers = default; - IList requiredZoneNames = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + KeyVaultPrivateLinkResourceProperties properties = default; + AzureLocation? location = default; + IReadOnlyDictionary tags = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("location"u8)) + if (prop.NameEquals("id"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - location = new AzureLocation(property.Value.GetString()); + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("name"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; + name = prop.Value.GetString(); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("type"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("systemData"u8)) { - name = 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("type"u8)) + if (prop.NameEquals("properties"u8)) { - type = new ResourceType(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = KeyVaultPrivateLinkResourceProperties.DeserializeKeyVaultPrivateLinkResourceProperties(prop.Value, options); continue; } - if (property.NameEquals("systemData"u8)) + if (prop.NameEquals("location"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); + location = new AzureLocation(prop.Value.GetString()); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) { - if (property0.NameEquals("groupId"u8)) + if (prop0.Value.ValueKind == JsonValueKind.Null) { - groupId = property0.Value.GetString(); - continue; + dictionary.Add(prop0.Name, null); } - if (property0.NameEquals("requiredMembers"u8)) + else { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - requiredMembers = array; - continue; - } - if (property0.NameEquals("requiredZoneNames"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - requiredZoneNames = array; - continue; + dictionary.Add(prop0.Name, prop0.Value.GetString()); } } + tags = dictionary; 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 KeyVaultPrivateLinkResourceData( id, name, - type, + resourceType, systemData, + additionalBinaryDataProperties, + properties, location, - tags ?? new ChangeTrackingDictionary(), - groupId, - requiredMembers ?? new ChangeTrackingList(), - requiredZoneNames ?? new ChangeTrackingList(), - serializedAdditionalRawData); + tags ?? new ChangeTrackingDictionary()); } - 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(Location), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" location: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Location)) - { - builder.Append(" location: "); - builder.AppendLine($"'{Location.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Tags), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" tags: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Tags)) - { - if (Tags.Any()) - { - builder.Append(" tags: "); - builder.AppendLine("{"); - foreach (var item in Tags) - { - builder.Append($" '{item.Key}': "); - if (item.Value == null) - { - builder.Append("null"); - continue; - } - if (item.Value.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{item.Value}'''"); - } - else - { - builder.AppendLine($"'{item.Value}'"); - } - } - builder.AppendLine(" }"); - } - } - } - - 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.Append(" properties:"); - builder.AppendLine(" {"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(GroupId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" groupId: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(GroupId)) - { - builder.Append(" groupId: "); - if (GroupId.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{GroupId}'''"); - } - else - { - builder.AppendLine($"'{GroupId}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RequiredMembers), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" requiredMembers: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(RequiredMembers)) - { - if (RequiredMembers.Any()) - { - builder.Append(" requiredMembers: "); - builder.AppendLine("["); - foreach (var item in RequiredMembers) - { - if (item == null) - { - builder.Append("null"); - continue; - } - if (item.Contains(Environment.NewLine)) - { - builder.AppendLine(" '''"); - builder.AppendLine($"{item}'''"); - } - else - { - builder.AppendLine($" '{item}'"); - } - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RequiredZoneNames), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" requiredZoneNames: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(RequiredZoneNames)) - { - if (RequiredZoneNames.Any()) - { - builder.Append(" requiredZoneNames: "); - builder.AppendLine("["); - foreach (var item in RequiredZoneNames) - { - if (item == null) - { - builder.Append("null"); - continue; - } - if (item.Contains(Environment.NewLine)) - { - builder.AppendLine(" '''"); - builder.AppendLine($"{item}'''"); - } - else - { - builder.AppendLine($" '{item}'"); - } - } - builder.AppendLine(" ]"); - } - } - } - - builder.AppendLine(" }"); - 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(KeyVaultPrivateLinkResourceData)} does not support writing '{options.Format}' format."); } } - KeyVaultPrivateLinkResourceData 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. + KeyVaultPrivateLinkResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (KeyVaultPrivateLinkResourceData)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 DeserializeKeyVaultPrivateLinkResourceData(document.RootElement, options); } default: @@ -477,6 +225,7 @@ KeyVaultPrivateLinkResourceData IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateLinkResourceData.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateLinkResourceData.cs index a7d580749a39..765945747dee 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateLinkResourceData.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateLinkResourceData.cs @@ -8,6 +8,7 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.KeyVault; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.KeyVault.Models @@ -15,81 +16,72 @@ namespace Azure.ResourceManager.KeyVault.Models /// A private link resource. public partial class KeyVaultPrivateLinkResourceData : 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 . - public KeyVaultPrivateLinkResourceData() + internal KeyVaultPrivateLinkResourceData() { Tags = new ChangeTrackingDictionary(); - RequiredMembers = new ChangeTrackingList(); - RequiredZoneNames = new ChangeTrackingList(); } /// 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. + /// Resource properties. /// 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. - /// Keeps track of any properties unknown to the library. - internal KeyVaultPrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, IReadOnlyDictionary tags, string groupId, IReadOnlyList requiredMembers, IList requiredZoneNames, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal KeyVaultPrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, KeyVaultPrivateLinkResourceProperties properties, AzureLocation? location, IReadOnlyDictionary tags) : base(id, name, resourceType, systemData) { + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; Location = location; Tags = tags; - GroupId = groupId; - RequiredMembers = requiredMembers; - RequiredZoneNames = requiredZoneNames; - _serializedAdditionalRawData = serializedAdditionalRawData; } + /// Resource properties. + [WirePath("properties")] + internal KeyVaultPrivateLinkResourceProperties Properties { get; } + /// Azure location of the key vault resource. [WirePath("location")] public AzureLocation? Location { get; } + /// Tags assigned to the key vault resource. [WirePath("tags")] public IReadOnlyDictionary Tags { get; } + /// Group identifier of private link resource. [WirePath("properties.groupId")] - public string GroupId { get; } + public string GroupId + { + get + { + return Properties.GroupId; + } + } + /// Required member names of private link resource. [WirePath("properties.requiredMembers")] - public IReadOnlyList RequiredMembers { get; } + public IReadOnlyList RequiredMembers + { + get + { + return Properties.RequiredMembers; + } + } + /// Required DNS zone names of the the private link resource. [WirePath("properties.requiredZoneNames")] - public IList RequiredZoneNames { get; } + public IList RequiredZoneNames + { + get + { + return Properties.RequiredZoneNames; + } + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateLinkResourceListResult.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateLinkResourceListResult.Serialization.cs index 3fc06c6143c5..a953b352d45a 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateLinkResourceListResult.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateLinkResourceListResult.Serialization.cs @@ -8,17 +8,17 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - internal partial class KeyVaultPrivateLinkResourceListResult : IUtf8JsonSerializable, IJsonModel + /// A list of private link resources. + public partial class KeyVaultPrivateLinkResourceListResult : 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(); @@ -30,31 +30,30 @@ void IJsonModel.Write(Utf8JsonWriter writ /// The client options for reading and writing models. protected virtual 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(KeyVaultPrivateLinkResourceListResult)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) { writer.WritePropertyName("value"u8); writer.WriteStartArray(); - foreach (var item in Value) + foreach (KeyVaultPrivateLinkResourceData item in Value) { writer.WriteObjectValue(item, options); } writer.WriteEndArray(); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -63,39 +62,43 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - KeyVaultPrivateLinkResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + KeyVaultPrivateLinkResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual KeyVaultPrivateLinkResourceListResult 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(KeyVaultPrivateLinkResourceListResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeKeyVaultPrivateLinkResourceListResult(document.RootElement, options); } - internal static KeyVaultPrivateLinkResourceListResult DeserializeKeyVaultPrivateLinkResourceListResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static KeyVaultPrivateLinkResourceListResult DeserializeKeyVaultPrivateLinkResourceListResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(KeyVaultPrivateLinkResourceData.DeserializeKeyVaultPrivateLinkResourceData(item, options)); } @@ -104,75 +107,42 @@ internal static KeyVaultPrivateLinkResourceListResult DeserializeKeyVaultPrivate } 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 KeyVaultPrivateLinkResourceListResult(value ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new KeyVaultPrivateLinkResourceListResult(value ?? new ChangeTrackingList(), additionalBinaryDataProperties); } - 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(Value), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" value: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Value)) - { - if (Value.Any()) - { - builder.Append(" value: "); - builder.AppendLine("["); - foreach (var item in Value) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); - } - builder.AppendLine(" ]"); - } - } - } - - 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(KeyVaultPrivateLinkResourceListResult)} does not support writing '{options.Format}' format."); } } - KeyVaultPrivateLinkResourceListResult 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. + KeyVaultPrivateLinkResourceListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual KeyVaultPrivateLinkResourceListResult 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 DeserializeKeyVaultPrivateLinkResourceListResult(document.RootElement, options); } default: @@ -180,6 +150,15 @@ KeyVaultPrivateLinkResourceListResult IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static KeyVaultPrivateLinkResourceListResult FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeKeyVaultPrivateLinkResourceListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateLinkResourceListResult.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateLinkResourceListResult.cs index bc9c0abfeb58..bdf3bddfb3a4 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateLinkResourceListResult.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateLinkResourceListResult.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// A list of private link resources. - internal partial class KeyVaultPrivateLinkResourceListResult + public partial class KeyVaultPrivateLinkResourceListResult { - /// - /// 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 KeyVaultPrivateLinkResourceListResult() @@ -53,15 +25,15 @@ internal KeyVaultPrivateLinkResourceListResult() /// Initializes a new instance of . /// Array of private link resources. - /// Keeps track of any properties unknown to the library. - internal KeyVaultPrivateLinkResourceListResult(IReadOnlyList value, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal KeyVaultPrivateLinkResourceListResult(IList value, IDictionary additionalBinaryDataProperties) { Value = value; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Array of private link resources. [WirePath("value")] - public IReadOnlyList Value { get; } + public IList Value { get; } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateLinkResourceProperties.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateLinkResourceProperties.Serialization.cs new file mode 100644 index 000000000000..2ccca7f55f7d --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateLinkResourceProperties.Serialization.cs @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.KeyVault; + +namespace Azure.ResourceManager.KeyVault.Models +{ + /// Properties of a private link resource. + internal partial class KeyVaultPrivateLinkResourceProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KeyVaultPrivateLinkResourceProperties)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(GroupId)) + { + writer.WritePropertyName("groupId"u8); + writer.WriteStringValue(GroupId); + } + if (options.Format != "W" && Optional.IsCollectionDefined(RequiredMembers)) + { + writer.WritePropertyName("requiredMembers"u8); + writer.WriteStartArray(); + foreach (string item in RequiredMembers) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(RequiredZoneNames)) + { + writer.WritePropertyName("requiredZoneNames"u8); + writer.WriteStartArray(); + foreach (string item in RequiredZoneNames) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + KeyVaultPrivateLinkResourceProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual KeyVaultPrivateLinkResourceProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KeyVaultPrivateLinkResourceProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeKeyVaultPrivateLinkResourceProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static KeyVaultPrivateLinkResourceProperties DeserializeKeyVaultPrivateLinkResourceProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string groupId = default; + IReadOnlyList requiredMembers = default; + IList requiredZoneNames = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("groupId"u8)) + { + groupId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("requiredMembers"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + requiredMembers = array; + continue; + } + if (prop.NameEquals("requiredZoneNames"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + requiredZoneNames = array; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new KeyVaultPrivateLinkResourceProperties(groupId, requiredMembers ?? new ChangeTrackingList(), requiredZoneNames ?? new ChangeTrackingList(), additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerKeyVaultContext.Default); + default: + throw new FormatException($"The model {nameof(KeyVaultPrivateLinkResourceProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + KeyVaultPrivateLinkResourceProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual KeyVaultPrivateLinkResourceProperties 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)) + { + return DeserializeKeyVaultPrivateLinkResourceProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(KeyVaultPrivateLinkResourceProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateLinkResourceProperties.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateLinkResourceProperties.cs new file mode 100644 index 000000000000..5898ed6654db --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateLinkResourceProperties.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; + +namespace Azure.ResourceManager.KeyVault.Models +{ + /// Properties of a private link resource. + internal partial class KeyVaultPrivateLinkResourceProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal KeyVaultPrivateLinkResourceProperties() + { + RequiredMembers = new ChangeTrackingList(); + RequiredZoneNames = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Group identifier of private link resource. + /// Required member names of private link resource. + /// Required DNS zone names of the the private link resource. + /// Keeps track of any properties unknown to the library. + internal KeyVaultPrivateLinkResourceProperties(string groupId, IReadOnlyList requiredMembers, IList requiredZoneNames, IDictionary additionalBinaryDataProperties) + { + GroupId = groupId; + RequiredMembers = requiredMembers; + RequiredZoneNames = requiredZoneNames; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Group identifier of private link resource. + [WirePath("groupId")] + public string GroupId { get; } + + /// Required member names of private link resource. + [WirePath("requiredMembers")] + public IReadOnlyList RequiredMembers { get; } = new ChangeTrackingList(); + + /// Required DNS zone names of the the private link resource. + [WirePath("requiredZoneNames")] + public IList RequiredZoneNames { get; } = new ChangeTrackingList(); + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateLinkServiceConnectionState.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateLinkServiceConnectionState.Serialization.cs index 74cda7029bb7..fc02374de25f 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateLinkServiceConnectionState.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateLinkServiceConnectionState.Serialization.cs @@ -8,16 +8,16 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class KeyVaultPrivateLinkServiceConnectionState : IUtf8JsonSerializable, IJsonModel + /// An object that represents the approval state of the private link connection. + public partial class KeyVaultPrivateLinkServiceConnectionState : 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(); @@ -29,12 +29,11 @@ void IJsonModel.Write(Utf8JsonWriter /// The client options for reading and writing models. protected virtual 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(KeyVaultPrivateLinkServiceConnectionState)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Status)) { writer.WritePropertyName("status"u8); @@ -50,15 +49,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("actionsRequired"u8); writer.WriteStringValue(ActionsRequired.Value.ToString()); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -67,22 +66,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - KeyVaultPrivateLinkServiceConnectionState IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + KeyVaultPrivateLinkServiceConnectionState IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual KeyVaultPrivateLinkServiceConnectionState 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(KeyVaultPrivateLinkServiceConnectionState)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeKeyVaultPrivateLinkServiceConnectionState(document.RootElement, options); } - internal static KeyVaultPrivateLinkServiceConnectionState DeserializeKeyVaultPrivateLinkServiceConnectionState(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static KeyVaultPrivateLinkServiceConnectionState DeserializeKeyVaultPrivateLinkServiceConnectionState(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -90,134 +94,70 @@ internal static KeyVaultPrivateLinkServiceConnectionState DeserializeKeyVaultPri KeyVaultPrivateEndpointServiceConnectionStatus? status = default; string description = default; KeyVaultActionsRequiredMessage? actionsRequired = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("status"u8)) + if (prop.NameEquals("status"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - status = new KeyVaultPrivateEndpointServiceConnectionStatus(property.Value.GetString()); + status = new KeyVaultPrivateEndpointServiceConnectionStatus(prop.Value.GetString()); continue; } - if (property.NameEquals("description"u8)) + if (prop.NameEquals("description"u8)) { - description = property.Value.GetString(); + description = prop.Value.GetString(); continue; } - if (property.NameEquals("actionsRequired"u8)) + if (prop.NameEquals("actionsRequired"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - actionsRequired = new KeyVaultActionsRequiredMessage(property.Value.GetString()); + actionsRequired = new KeyVaultActionsRequiredMessage(prop.Value.GetString()); 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 KeyVaultPrivateLinkServiceConnectionState(status, description, actionsRequired, serializedAdditionalRawData); + return new KeyVaultPrivateLinkServiceConnectionState(status, description, actionsRequired, additionalBinaryDataProperties); } - 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(Status), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" status: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Status)) - { - builder.Append(" status: "); - builder.AppendLine($"'{Status.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Description), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" description: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Description)) - { - builder.Append(" description: "); - if (Description.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Description}'''"); - } - else - { - builder.AppendLine($"'{Description}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ActionsRequired), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" actionsRequired: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ActionsRequired)) - { - builder.Append(" actionsRequired: "); - builder.AppendLine($"'{ActionsRequired.Value.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(KeyVaultPrivateLinkServiceConnectionState)} does not support writing '{options.Format}' format."); } } - KeyVaultPrivateLinkServiceConnectionState 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. + KeyVaultPrivateLinkServiceConnectionState IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual KeyVaultPrivateLinkServiceConnectionState 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 DeserializeKeyVaultPrivateLinkServiceConnectionState(document.RootElement, options); } default: @@ -225,6 +165,7 @@ KeyVaultPrivateLinkServiceConnectionState IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateLinkServiceConnectionState.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateLinkServiceConnectionState.cs index a2799c074bea..69b07fab90e4 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateLinkServiceConnectionState.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPrivateLinkServiceConnectionState.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// An object that represents the approval state of the private link connection. public partial class KeyVaultPrivateLinkServiceConnectionState { - /// - /// 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 . public KeyVaultPrivateLinkServiceConnectionState() @@ -54,21 +26,23 @@ public KeyVaultPrivateLinkServiceConnectionState() /// Indicates whether the connection has been approved, rejected or removed by the key vault owner. /// The reason for approval or rejection. /// A message indicating if changes on the service provider require any updates on the consumer. - /// Keeps track of any properties unknown to the library. - internal KeyVaultPrivateLinkServiceConnectionState(KeyVaultPrivateEndpointServiceConnectionStatus? status, string description, KeyVaultActionsRequiredMessage? actionsRequired, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal KeyVaultPrivateLinkServiceConnectionState(KeyVaultPrivateEndpointServiceConnectionStatus? status, string description, KeyVaultActionsRequiredMessage? actionsRequired, IDictionary additionalBinaryDataProperties) { Status = status; Description = description; ActionsRequired = actionsRequired; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Indicates whether the connection has been approved, rejected or removed by the key vault owner. [WirePath("status")] public KeyVaultPrivateEndpointServiceConnectionStatus? Status { get; set; } + /// The reason for approval or rejection. [WirePath("description")] public string Description { get; set; } + /// A message indicating if changes on the service provider require any updates on the consumer. [WirePath("actionsRequired")] public KeyVaultActionsRequiredMessage? ActionsRequired { get; set; } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultProperties.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultProperties.Serialization.cs index 6b1984fc87ee..dc1c476805cc 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultProperties.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultProperties.Serialization.cs @@ -8,17 +8,21 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class KeyVaultProperties : IUtf8JsonSerializable, IJsonModel + /// Properties of the vault. + public partial class KeyVaultProperties : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal KeyVaultProperties() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -30,12 +34,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit /// The client options for reading and writing models. protected virtual 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(KeyVaultProperties)} does not support writing '{format}' format."); } - writer.WritePropertyName("tenantId"u8); writer.WriteStringValue(TenantId); writer.WritePropertyName("sku"u8); @@ -44,7 +47,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("accessPolicies"u8); writer.WriteStartArray(); - foreach (var item in AccessPolicies) + foreach (KeyVaultAccessPolicy item in AccessPolicies) { writer.WriteObjectValue(item, options); } @@ -114,7 +117,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("privateEndpointConnections"u8); writer.WriteStartArray(); - foreach (var item in PrivateEndpointConnections) + foreach (KeyVaultPrivateEndpointConnectionItemData item in PrivateEndpointConnections) { writer.WriteObjectValue(item, options); } @@ -125,15 +128,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("publicNetworkAccess"u8); writer.WriteStringValue(PublicNetworkAccess); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -142,22 +145,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - KeyVaultProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + KeyVaultProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual KeyVaultProperties 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(KeyVaultProperties)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeKeyVaultProperties(document.RootElement, options); } - internal static KeyVaultProperties DeserializeKeyVaultProperties(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static KeyVaultProperties DeserializeKeyVaultProperties(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -175,167 +183,165 @@ internal static KeyVaultProperties DeserializeKeyVaultProperties(JsonElement ele bool? enableRbacAuthorization = default; KeyVaultCreateMode? createMode = default; bool? enablePurgeProtection = default; - KeyVaultNetworkRuleSet networkAcls = default; + KeyVaultNetworkRuleSet networkRuleSet = default; KeyVaultProvisioningState? provisioningState = default; IReadOnlyList privateEndpointConnections = default; string publicNetworkAccess = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tenantId"u8)) + if (prop.NameEquals("tenantId"u8)) { - tenantId = property.Value.GetGuid(); + tenantId = new Guid(prop.Value.GetString()); continue; } - if (property.NameEquals("sku"u8)) + if (prop.NameEquals("sku"u8)) { - sku = KeyVaultSku.DeserializeKeyVaultSku(property.Value, options); + sku = KeyVaultSku.DeserializeKeyVaultSku(prop.Value, options); continue; } - if (property.NameEquals("accessPolicies"u8)) + if (prop.NameEquals("accessPolicies"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(KeyVaultAccessPolicy.DeserializeKeyVaultAccessPolicy(item, options)); } accessPolicies = array; continue; } - if (property.NameEquals("vaultUri"u8)) + if (prop.NameEquals("vaultUri"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - vaultUri = new Uri(property.Value.GetString()); + vaultUri = new Uri(prop.Value.GetString()); continue; } - if (property.NameEquals("hsmPoolResourceId"u8)) + if (prop.NameEquals("hsmPoolResourceId"u8)) { - hsmPoolResourceId = property.Value.GetString(); + hsmPoolResourceId = prop.Value.GetString(); continue; } - if (property.NameEquals("enabledForDeployment"u8)) + if (prop.NameEquals("enabledForDeployment"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - enabledForDeployment = property.Value.GetBoolean(); + enabledForDeployment = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("enabledForDiskEncryption"u8)) + if (prop.NameEquals("enabledForDiskEncryption"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - enabledForDiskEncryption = property.Value.GetBoolean(); + enabledForDiskEncryption = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("enabledForTemplateDeployment"u8)) + if (prop.NameEquals("enabledForTemplateDeployment"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - enabledForTemplateDeployment = property.Value.GetBoolean(); + enabledForTemplateDeployment = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("enableSoftDelete"u8)) + if (prop.NameEquals("enableSoftDelete"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - enableSoftDelete = property.Value.GetBoolean(); + enableSoftDelete = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("softDeleteRetentionInDays"u8)) + if (prop.NameEquals("softDeleteRetentionInDays"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - softDeleteRetentionInDays = property.Value.GetInt32(); + softDeleteRetentionInDays = prop.Value.GetInt32(); continue; } - if (property.NameEquals("enableRbacAuthorization"u8)) + if (prop.NameEquals("enableRbacAuthorization"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - enableRbacAuthorization = property.Value.GetBoolean(); + enableRbacAuthorization = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("createMode"u8)) + if (prop.NameEquals("createMode"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - createMode = property.Value.GetString().ToKeyVaultCreateMode(); + createMode = prop.Value.GetString().ToKeyVaultCreateMode(); continue; } - if (property.NameEquals("enablePurgeProtection"u8)) + if (prop.NameEquals("enablePurgeProtection"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - enablePurgeProtection = property.Value.GetBoolean(); + enablePurgeProtection = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("networkAcls"u8)) + if (prop.NameEquals("networkAcls"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - networkAcls = KeyVaultNetworkRuleSet.DeserializeKeyVaultNetworkRuleSet(property.Value, options); + networkRuleSet = KeyVaultNetworkRuleSet.DeserializeKeyVaultNetworkRuleSet(prop.Value, options); continue; } - if (property.NameEquals("provisioningState"u8)) + if (prop.NameEquals("provisioningState"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - provisioningState = new KeyVaultProvisioningState(property.Value.GetString()); + provisioningState = new KeyVaultProvisioningState(prop.Value.GetString()); continue; } - if (property.NameEquals("privateEndpointConnections"u8)) + if (prop.NameEquals("privateEndpointConnections"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(KeyVaultPrivateEndpointConnectionItemData.DeserializeKeyVaultPrivateEndpointConnectionItemData(item, options)); } privateEndpointConnections = array; continue; } - if (property.NameEquals("publicNetworkAccess"u8)) + if (prop.NameEquals("publicNetworkAccess"u8)) { - publicNetworkAccess = property.Value.GetString(); + publicNetworkAccess = prop.Value.GetString(); 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 KeyVaultProperties( tenantId, sku, @@ -350,342 +356,43 @@ internal static KeyVaultProperties DeserializeKeyVaultProperties(JsonElement ele enableRbacAuthorization, createMode, enablePurgeProtection, - networkAcls, + networkRuleSet, provisioningState, privateEndpointConnections ?? new ChangeTrackingList(), publicNetworkAccess, - serializedAdditionalRawData); + additionalBinaryDataProperties); } - 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(TenantId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" tenantId: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" tenantId: "); - builder.AppendLine($"'{TenantId.ToString()}'"); - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Sku), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" sku: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Sku)) - { - builder.Append(" sku: "); - BicepSerializationHelpers.AppendChildObject(builder, Sku, options, 2, false, " sku: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AccessPolicies), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" accessPolicies: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(AccessPolicies)) - { - if (AccessPolicies.Any()) - { - builder.Append(" accessPolicies: "); - builder.AppendLine("["); - foreach (var item in AccessPolicies) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " accessPolicies: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VaultUri), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" vaultUri: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(VaultUri)) - { - builder.Append(" vaultUri: "); - builder.AppendLine($"'{VaultUri.AbsoluteUri}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(HsmPoolResourceId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" hsmPoolResourceId: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(HsmPoolResourceId)) - { - builder.Append(" hsmPoolResourceId: "); - if (HsmPoolResourceId.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{HsmPoolResourceId}'''"); - } - else - { - builder.AppendLine($"'{HsmPoolResourceId}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnabledForDeployment), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enabledForDeployment: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(EnabledForDeployment)) - { - builder.Append(" enabledForDeployment: "); - var boolValue = EnabledForDeployment.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnabledForDiskEncryption), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enabledForDiskEncryption: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(EnabledForDiskEncryption)) - { - builder.Append(" enabledForDiskEncryption: "); - var boolValue = EnabledForDiskEncryption.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnabledForTemplateDeployment), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enabledForTemplateDeployment: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(EnabledForTemplateDeployment)) - { - builder.Append(" enabledForTemplateDeployment: "); - var boolValue = EnabledForTemplateDeployment.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableSoftDelete), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enableSoftDelete: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(EnableSoftDelete)) - { - builder.Append(" enableSoftDelete: "); - var boolValue = EnableSoftDelete.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SoftDeleteRetentionInDays), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" softDeleteRetentionInDays: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(SoftDeleteRetentionInDays)) - { - builder.Append(" softDeleteRetentionInDays: "); - builder.AppendLine($"{SoftDeleteRetentionInDays.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableRbacAuthorization), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enableRbacAuthorization: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(EnableRbacAuthorization)) - { - builder.Append(" enableRbacAuthorization: "); - var boolValue = EnableRbacAuthorization.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CreateMode), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" createMode: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(CreateMode)) - { - builder.Append(" createMode: "); - builder.AppendLine($"'{CreateMode.Value.ToSerialString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnablePurgeProtection), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enablePurgeProtection: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(EnablePurgeProtection)) - { - builder.Append(" enablePurgeProtection: "); - var boolValue = EnablePurgeProtection.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetworkRuleSet), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" networkAcls: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NetworkRuleSet)) - { - builder.Append(" networkAcls: "); - BicepSerializationHelpers.AppendChildObject(builder, NetworkRuleSet, options, 2, false, " networkAcls: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" provisioningState: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ProvisioningState)) - { - builder.Append(" provisioningState: "); - builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PrivateEndpointConnections), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" privateEndpointConnections: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(PrivateEndpointConnections)) - { - if (PrivateEndpointConnections.Any()) - { - builder.Append(" privateEndpointConnections: "); - builder.AppendLine("["); - foreach (var item in PrivateEndpointConnections) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " privateEndpointConnections: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PublicNetworkAccess), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" publicNetworkAccess: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PublicNetworkAccess)) - { - builder.Append(" publicNetworkAccess: "); - if (PublicNetworkAccess.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{PublicNetworkAccess}'''"); - } - else - { - builder.AppendLine($"'{PublicNetworkAccess}'"); - } - } - } - - 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(KeyVaultProperties)} does not support writing '{options.Format}' format."); } } - KeyVaultProperties 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. + KeyVaultProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual KeyVaultProperties 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 DeserializeKeyVaultProperties(document.RootElement, options); } default: @@ -693,6 +400,7 @@ KeyVaultProperties IPersistableModel.Create(BinaryData data, } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultProperties.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultProperties.cs index 0b7a0f73788f..227a63378c4d 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultProperties.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultProperties.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// Properties of the vault. public partial class KeyVaultProperties { - /// - /// 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 . /// The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. @@ -63,8 +35,8 @@ public partial class KeyVaultProperties /// 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. - /// Keeps track of any properties unknown to the library. - internal KeyVaultProperties(Guid tenantId, KeyVaultSku sku, IList accessPolicies, Uri vaultUri, string hsmPoolResourceId, bool? enabledForDeployment, bool? enabledForDiskEncryption, bool? enabledForTemplateDeployment, bool? enableSoftDelete, int? softDeleteRetentionInDays, bool? enableRbacAuthorization, KeyVaultCreateMode? createMode, bool? enablePurgeProtection, KeyVaultNetworkRuleSet networkRuleSet, KeyVaultProvisioningState? provisioningState, IReadOnlyList privateEndpointConnections, string publicNetworkAccess, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal KeyVaultProperties(Guid tenantId, KeyVaultSku sku, IList accessPolicies, Uri vaultUri, string hsmPoolResourceId, bool? enabledForDeployment, bool? enabledForDiskEncryption, bool? enabledForTemplateDeployment, bool? enableSoftDelete, int? softDeleteRetentionInDays, bool? enableRbacAuthorization, KeyVaultCreateMode? createMode, bool? enablePurgeProtection, KeyVaultNetworkRuleSet networkRuleSet, KeyVaultProvisioningState? provisioningState, IReadOnlyList privateEndpointConnections, string publicNetworkAccess, IDictionary additionalBinaryDataProperties) { TenantId = tenantId; Sku = sku; @@ -83,62 +55,73 @@ internal KeyVaultProperties(Guid tenantId, KeyVaultSku sku, IList Initializes a new instance of for deserialization. - internal KeyVaultProperties() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. [WirePath("tenantId")] public Guid TenantId { get; set; } + /// SKU details. [WirePath("sku")] public KeyVaultSku Sku { get; set; } + /// 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. [WirePath("accessPolicies")] public IList AccessPolicies { get; } + /// The URI of the vault for performing operations on keys and secrets. [WirePath("vaultUri")] public Uri VaultUri { get; set; } + /// The resource id of HSM Pool. [WirePath("hsmPoolResourceId")] public string HsmPoolResourceId { get; } + /// Property to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from the key vault. [WirePath("enabledForDeployment")] public bool? EnabledForDeployment { get; set; } + /// Property to specify whether Azure Disk Encryption is permitted to retrieve secrets from the vault and unwrap keys. [WirePath("enabledForDiskEncryption")] public bool? EnabledForDiskEncryption { get; set; } + /// Property to specify whether Azure Resource Manager is permitted to retrieve secrets from the key vault. [WirePath("enabledForTemplateDeployment")] public bool? EnabledForTemplateDeployment { get; set; } + /// 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. [WirePath("enableSoftDelete")] public bool? EnableSoftDelete { get; set; } + /// softDelete data retention days. It accepts >=7 and <=90. [WirePath("softDeleteRetentionInDays")] public int? SoftDeleteRetentionInDays { get; set; } + /// 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. [WirePath("enableRbacAuthorization")] public bool? EnableRbacAuthorization { get; set; } + /// The vault's create mode to indicate whether the vault need to be recovered or not. [WirePath("createMode")] public KeyVaultCreateMode? CreateMode { get; set; } + /// 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. [WirePath("enablePurgeProtection")] public bool? EnablePurgeProtection { get; set; } + /// Rules governing the accessibility of the key vault from specific network locations. [WirePath("networkAcls")] public KeyVaultNetworkRuleSet NetworkRuleSet { get; set; } + /// Provisioning state of the vault. [WirePath("provisioningState")] public KeyVaultProvisioningState? ProvisioningState { get; set; } + /// List of private endpoint connections associated with the key vault. [WirePath("privateEndpointConnections")] public IReadOnlyList PrivateEndpointConnections { get; } + /// 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. [WirePath("publicNetworkAccess")] public string PublicNetworkAccess { get; set; } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultProvisioningState.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultProvisioningState.cs index 8c32df49ec73..87a1e4ea031c 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultProvisioningState.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultProvisioningState.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { @@ -14,38 +15,55 @@ namespace Azure.ResourceManager.KeyVault.Models public readonly partial struct KeyVaultProvisioningState : IEquatable { private readonly string _value; + private const string SucceededValue = "Succeeded"; + private const string RegisteringDnsValue = "RegisteringDns"; /// Initializes a new instance of . + /// The value. /// is null. public KeyVaultProvisioningState(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string SucceededValue = "Succeeded"; - private const string RegisteringDnsValue = "RegisteringDns"; + _value = value; + } - /// Succeeded. + /// Gets the Succeeded. public static KeyVaultProvisioningState Succeeded { get; } = new KeyVaultProvisioningState(SucceededValue); - /// RegisteringDns. + + /// Gets the RegisteringDns. public static KeyVaultProvisioningState RegisteringDns { get; } = new KeyVaultProvisioningState(RegisteringDnsValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(KeyVaultProvisioningState left, KeyVaultProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(KeyVaultProvisioningState left, KeyVaultProvisioningState right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator KeyVaultProvisioningState(string value) => new KeyVaultProvisioningState(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator KeyVaultProvisioningState?(string value) => value == null ? null : new KeyVaultProvisioningState(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is KeyVaultProvisioningState other && Equals(other); - /// + + /// public bool Equals(KeyVaultProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSecretCreateOrUpdateContent.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSecretCreateOrUpdateContent.Serialization.cs deleted file mode 100644 index 6e0c4cf9fdb1..000000000000 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSecretCreateOrUpdateContent.Serialization.cs +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.KeyVault.Models -{ - public partial class KeyVaultSecretCreateOrUpdateContent : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(KeyVaultSecretCreateOrUpdateContent)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(Tags)) - { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties, options); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - KeyVaultSecretCreateOrUpdateContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(KeyVaultSecretCreateOrUpdateContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeKeyVaultSecretCreateOrUpdateContent(document.RootElement, options); - } - - internal static KeyVaultSecretCreateOrUpdateContent DeserializeKeyVaultSecretCreateOrUpdateContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IDictionary tags = default; - SecretProperties properties = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("tags"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("properties"u8)) - { - properties = SecretProperties.DeserializeSecretProperties(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new KeyVaultSecretCreateOrUpdateContent(tags ?? new ChangeTrackingDictionary(), properties, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerKeyVaultContext.Default); - default: - throw new FormatException($"The model {nameof(KeyVaultSecretCreateOrUpdateContent)} does not support writing '{options.Format}' format."); - } - } - - KeyVaultSecretCreateOrUpdateContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeKeyVaultSecretCreateOrUpdateContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(KeyVaultSecretCreateOrUpdateContent)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSecretCreateOrUpdateContent.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSecretCreateOrUpdateContent.cs deleted file mode 100644 index b43033a8aa23..000000000000 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSecretCreateOrUpdateContent.cs +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.KeyVault.Models -{ - /// Parameters for creating or updating a secret. - public partial class KeyVaultSecretCreateOrUpdateContent - { - /// - /// 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; - - /// Initializes a new instance of . - /// Properties of the secret. - /// is null. - public KeyVaultSecretCreateOrUpdateContent(SecretProperties properties) - { - Argument.AssertNotNull(properties, nameof(properties)); - - Tags = new ChangeTrackingDictionary(); - Properties = properties; - } - - /// Initializes a new instance of . - /// The tags that will be assigned to the secret. - /// Properties of the secret. - /// Keeps track of any properties unknown to the library. - internal KeyVaultSecretCreateOrUpdateContent(IDictionary tags, SecretProperties properties, IDictionary serializedAdditionalRawData) - { - Tags = tags; - Properties = properties; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal KeyVaultSecretCreateOrUpdateContent() - { - } - - /// The tags that will be assigned to the secret. - [WirePath("tags")] - public IDictionary Tags { get; } - /// Properties of the secret. - [WirePath("properties")] - public SecretProperties Properties { get; } - } -} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSecretPatch.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSecretPatch.Serialization.cs index 48bdd7517c11..9127aaded4f9 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSecretPatch.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSecretPatch.Serialization.cs @@ -10,13 +10,15 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class KeyVaultSecretPatch : IUtf8JsonSerializable, IJsonModel + /// Parameters for patching a secret. + public partial class KeyVaultSecretPatch : 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(); @@ -28,12 +30,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri /// The client options for reading and writing models. protected virtual 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(KeyVaultSecretPatch)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"u8); @@ -41,6 +42,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit foreach (var item in Tags) { writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } writer.WriteStringValue(item.Value); } writer.WriteEndObject(); @@ -50,15 +56,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("properties"u8); writer.WriteObjectValue(Properties, options); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -67,68 +73,81 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - KeyVaultSecretPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + KeyVaultSecretPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual KeyVaultSecretPatch 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(KeyVaultSecretPatch)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeKeyVaultSecretPatch(document.RootElement, options); } - internal static KeyVaultSecretPatch DeserializeKeyVaultSecretPatch(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static KeyVaultSecretPatch DeserializeKeyVaultSecretPatch(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IDictionary tags = default; SecretPatchProperties properties = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) + foreach (var prop0 in prop.Value.EnumerateObject()) { - dictionary.Add(property0.Name, property0.Value.GetString()); + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } } tags = dictionary; continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("properties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - properties = SecretPatchProperties.DeserializeSecretPatchProperties(property.Value, options); + properties = SecretPatchProperties.DeserializeSecretPatchProperties(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 KeyVaultSecretPatch(tags ?? new ChangeTrackingDictionary(), properties, serializedAdditionalRawData); + return new KeyVaultSecretPatch(tags ?? new ChangeTrackingDictionary(), properties, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -138,15 +157,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions } } - KeyVaultSecretPatch 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. + KeyVaultSecretPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual KeyVaultSecretPatch 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 DeserializeKeyVaultSecretPatch(document.RootElement, options); } default: @@ -154,6 +178,19 @@ KeyVaultSecretPatch IPersistableModel.Create(BinaryData dat } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(KeyVaultSecretPatch keyVaultSecretPatch) + { + if (keyVaultSecretPatch == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(keyVaultSecretPatch, ModelSerializationExtensions.WireOptions); + return content; + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSecretPatch.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSecretPatch.cs index 48048c653594..b41da467946b 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSecretPatch.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSecretPatch.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// Parameters for patching a secret. public partial class KeyVaultSecretPatch { - /// - /// 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 . public KeyVaultSecretPatch() @@ -54,17 +26,18 @@ public KeyVaultSecretPatch() /// Initializes a new instance of . /// The tags that will be assigned to the secret. /// Properties of the secret. - /// Keeps track of any properties unknown to the library. - internal KeyVaultSecretPatch(IDictionary tags, SecretPatchProperties properties, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal KeyVaultSecretPatch(IDictionary tags, SecretPatchProperties properties, IDictionary additionalBinaryDataProperties) { Tags = tags; Properties = properties; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The tags that will be assigned to the secret. [WirePath("tags")] public IDictionary Tags { get; } + /// Properties of the secret. [WirePath("properties")] public SecretPatchProperties Properties { get; set; } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSku.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSku.Serialization.cs index 2f7960e88ce6..ac3b0b189091 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSku.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSku.Serialization.cs @@ -8,16 +8,21 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class KeyVaultSku : IUtf8JsonSerializable, IJsonModel + /// SKU details. + public partial class KeyVaultSku : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal KeyVaultSku() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -29,25 +34,24 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptio /// The client options for reading and writing models. protected virtual 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(KeyVaultSku)} does not support writing '{format}' format."); } - writer.WritePropertyName("family"u8); writer.WriteStringValue(Family.ToString()); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToSerialString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -56,114 +60,84 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - KeyVaultSku IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + KeyVaultSku IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual KeyVaultSku 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(KeyVaultSku)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeKeyVaultSku(document.RootElement, options); } - internal static KeyVaultSku DeserializeKeyVaultSku(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static KeyVaultSku DeserializeKeyVaultSku(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } KeyVaultSkuFamily family = default; KeyVaultSkuName name = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("family"u8)) + if (prop.NameEquals("family"u8)) { - family = new KeyVaultSkuFamily(property.Value.GetString()); + family = new KeyVaultSkuFamily(prop.Value.GetString()); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("name"u8)) { - name = property.Value.GetString().ToKeyVaultSkuName(); + name = prop.Value.GetString().ToKeyVaultSkuName(); 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 KeyVaultSku(family, name, serializedAdditionalRawData); + return new KeyVaultSku(family, name, additionalBinaryDataProperties); } - 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(Family), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" family: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" family: "); - builder.AppendLine($"'{Family.ToString()}'"); - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" name: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" name: "); - builder.AppendLine($"'{Name.ToSerialString()}'"); - } - - 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(KeyVaultSku)} does not support writing '{options.Format}' format."); } } - KeyVaultSku 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. + KeyVaultSku IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual KeyVaultSku 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 DeserializeKeyVaultSku(document.RootElement, options); } default: @@ -171,6 +145,7 @@ KeyVaultSku IPersistableModel.Create(BinaryData data, ModelReaderWr } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSku.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSku.cs index 3c9f31f8b063..c97b87a825bb 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSku.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSku.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// SKU details. public partial class KeyVaultSku { - /// - /// 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 . /// SKU family name. @@ -57,22 +29,18 @@ public KeyVaultSku(KeyVaultSkuFamily family, KeyVaultSkuName name) /// Initializes a new instance of . /// SKU family name. /// SKU name to specify whether the key vault is a standard vault or a premium vault. - /// Keeps track of any properties unknown to the library. - internal KeyVaultSku(KeyVaultSkuFamily family, KeyVaultSkuName name, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal KeyVaultSku(KeyVaultSkuFamily family, KeyVaultSkuName name, IDictionary additionalBinaryDataProperties) { Family = family; Name = name; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal KeyVaultSku() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// SKU family name. [WirePath("family")] public KeyVaultSkuFamily Family { get; set; } + /// SKU name to specify whether the key vault is a standard vault or a premium vault. [WirePath("name")] public KeyVaultSkuName Name { get; set; } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSkuFamily.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSkuFamily.cs index de6ae1d5594c..4d0919c2aba4 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSkuFamily.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSkuFamily.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { @@ -14,35 +15,51 @@ namespace Azure.ResourceManager.KeyVault.Models public readonly partial struct KeyVaultSkuFamily : IEquatable { private readonly string _value; + private const string AValue = "A"; /// Initializes a new instance of . + /// The value. /// is null. public KeyVaultSkuFamily(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string AValue = "A"; + _value = value; + } - /// A. + /// Gets the A. public static KeyVaultSkuFamily A { get; } = new KeyVaultSkuFamily(AValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(KeyVaultSkuFamily left, KeyVaultSkuFamily right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(KeyVaultSkuFamily left, KeyVaultSkuFamily right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator KeyVaultSkuFamily(string value) => new KeyVaultSkuFamily(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator KeyVaultSkuFamily?(string value) => value == null ? null : new KeyVaultSkuFamily(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is KeyVaultSkuFamily other && Equals(other); - /// + + /// public bool Equals(KeyVaultSkuFamily other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSkuName.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSkuName.Serialization.cs index 847fd402d504..1bdce0fc610f 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSkuName.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSkuName.Serialization.cs @@ -11,6 +11,7 @@ namespace Azure.ResourceManager.KeyVault.Models { internal static partial class KeyVaultSkuNameExtensions { + /// The value to serialize. public static string ToSerialString(this KeyVaultSkuName value) => value switch { KeyVaultSkuName.Standard => "standard", @@ -18,10 +19,17 @@ internal static partial class KeyVaultSkuNameExtensions _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown KeyVaultSkuName value.") }; + /// The value to deserialize. public static KeyVaultSkuName ToKeyVaultSkuName(this string value) { - if (StringComparer.OrdinalIgnoreCase.Equals(value, "standard")) return KeyVaultSkuName.Standard; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "premium")) return KeyVaultSkuName.Premium; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "standard")) + { + return KeyVaultSkuName.Standard; + } + if (StringComparer.OrdinalIgnoreCase.Equals(value, "premium")) + { + return KeyVaultSkuName.Premium; + } throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown KeyVaultSkuName value."); } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSkuName.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSkuName.cs index aa36cc640559..882aac119948 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSkuName.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultSkuName.cs @@ -10,9 +10,9 @@ namespace Azure.ResourceManager.KeyVault.Models /// SKU name to specify whether the key vault is a standard vault or a premium vault. public enum KeyVaultSkuName { - /// standard. + /// Standard. Standard, - /// premium. + /// Premium. Premium } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultVirtualNetworkRule.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultVirtualNetworkRule.Serialization.cs index 86fa2f0d2bfe..c6753098e07b 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultVirtualNetworkRule.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultVirtualNetworkRule.Serialization.cs @@ -8,16 +8,21 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class KeyVaultVirtualNetworkRule : IUtf8JsonSerializable, IJsonModel + /// A rule governing the accessibility of a vault from a specific virtual network. + public partial class KeyVaultVirtualNetworkRule : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal KeyVaultVirtualNetworkRule() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -29,12 +34,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRe /// The client options for reading and writing models. protected virtual 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(KeyVaultVirtualNetworkRule)} does not support writing '{format}' format."); } - writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); if (Optional.IsDefined(IgnoreMissingVnetServiceEndpoint)) @@ -42,15 +46,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("ignoreMissingVnetServiceEndpoint"u8); writer.WriteBooleanValue(IgnoreMissingVnetServiceEndpoint.Value); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -59,133 +63,88 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - KeyVaultVirtualNetworkRule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + KeyVaultVirtualNetworkRule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual KeyVaultVirtualNetworkRule 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(KeyVaultVirtualNetworkRule)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeKeyVaultVirtualNetworkRule(document.RootElement, options); } - internal static KeyVaultVirtualNetworkRule DeserializeKeyVaultVirtualNetworkRule(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static KeyVaultVirtualNetworkRule DeserializeKeyVaultVirtualNetworkRule(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } string id = default; bool? ignoreMissingVnetServiceEndpoint = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("id"u8)) + if (prop.NameEquals("id"u8)) { - id = property.Value.GetString(); + id = prop.Value.GetString(); continue; } - if (property.NameEquals("ignoreMissingVnetServiceEndpoint"u8)) + if (prop.NameEquals("ignoreMissingVnetServiceEndpoint"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - ignoreMissingVnetServiceEndpoint = property.Value.GetBoolean(); + ignoreMissingVnetServiceEndpoint = prop.Value.GetBoolean(); 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 KeyVaultVirtualNetworkRule(id, ignoreMissingVnetServiceEndpoint, serializedAdditionalRawData); + return new KeyVaultVirtualNetworkRule(id, ignoreMissingVnetServiceEndpoint, additionalBinaryDataProperties); } - 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(Id), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" id: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Id)) - { - builder.Append(" id: "); - if (Id.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Id}'''"); - } - else - { - builder.AppendLine($"'{Id}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IgnoreMissingVnetServiceEndpoint), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" ignoreMissingVnetServiceEndpoint: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IgnoreMissingVnetServiceEndpoint)) - { - builder.Append(" ignoreMissingVnetServiceEndpoint: "); - var boolValue = IgnoreMissingVnetServiceEndpoint.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - 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(KeyVaultVirtualNetworkRule)} does not support writing '{options.Format}' format."); } } - KeyVaultVirtualNetworkRule 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. + KeyVaultVirtualNetworkRule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual KeyVaultVirtualNetworkRule 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 DeserializeKeyVaultVirtualNetworkRule(document.RootElement, options); } default: @@ -193,6 +152,7 @@ KeyVaultVirtualNetworkRule IPersistableModel.Create( } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultVirtualNetworkRule.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultVirtualNetworkRule.cs index a44e5d5e3cc0..5cc4018cd056 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultVirtualNetworkRule.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultVirtualNetworkRule.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// A rule governing the accessibility of a vault from a specific virtual network. public partial class KeyVaultVirtualNetworkRule { - /// - /// 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 . /// Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. @@ -58,22 +30,18 @@ public KeyVaultVirtualNetworkRule(string id) /// Initializes a new instance of . /// Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. /// Property to specify whether NRP will ignore the check if parent subnet has serviceEndpoints configured. - /// Keeps track of any properties unknown to the library. - internal KeyVaultVirtualNetworkRule(string id, bool? ignoreMissingVnetServiceEndpoint, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal KeyVaultVirtualNetworkRule(string id, bool? ignoreMissingVnetServiceEndpoint, IDictionary additionalBinaryDataProperties) { Id = id; IgnoreMissingVnetServiceEndpoint = ignoreMissingVnetServiceEndpoint; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal KeyVaultVirtualNetworkRule() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. [WirePath("id")] public string Id { get; set; } + /// Property to specify whether NRP will ignore the check if parent subnet has serviceEndpoints configured. [WirePath("ignoreMissingVnetServiceEndpoint")] public bool? IgnoreMissingVnetServiceEndpoint { get; set; } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MHSMPrivateEndpointConnectionsListResult.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MHSMPrivateEndpointConnectionsListResult.Serialization.cs new file mode 100644 index 000000000000..bf3f9b2ee830 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MHSMPrivateEndpointConnectionsListResult.Serialization.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.ResourceManager.KeyVault; + +namespace Azure.ResourceManager.KeyVault.Models +{ + /// List of private endpoint connections associated with a managed HSM Pools. + internal partial class MHSMPrivateEndpointConnectionsListResult : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal MHSMPrivateEndpointConnectionsListResult() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MHSMPrivateEndpointConnectionsListResult)} does not support writing '{format}' format."); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (ManagedHsmPrivateEndpointConnectionData item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + MHSMPrivateEndpointConnectionsListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual MHSMPrivateEndpointConnectionsListResult JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MHSMPrivateEndpointConnectionsListResult)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMHSMPrivateEndpointConnectionsListResult(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static MHSMPrivateEndpointConnectionsListResult DeserializeMHSMPrivateEndpointConnectionsListResult(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(ManagedHsmPrivateEndpointConnectionData.DeserializeManagedHsmPrivateEndpointConnectionData(item, options)); + } + value = array; + continue; + } + if (prop.NameEquals("nextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new MHSMPrivateEndpointConnectionsListResult(value, nextLink, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerKeyVaultContext.Default); + default: + throw new FormatException($"The model {nameof(MHSMPrivateEndpointConnectionsListResult)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + MHSMPrivateEndpointConnectionsListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual MHSMPrivateEndpointConnectionsListResult 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)) + { + return DeserializeMHSMPrivateEndpointConnectionsListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MHSMPrivateEndpointConnectionsListResult)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static MHSMPrivateEndpointConnectionsListResult FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeMHSMPrivateEndpointConnectionsListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MHSMPrivateEndpointConnectionsListResult.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MHSMPrivateEndpointConnectionsListResult.cs new file mode 100644 index 000000000000..6002d3325664 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MHSMPrivateEndpointConnectionsListResult.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.KeyVault; + +namespace Azure.ResourceManager.KeyVault.Models +{ + /// List of private endpoint connections associated with a managed HSM Pools. + internal partial class MHSMPrivateEndpointConnectionsListResult + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The MhsmPrivateEndpointConnection items on this page. + internal MHSMPrivateEndpointConnectionsListResult(IEnumerable value) + { + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The MhsmPrivateEndpointConnection items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal MHSMPrivateEndpointConnectionsListResult(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) + { + Value = value; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The MhsmPrivateEndpointConnection items on this page. + [WirePath("value")] + public IList Value { get; } + + /// The link to the next page of items. + [WirePath("nextLink")] + public Uri NextLink { get; } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHSMSecurityDomainActivationStatus.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHSMSecurityDomainActivationStatus.cs index 76c847f05e81..d34ee5b6742e 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHSMSecurityDomainActivationStatus.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHSMSecurityDomainActivationStatus.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { @@ -14,44 +15,67 @@ namespace Azure.ResourceManager.KeyVault.Models public readonly partial struct ManagedHSMSecurityDomainActivationStatus : IEquatable { private readonly string _value; + /// The managed HSM Pool is active. + private const string ActiveValue = "Active"; + /// The managed HSM Pool is not yet activated. + private const string NotActivatedValue = "NotActivated"; + /// An unknown error occurred while activating managed hsm. + private const string UnknownValue = "Unknown"; + /// Failed to activate managed hsm. + private const string FailedValue = "Failed"; /// Initializes a new instance of . + /// The value. /// is null. public ManagedHSMSecurityDomainActivationStatus(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string ActiveValue = "Active"; - private const string NotActivatedValue = "NotActivated"; - private const string UnknownValue = "Unknown"; - private const string FailedValue = "Failed"; + _value = value; + } /// The managed HSM Pool is active. public static ManagedHSMSecurityDomainActivationStatus Active { get; } = new ManagedHSMSecurityDomainActivationStatus(ActiveValue); + /// The managed HSM Pool is not yet activated. public static ManagedHSMSecurityDomainActivationStatus NotActivated { get; } = new ManagedHSMSecurityDomainActivationStatus(NotActivatedValue); + /// An unknown error occurred while activating managed hsm. public static ManagedHSMSecurityDomainActivationStatus Unknown { get; } = new ManagedHSMSecurityDomainActivationStatus(UnknownValue); + /// Failed to activate managed hsm. public static ManagedHSMSecurityDomainActivationStatus Failed { get; } = new ManagedHSMSecurityDomainActivationStatus(FailedValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(ManagedHSMSecurityDomainActivationStatus left, ManagedHSMSecurityDomainActivationStatus right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(ManagedHSMSecurityDomainActivationStatus left, ManagedHSMSecurityDomainActivationStatus right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator ManagedHSMSecurityDomainActivationStatus(string value) => new ManagedHSMSecurityDomainActivationStatus(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator ManagedHSMSecurityDomainActivationStatus?(string value) => value == null ? null : new ManagedHSMSecurityDomainActivationStatus(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is ManagedHSMSecurityDomainActivationStatus other && Equals(other); - /// + + /// public bool Equals(ManagedHSMSecurityDomainActivationStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHSMSecurityDomainProperties.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHSMSecurityDomainProperties.Serialization.cs index 96018c01e5b7..e6dee7e1dc31 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHSMSecurityDomainProperties.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHSMSecurityDomainProperties.Serialization.cs @@ -8,16 +8,16 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class ManagedHSMSecurityDomainProperties : IUtf8JsonSerializable, IJsonModel + /// The security domain properties of the managed hsm. + public partial class ManagedHSMSecurityDomainProperties : 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(); @@ -29,12 +29,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, /// The client options for reading and writing models. protected virtual 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(ManagedHSMSecurityDomainProperties)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsDefined(ActivationStatus)) { writer.WritePropertyName("activationStatus"u8); @@ -45,15 +44,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("activationStatusMessage"u8); writer.WriteStringValue(ActivationStatusMessage); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -62,132 +61,88 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ManagedHSMSecurityDomainProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ManagedHSMSecurityDomainProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ManagedHSMSecurityDomainProperties 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(ManagedHSMSecurityDomainProperties)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeManagedHSMSecurityDomainProperties(document.RootElement, options); } - internal static ManagedHSMSecurityDomainProperties DeserializeManagedHSMSecurityDomainProperties(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ManagedHSMSecurityDomainProperties DeserializeManagedHSMSecurityDomainProperties(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } ManagedHSMSecurityDomainActivationStatus? activationStatus = default; string activationStatusMessage = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("activationStatus"u8)) + if (prop.NameEquals("activationStatus"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - activationStatus = new ManagedHSMSecurityDomainActivationStatus(property.Value.GetString()); + activationStatus = new ManagedHSMSecurityDomainActivationStatus(prop.Value.GetString()); continue; } - if (property.NameEquals("activationStatusMessage"u8)) + if (prop.NameEquals("activationStatusMessage"u8)) { - activationStatusMessage = property.Value.GetString(); + activationStatusMessage = prop.Value.GetString(); 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 ManagedHSMSecurityDomainProperties(activationStatus, activationStatusMessage, serializedAdditionalRawData); + return new ManagedHSMSecurityDomainProperties(activationStatus, activationStatusMessage, additionalBinaryDataProperties); } - 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(ActivationStatus), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" activationStatus: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ActivationStatus)) - { - builder.Append(" activationStatus: "); - builder.AppendLine($"'{ActivationStatus.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ActivationStatusMessage), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" activationStatusMessage: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ActivationStatusMessage)) - { - builder.Append(" activationStatusMessage: "); - if (ActivationStatusMessage.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{ActivationStatusMessage}'''"); - } - else - { - builder.AppendLine($"'{ActivationStatusMessage}'"); - } - } - } - - 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(ManagedHSMSecurityDomainProperties)} does not support writing '{options.Format}' format."); } } - ManagedHSMSecurityDomainProperties 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. + ManagedHSMSecurityDomainProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ManagedHSMSecurityDomainProperties 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 DeserializeManagedHSMSecurityDomainProperties(document.RootElement, options); } default: @@ -195,6 +150,7 @@ ManagedHSMSecurityDomainProperties IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHSMSecurityDomainProperties.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHSMSecurityDomainProperties.cs index 67721451d9a1..12fc698dbc1c 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHSMSecurityDomainProperties.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHSMSecurityDomainProperties.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// The security domain properties of the managed hsm. public partial class ManagedHSMSecurityDomainProperties { - /// - /// 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 ManagedHSMSecurityDomainProperties() @@ -53,17 +25,18 @@ internal ManagedHSMSecurityDomainProperties() /// Initializes a new instance of . /// Activation Status. /// Activation Status Message. - /// Keeps track of any properties unknown to the library. - internal ManagedHSMSecurityDomainProperties(ManagedHSMSecurityDomainActivationStatus? activationStatus, string activationStatusMessage, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal ManagedHSMSecurityDomainProperties(ManagedHSMSecurityDomainActivationStatus? activationStatus, string activationStatusMessage, IDictionary additionalBinaryDataProperties) { ActivationStatus = activationStatus; ActivationStatusMessage = activationStatusMessage; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Activation Status. [WirePath("activationStatus")] public ManagedHSMSecurityDomainActivationStatus? ActivationStatus { get; } + /// Activation Status Message. [WirePath("activationStatusMessage")] public string ActivationStatusMessage { get; } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmActionsRequiredMessage.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmActionsRequiredMessage.cs index 8f82b96012e1..a3cd5e8bc3f7 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmActionsRequiredMessage.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmActionsRequiredMessage.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { @@ -14,35 +15,51 @@ namespace Azure.ResourceManager.KeyVault.Models public readonly partial struct ManagedHsmActionsRequiredMessage : IEquatable { private readonly string _value; + private const string NoneValue = "None"; /// Initializes a new instance of . + /// The value. /// is null. public ManagedHsmActionsRequiredMessage(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string NoneValue = "None"; + _value = value; + } - /// None. + /// Gets the None. public static ManagedHsmActionsRequiredMessage None { get; } = new ManagedHsmActionsRequiredMessage(NoneValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(ManagedHsmActionsRequiredMessage left, ManagedHsmActionsRequiredMessage right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(ManagedHsmActionsRequiredMessage left, ManagedHsmActionsRequiredMessage right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator ManagedHsmActionsRequiredMessage(string value) => new ManagedHsmActionsRequiredMessage(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator ManagedHsmActionsRequiredMessage?(string value) => value == null ? null : new ManagedHsmActionsRequiredMessage(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is ManagedHsmActionsRequiredMessage other && Equals(other); - /// + + /// public bool Equals(ManagedHsmActionsRequiredMessage other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmCreateMode.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmCreateMode.Serialization.cs index a951d228ef68..d752045f0192 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmCreateMode.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmCreateMode.Serialization.cs @@ -11,6 +11,7 @@ namespace Azure.ResourceManager.KeyVault.Models { internal static partial class ManagedHsmCreateModeExtensions { + /// The value to serialize. public static string ToSerialString(this ManagedHsmCreateMode value) => value switch { ManagedHsmCreateMode.Default => "default", @@ -18,10 +19,17 @@ internal static partial class ManagedHsmCreateModeExtensions _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ManagedHsmCreateMode value.") }; + /// The value to deserialize. public static ManagedHsmCreateMode ToManagedHsmCreateMode(this string value) { - if (StringComparer.OrdinalIgnoreCase.Equals(value, "default")) return ManagedHsmCreateMode.Default; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "recover")) return ManagedHsmCreateMode.Recover; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "default")) + { + return ManagedHsmCreateMode.Default; + } + if (StringComparer.OrdinalIgnoreCase.Equals(value, "recover")) + { + return ManagedHsmCreateMode.Recover; + } throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ManagedHsmCreateMode value."); } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmCreateMode.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmCreateMode.cs index 3796ebe6c48f..b5afe4833ab7 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmCreateMode.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmCreateMode.cs @@ -10,9 +10,9 @@ namespace Azure.ResourceManager.KeyVault.Models /// The create mode to indicate whether the resource is being created or is being recovered from a deleted resource. public enum ManagedHsmCreateMode { - /// Create a new managed HSM pool. This is the default option. + /// Default. Default, - /// Recover the managed HSM pool from a soft-deleted resource. + /// Recover. Recover } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmGeoReplicatedRegion.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmGeoReplicatedRegion.Serialization.cs index 8cf7d912bf6b..9b97862202b2 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmGeoReplicatedRegion.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmGeoReplicatedRegion.Serialization.cs @@ -8,16 +8,16 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class ManagedHsmGeoReplicatedRegion : IUtf8JsonSerializable, IJsonModel + /// A region that this managed HSM Pool has been extended to. + public partial class ManagedHsmGeoReplicatedRegion : 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(); @@ -29,12 +29,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mode /// The client options for reading and writing models. protected virtual 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(ManagedHsmGeoReplicatedRegion)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); @@ -50,15 +49,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("isPrimary"u8); writer.WriteBooleanValue(IsPrimary.Value); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -67,22 +66,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ManagedHsmGeoReplicatedRegion IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ManagedHsmGeoReplicatedRegion IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ManagedHsmGeoReplicatedRegion 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(ManagedHsmGeoReplicatedRegion)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeManagedHsmGeoReplicatedRegion(document.RootElement, options); } - internal static ManagedHsmGeoReplicatedRegion DeserializeManagedHsmGeoReplicatedRegion(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ManagedHsmGeoReplicatedRegion DeserializeManagedHsmGeoReplicatedRegion(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -90,135 +94,70 @@ internal static ManagedHsmGeoReplicatedRegion DeserializeManagedHsmGeoReplicated string name = default; ManagedHsmGeoReplicatedRegionProvisioningState? provisioningState = default; bool? isPrimary = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("name"u8)) + if (prop.NameEquals("name"u8)) { - name = property.Value.GetString(); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("provisioningState"u8)) + if (prop.NameEquals("provisioningState"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - provisioningState = new ManagedHsmGeoReplicatedRegionProvisioningState(property.Value.GetString()); + provisioningState = new ManagedHsmGeoReplicatedRegionProvisioningState(prop.Value.GetString()); continue; } - if (property.NameEquals("isPrimary"u8)) + if (prop.NameEquals("isPrimary"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - isPrimary = property.Value.GetBoolean(); + isPrimary = prop.Value.GetBoolean(); 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 ManagedHsmGeoReplicatedRegion(name, provisioningState, isPrimary, serializedAdditionalRawData); + return new ManagedHsmGeoReplicatedRegion(name, provisioningState, isPrimary, additionalBinaryDataProperties); } - 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(ProvisioningState), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" provisioningState: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ProvisioningState)) - { - builder.Append(" provisioningState: "); - builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsPrimary), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" isPrimary: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IsPrimary)) - { - builder.Append(" isPrimary: "); - var boolValue = IsPrimary.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - 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(ManagedHsmGeoReplicatedRegion)} does not support writing '{options.Format}' format."); } } - ManagedHsmGeoReplicatedRegion 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. + ManagedHsmGeoReplicatedRegion IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ManagedHsmGeoReplicatedRegion 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 DeserializeManagedHsmGeoReplicatedRegion(document.RootElement, options); } default: @@ -226,6 +165,7 @@ ManagedHsmGeoReplicatedRegion IPersistableModel.C } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmGeoReplicatedRegion.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmGeoReplicatedRegion.cs index d304705fa021..298491ec8ac2 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmGeoReplicatedRegion.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmGeoReplicatedRegion.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// A region that this managed HSM Pool has been extended to. public partial class ManagedHsmGeoReplicatedRegion { - /// - /// 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 . public ManagedHsmGeoReplicatedRegion() @@ -54,21 +26,23 @@ public ManagedHsmGeoReplicatedRegion() /// 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. - /// Keeps track of any properties unknown to the library. - internal ManagedHsmGeoReplicatedRegion(string name, ManagedHsmGeoReplicatedRegionProvisioningState? provisioningState, bool? isPrimary, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal ManagedHsmGeoReplicatedRegion(string name, ManagedHsmGeoReplicatedRegionProvisioningState? provisioningState, bool? isPrimary, IDictionary additionalBinaryDataProperties) { Name = name; ProvisioningState = provisioningState; IsPrimary = isPrimary; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Name of the geo replicated region. [WirePath("name")] public string Name { get; set; } + /// Provisioning state of the geo replicated region. [WirePath("provisioningState")] public ManagedHsmGeoReplicatedRegionProvisioningState? ProvisioningState { get; } + /// A boolean value that indicates whether the region is the primary region or a secondary region. [WirePath("isPrimary")] public bool? IsPrimary { get; set; } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmGeoReplicatedRegionProvisioningState.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmGeoReplicatedRegionProvisioningState.cs index a72eee773e67..968dc0cbbc3c 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmGeoReplicatedRegionProvisioningState.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmGeoReplicatedRegionProvisioningState.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { @@ -14,14 +15,6 @@ namespace Azure.ResourceManager.KeyVault.Models public readonly partial struct ManagedHsmGeoReplicatedRegionProvisioningState : IEquatable { private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ManagedHsmGeoReplicatedRegionProvisioningState(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - private const string PreprovisioningValue = "Preprovisioning"; private const string ProvisioningValue = "Provisioning"; private const string SucceededValue = "Succeeded"; @@ -29,35 +22,64 @@ public ManagedHsmGeoReplicatedRegionProvisioningState(string value) private const string DeletingValue = "Deleting"; private const string CleanupValue = "Cleanup"; - /// Preprovisioning. + /// Initializes a new instance of . + /// The value. + /// is null. + public ManagedHsmGeoReplicatedRegionProvisioningState(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Gets the Preprovisioning. public static ManagedHsmGeoReplicatedRegionProvisioningState Preprovisioning { get; } = new ManagedHsmGeoReplicatedRegionProvisioningState(PreprovisioningValue); - /// Provisioning. + + /// Gets the Provisioning. public static ManagedHsmGeoReplicatedRegionProvisioningState Provisioning { get; } = new ManagedHsmGeoReplicatedRegionProvisioningState(ProvisioningValue); - /// Succeeded. + + /// Gets the Succeeded. public static ManagedHsmGeoReplicatedRegionProvisioningState Succeeded { get; } = new ManagedHsmGeoReplicatedRegionProvisioningState(SucceededValue); - /// Failed. + + /// Gets the Failed. public static ManagedHsmGeoReplicatedRegionProvisioningState Failed { get; } = new ManagedHsmGeoReplicatedRegionProvisioningState(FailedValue); - /// Deleting. + + /// Gets the Deleting. public static ManagedHsmGeoReplicatedRegionProvisioningState Deleting { get; } = new ManagedHsmGeoReplicatedRegionProvisioningState(DeletingValue); - /// Cleanup. + + /// Gets the Cleanup. public static ManagedHsmGeoReplicatedRegionProvisioningState Cleanup { get; } = new ManagedHsmGeoReplicatedRegionProvisioningState(CleanupValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(ManagedHsmGeoReplicatedRegionProvisioningState left, ManagedHsmGeoReplicatedRegionProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(ManagedHsmGeoReplicatedRegionProvisioningState left, ManagedHsmGeoReplicatedRegionProvisioningState right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator ManagedHsmGeoReplicatedRegionProvisioningState(string value) => new ManagedHsmGeoReplicatedRegionProvisioningState(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator ManagedHsmGeoReplicatedRegionProvisioningState?(string value) => value == null ? null : new ManagedHsmGeoReplicatedRegionProvisioningState(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is ManagedHsmGeoReplicatedRegionProvisioningState other && Equals(other); - /// + + /// public bool Equals(ManagedHsmGeoReplicatedRegionProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmIPRule.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmIPRule.Serialization.cs index f2af83b25603..342559f97385 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmIPRule.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmIPRule.Serialization.cs @@ -8,16 +8,21 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class ManagedHsmIPRule : IUtf8JsonSerializable, IJsonModel + /// A rule governing the accessibility of a managed HSM pool from a specific IP address or IP range. + public partial class ManagedHsmIPRule : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal ManagedHsmIPRule() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -29,23 +34,22 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriter /// The client options for reading and writing models. protected virtual 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(ManagedHsmIPRule)} does not support writing '{format}' format."); } - writer.WritePropertyName("value"u8); writer.WriteStringValue(AddressRange); - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -54,107 +58,78 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ManagedHsmIPRule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ManagedHsmIPRule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ManagedHsmIPRule 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(ManagedHsmIPRule)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeManagedHsmIPRule(document.RootElement, options); } - internal static ManagedHsmIPRule DeserializeManagedHsmIPRule(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ManagedHsmIPRule DeserializeManagedHsmIPRule(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - string value = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + string addressRange = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - value = property.Value.GetString(); + addressRange = prop.Value.GetString(); 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 ManagedHsmIPRule(value, serializedAdditionalRawData); + return new ManagedHsmIPRule(addressRange, additionalBinaryDataProperties); } - 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(AddressRange), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" value: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(AddressRange)) - { - builder.Append(" value: "); - if (AddressRange.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{AddressRange}'''"); - } - else - { - builder.AppendLine($"'{AddressRange}'"); - } - } - } - - 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(ManagedHsmIPRule)} does not support writing '{options.Format}' format."); } } - ManagedHsmIPRule 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. + ManagedHsmIPRule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ManagedHsmIPRule 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 DeserializeManagedHsmIPRule(document.RootElement, options); } default: @@ -162,6 +137,7 @@ ManagedHsmIPRule IPersistableModel.Create(BinaryData data, Mod } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmIPRule.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmIPRule.cs index f782e9afee29..ccf20166e519 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmIPRule.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmIPRule.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// A rule governing the accessibility of a managed HSM pool from a specific IP address or IP range. public partial class ManagedHsmIPRule { - /// - /// 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 . /// An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). @@ -57,16 +29,11 @@ public ManagedHsmIPRule(string addressRange) /// Initializes a new instance of . /// An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). - /// Keeps track of any properties unknown to the library. - internal ManagedHsmIPRule(string addressRange, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal ManagedHsmIPRule(string addressRange, IDictionary additionalBinaryDataProperties) { AddressRange = addressRange; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ManagedHsmIPRule() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmListResult.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmListResult.Serialization.cs index 4ca2eda9d015..4c532a8f791c 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmListResult.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmListResult.Serialization.cs @@ -8,17 +8,22 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - internal partial class ManagedHsmListResult : IUtf8JsonSerializable, IJsonModel + /// The response of a ManagedHsm list operation. + internal partial class ManagedHsmListResult : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal ManagedHsmListResult() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -30,15 +35,14 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr /// The client options for reading and writing models. protected virtual 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(ManagedHsmListResult)} does not support writing '{format}' format."); } - writer.WritePropertyName("value"u8); writer.WriteStartArray(); - foreach (var item in Value) + foreach (ManagedHsmData item in Value) { writer.WriteObjectValue(item, options); } @@ -48,15 +52,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("nextLink"u8); writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -65,137 +69,93 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ManagedHsmListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ManagedHsmListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ManagedHsmListResult 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(ManagedHsmListResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeManagedHsmListResult(document.RootElement, options); } - internal static ManagedHsmListResult DeserializeManagedHsmListResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ManagedHsmListResult DeserializeManagedHsmListResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; + IList value = default; Uri nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(ManagedHsmData.DeserializeManagedHsmData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - nextLink = new Uri(property.Value.GetString()); + nextLink = new Uri(prop.Value.GetString()); 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 ManagedHsmListResult(value, nextLink, serializedAdditionalRawData); + return new ManagedHsmListResult(value, nextLink, additionalBinaryDataProperties); } - 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(Value), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" value: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Value)) - { - if (Value.Any()) - { - builder.Append(" value: "); - builder.AppendLine("["); - foreach (var item in Value) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nextLink: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NextLink)) - { - builder.Append(" nextLink: "); - builder.AppendLine($"'{NextLink.AbsoluteUri}'"); - } - } - - 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(ManagedHsmListResult)} does not support writing '{options.Format}' format."); } } - ManagedHsmListResult 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. + ManagedHsmListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ManagedHsmListResult 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 DeserializeManagedHsmListResult(document.RootElement, options); } default: @@ -203,6 +163,15 @@ ManagedHsmListResult IPersistableModel.Create(BinaryData d } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static ManagedHsmListResult FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeManagedHsmListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmListResult.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmListResult.cs index ceeceb1200fa..689ea0f76a72 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmListResult.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmListResult.cs @@ -8,73 +8,40 @@ using System; using System.Collections.Generic; using System.Linq; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// The response of a ManagedHsm list operation. internal partial class ManagedHsmListResult { - /// - /// 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 . /// The ManagedHsm items on this page. - /// is null. internal ManagedHsmListResult(IEnumerable value) { - Argument.AssertNotNull(value, nameof(value)); - Value = value.ToList(); } /// Initializes a new instance of . /// The ManagedHsm items on this page. /// The link to the next page of items. - /// Keeps track of any properties unknown to the library. - internal ManagedHsmListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal ManagedHsmListResult(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ManagedHsmListResult() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The ManagedHsm items on this page. - public IReadOnlyList Value { get; } + [WirePath("value")] + public IList Value { get; } + /// The link to the next page of items. + [WirePath("nextLink")] public Uri NextLink { get; } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNameAvailabilityContent.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNameAvailabilityContent.Serialization.cs deleted file mode 100644 index 736796c1a18c..000000000000 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNameAvailabilityContent.Serialization.cs +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.KeyVault.Models -{ - public partial class ManagedHsmNameAvailabilityContent : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ManagedHsmNameAvailabilityContent)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedHsmNameAvailabilityContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ManagedHsmNameAvailabilityContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedHsmNameAvailabilityContent(document.RootElement, options); - } - - internal static ManagedHsmNameAvailabilityContent DeserializeManagedHsmNameAvailabilityContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string name = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ManagedHsmNameAvailabilityContent(name, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerKeyVaultContext.Default); - default: - throw new FormatException($"The model {nameof(ManagedHsmNameAvailabilityContent)} does not support writing '{options.Format}' format."); - } - } - - ManagedHsmNameAvailabilityContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeManagedHsmNameAvailabilityContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedHsmNameAvailabilityContent)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNameAvailabilityContent.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNameAvailabilityContent.cs deleted file mode 100644 index e41fd95e0a97..000000000000 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNameAvailabilityContent.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.KeyVault.Models -{ - /// The parameters used to check the availability of the managed hsm name. - public partial class ManagedHsmNameAvailabilityContent - { - /// - /// 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; - - /// Initializes a new instance of . - /// The managed hsm name. - /// is null. - public ManagedHsmNameAvailabilityContent(string name) - { - Argument.AssertNotNull(name, nameof(name)); - - Name = name; - } - - /// Initializes a new instance of . - /// The managed hsm name. - /// Keeps track of any properties unknown to the library. - internal ManagedHsmNameAvailabilityContent(string name, IDictionary serializedAdditionalRawData) - { - Name = name; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ManagedHsmNameAvailabilityContent() - { - } - - /// The managed hsm name. - [WirePath("name")] - public string Name { get; } - } -} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNameAvailabilityParameters.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNameAvailabilityParameters.Serialization.cs new file mode 100644 index 000000000000..fe9cd8421644 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNameAvailabilityParameters.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.KeyVault; + +namespace Azure.ResourceManager.KeyVault.Models +{ + /// The parameters used to check the availability of the managed hsm name. + public partial class ManagedHsmNameAvailabilityParameters : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal ManagedHsmNameAvailabilityParameters() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedHsmNameAvailabilityParameters)} does not support writing '{format}' format."); + } + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ManagedHsmNameAvailabilityParameters IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ManagedHsmNameAvailabilityParameters JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedHsmNameAvailabilityParameters)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedHsmNameAvailabilityParameters(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ManagedHsmNameAvailabilityParameters DeserializeManagedHsmNameAvailabilityParameters(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ManagedHsmNameAvailabilityParameters(name, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerKeyVaultContext.Default); + default: + throw new FormatException($"The model {nameof(ManagedHsmNameAvailabilityParameters)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ManagedHsmNameAvailabilityParameters IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ManagedHsmNameAvailabilityParameters 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)) + { + return DeserializeManagedHsmNameAvailabilityParameters(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedHsmNameAvailabilityParameters)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(ManagedHsmNameAvailabilityParameters managedHsmNameAvailabilityParameters) + { + if (managedHsmNameAvailabilityParameters == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(managedHsmNameAvailabilityParameters, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNameAvailabilityParameters.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNameAvailabilityParameters.cs new file mode 100644 index 000000000000..811831d1507f --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNameAvailabilityParameters.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; + +namespace Azure.ResourceManager.KeyVault.Models +{ + /// The parameters used to check the availability of the managed hsm name. + public partial class ManagedHsmNameAvailabilityParameters + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The managed hsm name. + /// is null. + public ManagedHsmNameAvailabilityParameters(string name) + { + Argument.AssertNotNull(name, nameof(name)); + + Name = name; + } + + /// Initializes a new instance of . + /// The managed hsm name. + /// Keeps track of any properties unknown to the library. + internal ManagedHsmNameAvailabilityParameters(string name, IDictionary additionalBinaryDataProperties) + { + Name = name; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The managed hsm name. + [WirePath("name")] + public string Name { get; } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNameAvailabilityResult.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNameAvailabilityResult.Serialization.cs index 6fb7e658201b..ebaf358bbad2 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNameAvailabilityResult.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNameAvailabilityResult.Serialization.cs @@ -8,16 +8,17 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class ManagedHsmNameAvailabilityResult : IUtf8JsonSerializable, IJsonModel + /// The CheckMhsmNameAvailability operation response. + public partial class ManagedHsmNameAvailabilityResult : 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(); @@ -29,12 +30,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, M /// The client options for reading and writing models. protected virtual 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(ManagedHsmNameAvailabilityResult)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsDefined(IsNameAvailable)) { writer.WritePropertyName("nameAvailable"u8); @@ -50,15 +50,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("message"u8); writer.WriteStringValue(Message); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -67,158 +67,98 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ManagedHsmNameAvailabilityResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ManagedHsmNameAvailabilityResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ManagedHsmNameAvailabilityResult 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(ManagedHsmNameAvailabilityResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeManagedHsmNameAvailabilityResult(document.RootElement, options); } - internal static ManagedHsmNameAvailabilityResult DeserializeManagedHsmNameAvailabilityResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ManagedHsmNameAvailabilityResult DeserializeManagedHsmNameAvailabilityResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - bool? nameAvailable = default; + bool? isNameAvailable = default; ManagedHsmNameUnavailableReason? reason = default; string message = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("nameAvailable"u8)) + if (prop.NameEquals("nameAvailable"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - nameAvailable = property.Value.GetBoolean(); + isNameAvailable = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("reason"u8)) + if (prop.NameEquals("reason"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - reason = new ManagedHsmNameUnavailableReason(property.Value.GetString()); + reason = new ManagedHsmNameUnavailableReason(prop.Value.GetString()); continue; } - if (property.NameEquals("message"u8)) + if (prop.NameEquals("message"u8)) { - message = property.Value.GetString(); + message = prop.Value.GetString(); 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 ManagedHsmNameAvailabilityResult(nameAvailable, reason, message, serializedAdditionalRawData); + return new ManagedHsmNameAvailabilityResult(isNameAvailable, reason, message, additionalBinaryDataProperties); } - 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(IsNameAvailable), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nameAvailable: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IsNameAvailable)) - { - builder.Append(" nameAvailable: "); - var boolValue = IsNameAvailable.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Reason), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" reason: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Reason)) - { - builder.Append(" reason: "); - builder.AppendLine($"'{Reason.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Message), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" message: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Message)) - { - builder.Append(" message: "); - if (Message.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Message}'''"); - } - else - { - builder.AppendLine($"'{Message}'"); - } - } - } - - 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(ManagedHsmNameAvailabilityResult)} does not support writing '{options.Format}' format."); } } - ManagedHsmNameAvailabilityResult 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. + ManagedHsmNameAvailabilityResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ManagedHsmNameAvailabilityResult 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 DeserializeManagedHsmNameAvailabilityResult(document.RootElement, options); } default: @@ -226,6 +166,15 @@ ManagedHsmNameAvailabilityResult IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static ManagedHsmNameAvailabilityResult FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeManagedHsmNameAvailabilityResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNameAvailabilityResult.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNameAvailabilityResult.cs index eb79655ef9ee..1325089ff2dc 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNameAvailabilityResult.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNameAvailabilityResult.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// The CheckMhsmNameAvailability operation response. public partial class ManagedHsmNameAvailabilityResult { - /// - /// 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 ManagedHsmNameAvailabilityResult() @@ -54,21 +26,23 @@ internal ManagedHsmNameAvailabilityResult() /// 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. - /// Keeps track of any properties unknown to the library. - internal ManagedHsmNameAvailabilityResult(bool? isNameAvailable, ManagedHsmNameUnavailableReason? reason, string message, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal ManagedHsmNameAvailabilityResult(bool? isNameAvailable, ManagedHsmNameUnavailableReason? reason, string message, IDictionary additionalBinaryDataProperties) { IsNameAvailable = isNameAvailable; Reason = reason; Message = message; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// 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. [WirePath("nameAvailable")] public bool? IsNameAvailable { get; } + /// The reason that a managed hsm name could not be used. The reason element is only returned if NameAvailable is false. [WirePath("reason")] public ManagedHsmNameUnavailableReason? Reason { get; } + /// An error message explaining the Reason value in more detail. [WirePath("message")] public string Message { get; } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNameUnavailableReason.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNameUnavailableReason.cs index 13568a705b04..57c8e2508cf8 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNameUnavailableReason.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNameUnavailableReason.cs @@ -7,45 +7,63 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - /// The reason that a managed hsm name could not be used. The reason element is only returned if NameAvailable is false. + /// The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false. public readonly partial struct ManagedHsmNameUnavailableReason : IEquatable { private readonly string _value; + private const string AccountNameInvalidValue = "AccountNameInvalid"; + private const string AlreadyExistsValue = "AlreadyExists"; /// Initializes a new instance of . + /// The value. /// is null. public ManagedHsmNameUnavailableReason(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string AccountNameInvalidValue = "AccountNameInvalid"; - private const string AlreadyExistsValue = "AlreadyExists"; + _value = value; + } - /// AccountNameInvalid. + /// Gets the AccountNameInvalid. public static ManagedHsmNameUnavailableReason AccountNameInvalid { get; } = new ManagedHsmNameUnavailableReason(AccountNameInvalidValue); - /// AlreadyExists. + + /// Gets the AlreadyExists. public static ManagedHsmNameUnavailableReason AlreadyExists { get; } = new ManagedHsmNameUnavailableReason(AlreadyExistsValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(ManagedHsmNameUnavailableReason left, ManagedHsmNameUnavailableReason right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(ManagedHsmNameUnavailableReason left, ManagedHsmNameUnavailableReason right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator ManagedHsmNameUnavailableReason(string value) => new ManagedHsmNameUnavailableReason(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator ManagedHsmNameUnavailableReason?(string value) => value == null ? null : new ManagedHsmNameUnavailableReason(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is ManagedHsmNameUnavailableReason other && Equals(other); - /// + + /// public bool Equals(ManagedHsmNameUnavailableReason other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNetworkRuleAction.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNetworkRuleAction.cs index a0661fd52b7a..7f439cf5d1fb 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNetworkRuleAction.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNetworkRuleAction.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { @@ -14,38 +15,55 @@ namespace Azure.ResourceManager.KeyVault.Models public readonly partial struct ManagedHsmNetworkRuleAction : IEquatable { private readonly string _value; + private const string AllowValue = "Allow"; + private const string DenyValue = "Deny"; /// Initializes a new instance of . + /// The value. /// is null. public ManagedHsmNetworkRuleAction(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string AllowValue = "Allow"; - private const string DenyValue = "Deny"; + _value = value; + } - /// Allow. + /// Gets the Allow. public static ManagedHsmNetworkRuleAction Allow { get; } = new ManagedHsmNetworkRuleAction(AllowValue); - /// Deny. + + /// Gets the Deny. public static ManagedHsmNetworkRuleAction Deny { get; } = new ManagedHsmNetworkRuleAction(DenyValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(ManagedHsmNetworkRuleAction left, ManagedHsmNetworkRuleAction right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(ManagedHsmNetworkRuleAction left, ManagedHsmNetworkRuleAction right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator ManagedHsmNetworkRuleAction(string value) => new ManagedHsmNetworkRuleAction(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator ManagedHsmNetworkRuleAction?(string value) => value == null ? null : new ManagedHsmNetworkRuleAction(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is ManagedHsmNetworkRuleAction other && Equals(other); - /// + + /// public bool Equals(ManagedHsmNetworkRuleAction other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNetworkRuleBypassOption.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNetworkRuleBypassOption.cs index bc1a1f8fe8aa..99ac3632b585 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNetworkRuleBypassOption.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNetworkRuleBypassOption.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { @@ -14,38 +15,55 @@ namespace Azure.ResourceManager.KeyVault.Models public readonly partial struct ManagedHsmNetworkRuleBypassOption : IEquatable { private readonly string _value; + private const string AzureServicesValue = "AzureServices"; + private const string NoneValue = "None"; /// Initializes a new instance of . + /// The value. /// is null. public ManagedHsmNetworkRuleBypassOption(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string AzureServicesValue = "AzureServices"; - private const string NoneValue = "None"; + _value = value; + } - /// AzureServices. + /// Gets the AzureServices. public static ManagedHsmNetworkRuleBypassOption AzureServices { get; } = new ManagedHsmNetworkRuleBypassOption(AzureServicesValue); - /// None. + + /// Gets the None. public static ManagedHsmNetworkRuleBypassOption None { get; } = new ManagedHsmNetworkRuleBypassOption(NoneValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(ManagedHsmNetworkRuleBypassOption left, ManagedHsmNetworkRuleBypassOption right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(ManagedHsmNetworkRuleBypassOption left, ManagedHsmNetworkRuleBypassOption right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator ManagedHsmNetworkRuleBypassOption(string value) => new ManagedHsmNetworkRuleBypassOption(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator ManagedHsmNetworkRuleBypassOption?(string value) => value == null ? null : new ManagedHsmNetworkRuleBypassOption(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is ManagedHsmNetworkRuleBypassOption other && Equals(other); - /// + + /// public bool Equals(ManagedHsmNetworkRuleBypassOption other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNetworkRuleSet.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNetworkRuleSet.Serialization.cs index 5456f0ca2b07..801a7ccefaf4 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNetworkRuleSet.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNetworkRuleSet.Serialization.cs @@ -8,17 +8,16 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class ManagedHsmNetworkRuleSet : IUtf8JsonSerializable, IJsonModel + /// A set of rules governing the network accessibility of a managed hsm pool. + public partial class ManagedHsmNetworkRuleSet : 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(); @@ -30,12 +29,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead /// The client options for reading and writing models. protected virtual 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(ManagedHsmNetworkRuleSet)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Bypass)) { writer.WritePropertyName("bypass"u8); @@ -46,11 +44,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("defaultAction"u8); writer.WriteStringValue(DefaultAction.Value.ToString()); } - if (Optional.IsCollectionDefined(IPRules)) + if (Optional.IsCollectionDefined(IpRules)) { writer.WritePropertyName("ipRules"u8); writer.WriteStartArray(); - foreach (var item in IPRules) + foreach (ManagedHsmIPRule item in IpRules) { writer.WriteObjectValue(item, options); } @@ -60,7 +58,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("serviceTags"u8); writer.WriteStartArray(); - foreach (var item in ServiceTags) + foreach (ManagedHsmServiceTagRule item in ServiceTags) { writer.WriteObjectValue(item, options); } @@ -70,21 +68,21 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("virtualNetworkRules"u8); writer.WriteStartArray(); - foreach (var item in VirtualNetworkRules) + foreach (ManagedHsmVirtualNetworkRule item in VirtualNetworkRules) { writer.WriteObjectValue(item, options); } writer.WriteEndArray(); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -93,22 +91,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ManagedHsmNetworkRuleSet IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ManagedHsmNetworkRuleSet IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ManagedHsmNetworkRuleSet 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(ManagedHsmNetworkRuleSet)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeManagedHsmNetworkRuleSet(document.RootElement, options); } - internal static ManagedHsmNetworkRuleSet DeserializeManagedHsmNetworkRuleSet(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ManagedHsmNetworkRuleSet DeserializeManagedHsmNetworkRuleSet(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -118,64 +121,63 @@ internal static ManagedHsmNetworkRuleSet DeserializeManagedHsmNetworkRuleSet(Jso IList ipRules = default; IList serviceTags = default; IList virtualNetworkRules = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("bypass"u8)) + if (prop.NameEquals("bypass"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - bypass = new ManagedHsmNetworkRuleBypassOption(property.Value.GetString()); + bypass = new ManagedHsmNetworkRuleBypassOption(prop.Value.GetString()); continue; } - if (property.NameEquals("defaultAction"u8)) + if (prop.NameEquals("defaultAction"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - defaultAction = new ManagedHsmNetworkRuleAction(property.Value.GetString()); + defaultAction = new ManagedHsmNetworkRuleAction(prop.Value.GetString()); continue; } - if (property.NameEquals("ipRules"u8)) + if (prop.NameEquals("ipRules"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(ManagedHsmIPRule.DeserializeManagedHsmIPRule(item, options)); } ipRules = array; continue; } - if (property.NameEquals("serviceTags"u8)) + if (prop.NameEquals("serviceTags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(ManagedHsmServiceTagRule.DeserializeManagedHsmServiceTagRule(item, options)); } serviceTags = array; continue; } - if (property.NameEquals("virtualNetworkRules"u8)) + if (prop.NameEquals("virtualNetworkRules"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(ManagedHsmVirtualNetworkRule.DeserializeManagedHsmVirtualNetworkRule(item, options)); } @@ -184,157 +186,48 @@ internal static ManagedHsmNetworkRuleSet DeserializeManagedHsmNetworkRuleSet(Jso } 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 ManagedHsmNetworkRuleSet( bypass, defaultAction, ipRules ?? new ChangeTrackingList(), serviceTags ?? new ChangeTrackingList(), virtualNetworkRules ?? new ChangeTrackingList(), - serializedAdditionalRawData); + additionalBinaryDataProperties); } - 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(Bypass), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" bypass: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Bypass)) - { - builder.Append(" bypass: "); - builder.AppendLine($"'{Bypass.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DefaultAction), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" defaultAction: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(DefaultAction)) - { - builder.Append(" defaultAction: "); - builder.AppendLine($"'{DefaultAction.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IPRules), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" ipRules: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(IPRules)) - { - if (IPRules.Any()) - { - builder.Append(" ipRules: "); - builder.AppendLine("["); - foreach (var item in IPRules) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " ipRules: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ServiceTags), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" serviceTags: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(ServiceTags)) - { - if (ServiceTags.Any()) - { - builder.Append(" serviceTags: "); - builder.AppendLine("["); - foreach (var item in ServiceTags) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " serviceTags: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VirtualNetworkRules), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" virtualNetworkRules: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(VirtualNetworkRules)) - { - if (VirtualNetworkRules.Any()) - { - builder.Append(" virtualNetworkRules: "); - builder.AppendLine("["); - foreach (var item in VirtualNetworkRules) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " virtualNetworkRules: "); - } - builder.AppendLine(" ]"); - } - } - } - - 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(ManagedHsmNetworkRuleSet)} does not support writing '{options.Format}' format."); } } - ManagedHsmNetworkRuleSet 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. + ManagedHsmNetworkRuleSet IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ManagedHsmNetworkRuleSet 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 DeserializeManagedHsmNetworkRuleSet(document.RootElement, options); } default: @@ -342,6 +235,7 @@ ManagedHsmNetworkRuleSet IPersistableModel.Create(Bina } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNetworkRuleSet.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNetworkRuleSet.cs index 7562020c3333..ec9c3db4931a 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNetworkRuleSet.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmNetworkRuleSet.cs @@ -7,48 +7,20 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// A set of rules governing the network accessibility of a managed hsm pool. public partial class ManagedHsmNetworkRuleSet { - /// - /// 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 . public ManagedHsmNetworkRuleSet() { - IPRules = new ChangeTrackingList(); + IpRules = new ChangeTrackingList(); ServiceTags = new ChangeTrackingList(); VirtualNetworkRules = new ChangeTrackingList(); } @@ -59,29 +31,33 @@ public ManagedHsmNetworkRuleSet() /// The list of IP address rules. /// The list of service tags. /// The list of virtual network rules. - /// Keeps track of any properties unknown to the library. - internal ManagedHsmNetworkRuleSet(ManagedHsmNetworkRuleBypassOption? bypass, ManagedHsmNetworkRuleAction? defaultAction, IList ipRules, IList serviceTags, IList virtualNetworkRules, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal ManagedHsmNetworkRuleSet(ManagedHsmNetworkRuleBypassOption? bypass, ManagedHsmNetworkRuleAction? defaultAction, IList ipRules, IList serviceTags, IList virtualNetworkRules, IDictionary additionalBinaryDataProperties) { Bypass = bypass; DefaultAction = defaultAction; - IPRules = ipRules; + IpRules = ipRules; ServiceTags = serviceTags; VirtualNetworkRules = virtualNetworkRules; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. [WirePath("bypass")] public ManagedHsmNetworkRuleBypassOption? Bypass { get; set; } + /// The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. [WirePath("defaultAction")] public ManagedHsmNetworkRuleAction? DefaultAction { get; set; } + /// The list of IP address rules. [WirePath("ipRules")] - public IList IPRules { get; } + public IList IpRules { get; } + /// The list of service tags. [WirePath("serviceTags")] public IList ServiceTags { get; } + /// The list of virtual network rules. [WirePath("virtualNetworkRules")] public IList VirtualNetworkRules { get; } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpoint.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpoint.Serialization.cs new file mode 100644 index 000000000000..657801e0e07a --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpoint.Serialization.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.KeyVault; + +namespace Azure.ResourceManager.KeyVault.Models +{ + /// Private endpoint object properties. + internal partial class ManagedHsmPrivateEndpoint : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedHsmPrivateEndpoint)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ManagedHsmPrivateEndpoint IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ManagedHsmPrivateEndpoint JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedHsmPrivateEndpoint)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedHsmPrivateEndpoint(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ManagedHsmPrivateEndpoint DeserializeManagedHsmPrivateEndpoint(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("id"u8)) + { + id = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ManagedHsmPrivateEndpoint(id, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerKeyVaultContext.Default); + default: + throw new FormatException($"The model {nameof(ManagedHsmPrivateEndpoint)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ManagedHsmPrivateEndpoint IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ManagedHsmPrivateEndpoint 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)) + { + return DeserializeManagedHsmPrivateEndpoint(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedHsmPrivateEndpoint)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpoint.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpoint.cs new file mode 100644 index 000000000000..1768330e92bc --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpoint.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; + +namespace Azure.ResourceManager.KeyVault.Models +{ + /// Private endpoint object properties. + internal partial class ManagedHsmPrivateEndpoint + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ManagedHsmPrivateEndpoint() + { + } + + /// Initializes a new instance of . + /// Full identifier of the private endpoint resource. + /// Keeps track of any properties unknown to the library. + internal ManagedHsmPrivateEndpoint(string id, IDictionary additionalBinaryDataProperties) + { + Id = id; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Full identifier of the private endpoint resource. + [WirePath("id")] + public string Id { get; } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpointConnectionItemData.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpointConnectionItemData.Serialization.cs index e34b8e08a6d4..7ea80684823e 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpointConnectionItemData.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpointConnectionItemData.Serialization.cs @@ -8,17 +8,18 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Text; using System.Text.Json; +using Azure; using Azure.Core; -using Azure.ResourceManager.Resources.Models; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class ManagedHsmPrivateEndpointConnectionItemData : IUtf8JsonSerializable, IJsonModel + /// Private endpoint connection item. + public partial class ManagedHsmPrivateEndpointConnectionItemData : 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(); @@ -30,12 +31,11 @@ void IJsonModel.Write(Utf8JsonWrite /// The client options for reading and writing models. protected virtual 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(ManagedHsmPrivateEndpointConnectionItemData)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Id)) { writer.WritePropertyName("id"u8); @@ -46,33 +46,20 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("etag"u8); writer.WriteStringValue(ETag.Value.ToString()); } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(PrivateEndpoint)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("privateEndpoint"u8); - ((IJsonModel)PrivateEndpoint).Write(writer, options); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - if (Optional.IsDefined(PrivateLinkServiceConnectionState)) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - writer.WritePropertyName("privateLinkServiceConnectionState"u8); - writer.WriteObjectValue(PrivateLinkServiceConnectionState, options); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); - } - writer.WriteEndObject(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -81,229 +68,102 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ManagedHsmPrivateEndpointConnectionItemData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ManagedHsmPrivateEndpointConnectionItemData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ManagedHsmPrivateEndpointConnectionItemData 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(ManagedHsmPrivateEndpointConnectionItemData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeManagedHsmPrivateEndpointConnectionItemData(document.RootElement, options); } - internal static ManagedHsmPrivateEndpointConnectionItemData DeserializeManagedHsmPrivateEndpointConnectionItemData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ManagedHsmPrivateEndpointConnectionItemData DeserializeManagedHsmPrivateEndpointConnectionItemData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } ResourceIdentifier id = default; - ETag? etag = default; - SubResource privateEndpoint = default; - ManagedHsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState = default; - ManagedHsmPrivateEndpointConnectionProvisioningState? provisioningState = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + ETag? eTag = default; + ManagedHsmPrivateEndpointConnectionProperties properties = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("id"u8)) + if (prop.NameEquals("id"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - id = new ResourceIdentifier(property.Value.GetString()); + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("etag"u8)) + if (prop.NameEquals("etag"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - etag = new ETag(property.Value.GetString()); + eTag = new ETag(prop.Value.GetString()); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("properties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("privateEndpoint"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - privateEndpoint = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property0.Value.GetRawText())), options, AzureResourceManagerKeyVaultContext.Default); - continue; - } - if (property0.NameEquals("privateLinkServiceConnectionState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - privateLinkServiceConnectionState = ManagedHsmPrivateLinkServiceConnectionState.DeserializeManagedHsmPrivateLinkServiceConnectionState(property0.Value, options); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new ManagedHsmPrivateEndpointConnectionProvisioningState(property0.Value.GetString()); - continue; - } - } + properties = ManagedHsmPrivateEndpointConnectionProperties.DeserializeManagedHsmPrivateEndpointConnectionProperties(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 ManagedHsmPrivateEndpointConnectionItemData( - id, - etag, - privateEndpoint, - privateLinkServiceConnectionState, - provisioningState, - serializedAdditionalRawData); + return new ManagedHsmPrivateEndpointConnectionItemData(id, eTag, properties, additionalBinaryDataProperties); } - 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(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(ETag), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" etag: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ETag)) - { - builder.Append(" etag: "); - builder.AppendLine($"'{ETag.Value.ToString()}'"); - } - } - - builder.Append(" properties:"); - builder.AppendLine(" {"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("PrivateEndpointId", out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" privateEndpoint: "); - builder.AppendLine("{"); - builder.AppendLine(" privateEndpoint: {"); - builder.Append(" id: "); - builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - builder.AppendLine(" }"); - } - else - { - if (Optional.IsDefined(PrivateEndpoint)) - { - builder.Append(" privateEndpoint: "); - BicepSerializationHelpers.AppendChildObject(builder, PrivateEndpoint, options, 4, false, " privateEndpoint: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PrivateLinkServiceConnectionState), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" privateLinkServiceConnectionState: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PrivateLinkServiceConnectionState)) - { - builder.Append(" privateLinkServiceConnectionState: "); - BicepSerializationHelpers.AppendChildObject(builder, PrivateLinkServiceConnectionState, options, 4, false, " privateLinkServiceConnectionState: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" provisioningState: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ProvisioningState)) - { - builder.Append(" provisioningState: "); - builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); - } - } - - builder.AppendLine(" }"); - 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(ManagedHsmPrivateEndpointConnectionItemData)} does not support writing '{options.Format}' format."); } } - ManagedHsmPrivateEndpointConnectionItemData 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. + ManagedHsmPrivateEndpointConnectionItemData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ManagedHsmPrivateEndpointConnectionItemData 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 DeserializeManagedHsmPrivateEndpointConnectionItemData(document.RootElement, options); } default: @@ -311,6 +171,7 @@ ManagedHsmPrivateEndpointConnectionItemData IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpointConnectionItemData.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpointConnectionItemData.cs index d509a6d2ccd3..d0da92a0cb13 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpointConnectionItemData.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpointConnectionItemData.cs @@ -7,45 +7,17 @@ using System; using System.Collections.Generic; +using Azure; using Azure.Core; -using Azure.ResourceManager.Resources.Models; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// Private endpoint connection item. public partial class ManagedHsmPrivateEndpointConnectionItemData { - /// - /// 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 ManagedHsmPrivateEndpointConnectionItemData() @@ -54,41 +26,57 @@ internal ManagedHsmPrivateEndpointConnectionItemData() /// 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. - /// Keeps track of any properties unknown to the library. - internal ManagedHsmPrivateEndpointConnectionItemData(ResourceIdentifier id, ETag? etag, SubResource privateEndpoint, ManagedHsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState, ManagedHsmPrivateEndpointConnectionProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + /// Modified whenever there is a change in the state of private endpoint connection. + /// Private endpoint connection properties. + /// Keeps track of any properties unknown to the library. + internal ManagedHsmPrivateEndpointConnectionItemData(ResourceIdentifier id, ETag? eTag, ManagedHsmPrivateEndpointConnectionProperties properties, IDictionary additionalBinaryDataProperties) { Id = id; - ETag = etag; - PrivateEndpoint = privateEndpoint; - PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; - ProvisioningState = provisioningState; - _serializedAdditionalRawData = serializedAdditionalRawData; + ETag = eTag; + Properties = properties; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Id of private endpoint connection. [WirePath("id")] public ResourceIdentifier Id { get; } + /// Modified whenever there is a change in the state of private endpoint connection. [WirePath("etag")] public ETag? ETag { get; } - /// Properties of the private endpoint object. - internal SubResource PrivateEndpoint { get; } - /// Gets Id. - [WirePath("properties.privateEndpoint.id")] - public ResourceIdentifier PrivateEndpointId - { - get => PrivateEndpoint?.Id; - } + + /// Private endpoint connection properties. + [WirePath("properties")] + internal ManagedHsmPrivateEndpointConnectionProperties Properties { get; } /// Approval state of the private link connection. [WirePath("properties.privateLinkServiceConnectionState")] - public ManagedHsmPrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get; } + public ManagedHsmPrivateLinkServiceConnectionState PrivateLinkServiceConnectionState + { + get + { + return Properties.PrivateLinkServiceConnectionState; + } + } + /// Provisioning state of the private endpoint connection. [WirePath("properties.provisioningState")] - public ManagedHsmPrivateEndpointConnectionProvisioningState? ProvisioningState { get; } + public ManagedHsmPrivateEndpointConnectionProvisioningState? ProvisioningState + { + get + { + return Properties.ProvisioningState; + } + } + + /// Full identifier of the private endpoint resource. + [WirePath("properties.privateEndpoint.id")] + public string PrivateEndpointId + { + get + { + return Properties.PrivateEndpointId; + } + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpointConnectionProperties.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpointConnectionProperties.Serialization.cs new file mode 100644 index 000000000000..dbaf897c8c2d --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpointConnectionProperties.Serialization.cs @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.KeyVault; + +namespace Azure.ResourceManager.KeyVault.Models +{ + /// Properties of the private endpoint connection resource. + internal partial class ManagedHsmPrivateEndpointConnectionProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedHsmPrivateEndpointConnectionProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(PrivateEndpoint)) + { + writer.WritePropertyName("privateEndpoint"u8); + writer.WriteObjectValue(PrivateEndpoint, options); + } + if (Optional.IsDefined(PrivateLinkServiceConnectionState)) + { + writer.WritePropertyName("privateLinkServiceConnectionState"u8); + writer.WriteObjectValue(PrivateLinkServiceConnectionState, options); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ManagedHsmPrivateEndpointConnectionProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ManagedHsmPrivateEndpointConnectionProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedHsmPrivateEndpointConnectionProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedHsmPrivateEndpointConnectionProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ManagedHsmPrivateEndpointConnectionProperties DeserializeManagedHsmPrivateEndpointConnectionProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ManagedHsmPrivateEndpoint privateEndpoint = default; + ManagedHsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState = default; + ManagedHsmPrivateEndpointConnectionProvisioningState? provisioningState = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("privateEndpoint"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + privateEndpoint = ManagedHsmPrivateEndpoint.DeserializeManagedHsmPrivateEndpoint(prop.Value, options); + continue; + } + if (prop.NameEquals("privateLinkServiceConnectionState"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + privateLinkServiceConnectionState = ManagedHsmPrivateLinkServiceConnectionState.DeserializeManagedHsmPrivateLinkServiceConnectionState(prop.Value, options); + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ManagedHsmPrivateEndpointConnectionProvisioningState(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ManagedHsmPrivateEndpointConnectionProperties(privateEndpoint, privateLinkServiceConnectionState, provisioningState, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerKeyVaultContext.Default); + default: + throw new FormatException($"The model {nameof(ManagedHsmPrivateEndpointConnectionProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ManagedHsmPrivateEndpointConnectionProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ManagedHsmPrivateEndpointConnectionProperties 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)) + { + return DeserializeManagedHsmPrivateEndpointConnectionProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedHsmPrivateEndpointConnectionProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpointConnectionProperties.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpointConnectionProperties.cs new file mode 100644 index 000000000000..0ecc412988e8 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpointConnectionProperties.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; + +namespace Azure.ResourceManager.KeyVault.Models +{ + /// Properties of the private endpoint connection resource. + internal partial class ManagedHsmPrivateEndpointConnectionProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ManagedHsmPrivateEndpointConnectionProperties() + { + } + + /// Initializes a new instance of . + /// Properties of the private endpoint object. + /// Approval state of the private link connection. + /// Provisioning state of the private endpoint connection. + /// Keeps track of any properties unknown to the library. + internal ManagedHsmPrivateEndpointConnectionProperties(ManagedHsmPrivateEndpoint privateEndpoint, ManagedHsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState, ManagedHsmPrivateEndpointConnectionProvisioningState? provisioningState, IDictionary additionalBinaryDataProperties) + { + PrivateEndpoint = privateEndpoint; + PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + ProvisioningState = provisioningState; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Properties of the private endpoint object. + [WirePath("privateEndpoint")] + internal ManagedHsmPrivateEndpoint PrivateEndpoint { get; set; } + + /// Approval state of the private link connection. + [WirePath("privateLinkServiceConnectionState")] + public ManagedHsmPrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get; set; } + + /// Provisioning state of the private endpoint connection. + [WirePath("provisioningState")] + public ManagedHsmPrivateEndpointConnectionProvisioningState? ProvisioningState { get; } + + /// Full identifier of the private endpoint resource. + [WirePath("privateEndpoint.id")] + public string PrivateEndpointId + { + get + { + return PrivateEndpoint is null ? default : PrivateEndpoint.Id; + } + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpointConnectionProvisioningState.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpointConnectionProvisioningState.cs index cc882796738a..04fcd8857ed5 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpointConnectionProvisioningState.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpointConnectionProvisioningState.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { @@ -14,14 +15,6 @@ namespace Azure.ResourceManager.KeyVault.Models public readonly partial struct ManagedHsmPrivateEndpointConnectionProvisioningState : IEquatable { private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ManagedHsmPrivateEndpointConnectionProvisioningState(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - private const string SucceededValue = "Succeeded"; private const string CreatingValue = "Creating"; private const string UpdatingValue = "Updating"; @@ -29,35 +22,64 @@ public ManagedHsmPrivateEndpointConnectionProvisioningState(string value) private const string FailedValue = "Failed"; private const string DisconnectedValue = "Disconnected"; - /// Succeeded. + /// Initializes a new instance of . + /// The value. + /// is null. + public ManagedHsmPrivateEndpointConnectionProvisioningState(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Gets the Succeeded. public static ManagedHsmPrivateEndpointConnectionProvisioningState Succeeded { get; } = new ManagedHsmPrivateEndpointConnectionProvisioningState(SucceededValue); - /// Creating. + + /// Gets the Creating. public static ManagedHsmPrivateEndpointConnectionProvisioningState Creating { get; } = new ManagedHsmPrivateEndpointConnectionProvisioningState(CreatingValue); - /// Updating. + + /// Gets the Updating. public static ManagedHsmPrivateEndpointConnectionProvisioningState Updating { get; } = new ManagedHsmPrivateEndpointConnectionProvisioningState(UpdatingValue); - /// Deleting. + + /// Gets the Deleting. public static ManagedHsmPrivateEndpointConnectionProvisioningState Deleting { get; } = new ManagedHsmPrivateEndpointConnectionProvisioningState(DeletingValue); - /// Failed. + + /// Gets the Failed. public static ManagedHsmPrivateEndpointConnectionProvisioningState Failed { get; } = new ManagedHsmPrivateEndpointConnectionProvisioningState(FailedValue); - /// Disconnected. + + /// Gets the Disconnected. public static ManagedHsmPrivateEndpointConnectionProvisioningState Disconnected { get; } = new ManagedHsmPrivateEndpointConnectionProvisioningState(DisconnectedValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(ManagedHsmPrivateEndpointConnectionProvisioningState left, ManagedHsmPrivateEndpointConnectionProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(ManagedHsmPrivateEndpointConnectionProvisioningState left, ManagedHsmPrivateEndpointConnectionProvisioningState right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator ManagedHsmPrivateEndpointConnectionProvisioningState(string value) => new ManagedHsmPrivateEndpointConnectionProvisioningState(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator ManagedHsmPrivateEndpointConnectionProvisioningState?(string value) => value == null ? null : new ManagedHsmPrivateEndpointConnectionProvisioningState(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is ManagedHsmPrivateEndpointConnectionProvisioningState other && Equals(other); - /// + + /// public bool Equals(ManagedHsmPrivateEndpointConnectionProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpointConnectionsListResult.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpointConnectionsListResult.Serialization.cs deleted file mode 100644 index 2e28ed727ccf..000000000000 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpointConnectionsListResult.Serialization.cs +++ /dev/null @@ -1,208 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.KeyVault.Models -{ - internal partial class ManagedHsmPrivateEndpointConnectionsListResult : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ManagedHsmPrivateEndpointConnectionsListResult)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - if (Optional.IsDefined(NextLink)) - { - writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink.AbsoluteUri); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedHsmPrivateEndpointConnectionsListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ManagedHsmPrivateEndpointConnectionsListResult)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedHsmPrivateEndpointConnectionsListResult(document.RootElement, options); - } - - internal static ManagedHsmPrivateEndpointConnectionsListResult DeserializeManagedHsmPrivateEndpointConnectionsListResult(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList value = default; - Uri nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ManagedHsmPrivateEndpointConnectionData.DeserializeManagedHsmPrivateEndpointConnectionData(item, options)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - nextLink = new Uri(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ManagedHsmPrivateEndpointConnectionsListResult(value, nextLink, serializedAdditionalRawData); - } - - 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(Value), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" value: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Value)) - { - if (Value.Any()) - { - builder.Append(" value: "); - builder.AppendLine("["); - foreach (var item in Value) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nextLink: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NextLink)) - { - builder.Append(" nextLink: "); - builder.AppendLine($"'{NextLink.AbsoluteUri}'"); - } - } - - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var 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(ManagedHsmPrivateEndpointConnectionsListResult)} does not support writing '{options.Format}' format."); - } - } - - ManagedHsmPrivateEndpointConnectionsListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeManagedHsmPrivateEndpointConnectionsListResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedHsmPrivateEndpointConnectionsListResult)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpointConnectionsListResult.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpointConnectionsListResult.cs deleted file mode 100644 index 57cc82bf526d..000000000000 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpointConnectionsListResult.cs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.ResourceManager.KeyVault.Models -{ - /// List of private endpoint connections associated with a managed HSM Pools. - internal partial class ManagedHsmPrivateEndpointConnectionsListResult - { - /// - /// 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; - - /// Initializes a new instance of . - /// The MhsmPrivateEndpointConnection items on this page. - /// is null. - internal ManagedHsmPrivateEndpointConnectionsListResult(IEnumerable value) - { - Argument.AssertNotNull(value, nameof(value)); - - Value = value.ToList(); - } - - /// Initializes a new instance of . - /// The MhsmPrivateEndpointConnection items on this page. - /// The link to the next page of items. - /// Keeps track of any properties unknown to the library. - internal ManagedHsmPrivateEndpointConnectionsListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) - { - Value = value; - NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ManagedHsmPrivateEndpointConnectionsListResult() - { - } - - /// The MhsmPrivateEndpointConnection items on this page. - public IReadOnlyList Value { get; } - /// The link to the next page of items. - public Uri NextLink { get; } - } -} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpointServiceConnectionStatus.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpointServiceConnectionStatus.cs index 418198cfda21..959ddcc85d6c 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpointServiceConnectionStatus.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateEndpointServiceConnectionStatus.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { @@ -14,44 +15,63 @@ namespace Azure.ResourceManager.KeyVault.Models public readonly partial struct ManagedHsmPrivateEndpointServiceConnectionStatus : IEquatable { private readonly string _value; + private const string PendingValue = "Pending"; + private const string ApprovedValue = "Approved"; + private const string RejectedValue = "Rejected"; + private const string DisconnectedValue = "Disconnected"; /// Initializes a new instance of . + /// The value. /// is null. public ManagedHsmPrivateEndpointServiceConnectionStatus(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string PendingValue = "Pending"; - private const string ApprovedValue = "Approved"; - private const string RejectedValue = "Rejected"; - private const string DisconnectedValue = "Disconnected"; + _value = value; + } - /// Pending. + /// Gets the Pending. public static ManagedHsmPrivateEndpointServiceConnectionStatus Pending { get; } = new ManagedHsmPrivateEndpointServiceConnectionStatus(PendingValue); - /// Approved. + + /// Gets the Approved. public static ManagedHsmPrivateEndpointServiceConnectionStatus Approved { get; } = new ManagedHsmPrivateEndpointServiceConnectionStatus(ApprovedValue); - /// Rejected. + + /// Gets the Rejected. public static ManagedHsmPrivateEndpointServiceConnectionStatus Rejected { get; } = new ManagedHsmPrivateEndpointServiceConnectionStatus(RejectedValue); - /// Disconnected. + + /// Gets the Disconnected. public static ManagedHsmPrivateEndpointServiceConnectionStatus Disconnected { get; } = new ManagedHsmPrivateEndpointServiceConnectionStatus(DisconnectedValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(ManagedHsmPrivateEndpointServiceConnectionStatus left, ManagedHsmPrivateEndpointServiceConnectionStatus right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(ManagedHsmPrivateEndpointServiceConnectionStatus left, ManagedHsmPrivateEndpointServiceConnectionStatus right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator ManagedHsmPrivateEndpointServiceConnectionStatus(string value) => new ManagedHsmPrivateEndpointServiceConnectionStatus(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator ManagedHsmPrivateEndpointServiceConnectionStatus?(string value) => value == null ? null : new ManagedHsmPrivateEndpointServiceConnectionStatus(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is ManagedHsmPrivateEndpointServiceConnectionStatus other && Equals(other); - /// + + /// public bool Equals(ManagedHsmPrivateEndpointServiceConnectionStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateLinkResourceData.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateLinkResourceData.Serialization.cs index 22224bebf50c..5c27ac2cbe61 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateLinkResourceData.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateLinkResourceData.Serialization.cs @@ -8,18 +8,24 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.KeyVault; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.KeyVault.Models { - public partial class ManagedHsmPrivateLinkResourceData : IUtf8JsonSerializable, IJsonModel + /// A private link resource. + public partial class ManagedHsmPrivateLinkResourceData : TrackedResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal ManagedHsmPrivateLinkResourceData() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -31,13 +37,17 @@ void IJsonModel.Write(Utf8JsonWriter writer, /// 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(ManagedHsmPrivateLinkResourceData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); @@ -46,469 +56,180 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri if (Optional.IsDefined(Identity)) { writer.WritePropertyName("identity"u8); - ((IJsonModel)Identity).Write(writer, ModelSerializationExtensions.WireV3Options); + ((IJsonModel)Identity).Write(writer, options); } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(GroupId)) - { - writer.WritePropertyName("groupId"u8); - writer.WriteStringValue(GroupId); - } - if (options.Format != "W" && Optional.IsCollectionDefined(RequiredMembers)) - { - writer.WritePropertyName("requiredMembers"u8); - writer.WriteStartArray(); - foreach (var item in RequiredMembers) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsCollectionDefined(RequiredZoneNames)) - { - writer.WritePropertyName("requiredZoneNames"u8); - writer.WriteStartArray(); - foreach (var item in RequiredZoneNames) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - writer.WriteEndObject(); } - ManagedHsmPrivateLinkResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ManagedHsmPrivateLinkResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (ManagedHsmPrivateLinkResourceData)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(ManagedHsmPrivateLinkResourceData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeManagedHsmPrivateLinkResourceData(document.RootElement, options); } - internal static ManagedHsmPrivateLinkResourceData DeserializeManagedHsmPrivateLinkResourceData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ManagedHsmPrivateLinkResourceData DeserializeManagedHsmPrivateLinkResourceData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - ManagedHsmSku sku = default; - ManagedServiceIdentity identity = default; - IDictionary tags = default; - AzureLocation location = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - string groupId = default; - IReadOnlyList requiredMembers = default; - IList requiredZoneNames = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + IDictionary tags = default; + AzureLocation location = default; + MhsmPrivateLinkResourceProperties properties = default; + ManagedHsmSku sku = default; + ManagedServiceIdentity identity = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("sku"u8)) + if (prop.NameEquals("id"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - sku = ManagedHsmSku.DeserializeManagedHsmSku(property.Value, options); + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("identity"u8)) + if (prop.NameEquals("systemData"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - identity = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireV3Options, AzureResourceManagerKeyVaultContext.Default); + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerKeyVaultContext.Default); continue; } - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) + foreach (var prop0 in prop.Value.EnumerateObject()) { - dictionary.Add(property0.Name, property0.Value.GetString()); + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } } tags = dictionary; continue; } - if (property.NameEquals("location"u8)) - { - location = new AzureLocation(property.Value.GetString()); - continue; - } - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("location"u8)) { - name = property.Value.GetString(); + location = new AzureLocation(prop.Value.GetString()); continue; } - if (property.NameEquals("type"u8)) + if (prop.NameEquals("properties"u8)) { - type = new ResourceType(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = MhsmPrivateLinkResourceProperties.DeserializeMhsmPrivateLinkResourceProperties(prop.Value, options); continue; } - if (property.NameEquals("systemData"u8)) + if (prop.NameEquals("sku"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); + sku = ManagedHsmSku.DeserializeManagedHsmSku(prop.Value, options); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("identity"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("groupId"u8)) - { - groupId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("requiredMembers"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - requiredMembers = array; - continue; - } - if (property0.NameEquals("requiredZoneNames"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - requiredZoneNames = array; - continue; - } - } + identity = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerKeyVaultContext.Default); 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 ManagedHsmPrivateLinkResourceData( id, name, - type, + resourceType, systemData, + additionalBinaryDataProperties, tags ?? new ChangeTrackingDictionary(), location, - groupId, - requiredMembers ?? new ChangeTrackingList(), - requiredZoneNames ?? new ChangeTrackingList(), + properties, sku, - identity, - serializedAdditionalRawData); + identity); } - 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(Location), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" location: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" location: "); - builder.AppendLine($"'{Location.ToString()}'"); - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Tags), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" tags: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Tags)) - { - if (Tags.Any()) - { - builder.Append(" tags: "); - builder.AppendLine("{"); - foreach (var item in Tags) - { - builder.Append($" '{item.Key}': "); - if (item.Value == null) - { - builder.Append("null"); - continue; - } - if (item.Value.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{item.Value}'''"); - } - else - { - builder.AppendLine($"'{item.Value}'"); - } - } - builder.AppendLine(" }"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Sku), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" sku: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Sku)) - { - builder.Append(" sku: "); - BicepSerializationHelpers.AppendChildObject(builder, Sku, options, 2, false, " sku: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Identity), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" identity: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Identity)) - { - builder.Append(" identity: "); - BicepSerializationHelpers.AppendChildObject(builder, Identity, options, 2, false, " identity: "); - } - } - - 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.Append(" properties:"); - builder.AppendLine(" {"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(GroupId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" groupId: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(GroupId)) - { - builder.Append(" groupId: "); - if (GroupId.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{GroupId}'''"); - } - else - { - builder.AppendLine($"'{GroupId}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RequiredMembers), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" requiredMembers: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(RequiredMembers)) - { - if (RequiredMembers.Any()) - { - builder.Append(" requiredMembers: "); - builder.AppendLine("["); - foreach (var item in RequiredMembers) - { - if (item == null) - { - builder.Append("null"); - continue; - } - if (item.Contains(Environment.NewLine)) - { - builder.AppendLine(" '''"); - builder.AppendLine($"{item}'''"); - } - else - { - builder.AppendLine($" '{item}'"); - } - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RequiredZoneNames), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" requiredZoneNames: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(RequiredZoneNames)) - { - if (RequiredZoneNames.Any()) - { - builder.Append(" requiredZoneNames: "); - builder.AppendLine("["); - foreach (var item in RequiredZoneNames) - { - if (item == null) - { - builder.Append("null"); - continue; - } - if (item.Contains(Environment.NewLine)) - { - builder.AppendLine(" '''"); - builder.AppendLine($"{item}'''"); - } - else - { - builder.AppendLine($" '{item}'"); - } - } - builder.AppendLine(" ]"); - } - } - } - - builder.AppendLine(" }"); - 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(ManagedHsmPrivateLinkResourceData)} does not support writing '{options.Format}' format."); } } - ManagedHsmPrivateLinkResourceData 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. + ManagedHsmPrivateLinkResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (ManagedHsmPrivateLinkResourceData)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 DeserializeManagedHsmPrivateLinkResourceData(document.RootElement, options); } default: @@ -516,6 +237,7 @@ ManagedHsmPrivateLinkResourceData IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateLinkResourceData.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateLinkResourceData.cs index dedb7a19193b..5d5a04e96194 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateLinkResourceData.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateLinkResourceData.cs @@ -8,6 +8,7 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.KeyVault; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.KeyVault.Models @@ -15,88 +16,84 @@ namespace Azure.ResourceManager.KeyVault.Models /// A private link resource. public partial class ManagedHsmPrivateLinkResourceData : TrackedResourceData { - /// - /// 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 . - /// The location. - public ManagedHsmPrivateLinkResourceData(AzureLocation location) : base(location) + /// The geo-location where the resource lives. + internal ManagedHsmPrivateLinkResourceData(AzureLocation location) : base(location) { - RequiredMembers = new ChangeTrackingList(); - RequiredZoneNames = new ChangeTrackingList(); } /// 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. + /// 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. + /// Resource tags. + /// The geo-location where the resource lives. + /// Resource properties. /// SKU details. /// Managed service identity (system assigned and/or user assigned identities). - /// Keeps track of any properties unknown to the library. - internal ManagedHsmPrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string groupId, IReadOnlyList requiredMembers, IList requiredZoneNames, ManagedHsmSku sku, ManagedServiceIdentity identity, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal ManagedHsmPrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, IDictionary tags, AzureLocation location, MhsmPrivateLinkResourceProperties properties, ManagedHsmSku sku, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) { - GroupId = groupId; - RequiredMembers = requiredMembers; - RequiredZoneNames = requiredZoneNames; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; Sku = sku; Identity = identity; - _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal ManagedHsmPrivateLinkResourceData() + /// Resource properties. + [WirePath("properties")] + internal MhsmPrivateLinkResourceProperties Properties { get; } + + /// SKU details. + [WirePath("sku")] + public ManagedHsmSku Sku { get; } + + /// Managed service identity (system assigned and/or user assigned identities). + [WirePath("identity")] + public ManagedServiceIdentity Identity { get; } + + /// The provisioned state of the resource. + [WirePath("properties.provisioningState")] + public ManagedHsmProvisioningState? ProvisioningState { + get + { + return Properties.ProvisioningState; + } } /// Group identifier of private link resource. [WirePath("properties.groupId")] - public string GroupId { get; } + public string GroupId + { + get + { + return Properties.GroupId; + } + } + /// Required member names of private link resource. [WirePath("properties.requiredMembers")] - public IReadOnlyList RequiredMembers { get; } + public IReadOnlyList RequiredMembers + { + get + { + return Properties.RequiredMembers; + } + } + /// Required DNS zone names of the the private link resource. [WirePath("properties.requiredZoneNames")] - public IList RequiredZoneNames { get; } - /// SKU details. - [WirePath("sku")] - public ManagedHsmSku Sku { get; set; } - /// Managed service identity (system assigned and/or user assigned identities). - [WirePath("identity")] - public ManagedServiceIdentity Identity { get; set; } + public IList RequiredZoneNames + { + get + { + return Properties.RequiredZoneNames; + } + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateLinkResourceListResult.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateLinkResourceListResult.Serialization.cs index 8c7506212bf9..f705b59134d4 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateLinkResourceListResult.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateLinkResourceListResult.Serialization.cs @@ -8,17 +8,17 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - internal partial class ManagedHsmPrivateLinkResourceListResult : IUtf8JsonSerializable, IJsonModel + /// A list of private link resources. + public partial class ManagedHsmPrivateLinkResourceListResult : 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(); @@ -30,31 +30,30 @@ void IJsonModel.Write(Utf8JsonWriter wr /// The client options for reading and writing models. protected virtual 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(ManagedHsmPrivateLinkResourceListResult)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) { writer.WritePropertyName("value"u8); writer.WriteStartArray(); - foreach (var item in Value) + foreach (ManagedHsmPrivateLinkResourceData item in Value) { writer.WriteObjectValue(item, options); } writer.WriteEndArray(); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -63,39 +62,43 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ManagedHsmPrivateLinkResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ManagedHsmPrivateLinkResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ManagedHsmPrivateLinkResourceListResult 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(ManagedHsmPrivateLinkResourceListResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeManagedHsmPrivateLinkResourceListResult(document.RootElement, options); } - internal static ManagedHsmPrivateLinkResourceListResult DeserializeManagedHsmPrivateLinkResourceListResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ManagedHsmPrivateLinkResourceListResult DeserializeManagedHsmPrivateLinkResourceListResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(ManagedHsmPrivateLinkResourceData.DeserializeManagedHsmPrivateLinkResourceData(item, options)); } @@ -104,75 +107,42 @@ internal static ManagedHsmPrivateLinkResourceListResult DeserializeManagedHsmPri } 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 ManagedHsmPrivateLinkResourceListResult(value ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new ManagedHsmPrivateLinkResourceListResult(value ?? new ChangeTrackingList(), additionalBinaryDataProperties); } - 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(Value), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" value: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Value)) - { - if (Value.Any()) - { - builder.Append(" value: "); - builder.AppendLine("["); - foreach (var item in Value) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); - } - builder.AppendLine(" ]"); - } - } - } - - 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(ManagedHsmPrivateLinkResourceListResult)} does not support writing '{options.Format}' format."); } } - ManagedHsmPrivateLinkResourceListResult 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. + ManagedHsmPrivateLinkResourceListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ManagedHsmPrivateLinkResourceListResult 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 DeserializeManagedHsmPrivateLinkResourceListResult(document.RootElement, options); } default: @@ -180,6 +150,15 @@ ManagedHsmPrivateLinkResourceListResult IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static ManagedHsmPrivateLinkResourceListResult FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeManagedHsmPrivateLinkResourceListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateLinkResourceListResult.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateLinkResourceListResult.cs index 8ddd6b762ad2..dae2962f2946 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateLinkResourceListResult.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateLinkResourceListResult.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// A list of private link resources. - internal partial class ManagedHsmPrivateLinkResourceListResult + public partial class ManagedHsmPrivateLinkResourceListResult { - /// - /// 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 ManagedHsmPrivateLinkResourceListResult() @@ -53,15 +25,15 @@ internal ManagedHsmPrivateLinkResourceListResult() /// Initializes a new instance of . /// Array of private link resources. - /// Keeps track of any properties unknown to the library. - internal ManagedHsmPrivateLinkResourceListResult(IReadOnlyList value, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal ManagedHsmPrivateLinkResourceListResult(IList value, IDictionary additionalBinaryDataProperties) { Value = value; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Array of private link resources. [WirePath("value")] - public IReadOnlyList Value { get; } + public IList Value { get; } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateLinkServiceConnectionState.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateLinkServiceConnectionState.Serialization.cs index 86b531515500..9bed79863b53 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateLinkServiceConnectionState.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateLinkServiceConnectionState.Serialization.cs @@ -8,16 +8,16 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class ManagedHsmPrivateLinkServiceConnectionState : IUtf8JsonSerializable, IJsonModel + /// An object that represents the approval state of the private link connection. + public partial class ManagedHsmPrivateLinkServiceConnectionState : 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(); @@ -29,12 +29,11 @@ void IJsonModel.Write(Utf8JsonWrite /// The client options for reading and writing models. protected virtual 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(ManagedHsmPrivateLinkServiceConnectionState)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Status)) { writer.WritePropertyName("status"u8); @@ -50,15 +49,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("actionsRequired"u8); writer.WriteStringValue(ActionsRequired.Value.ToString()); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -67,22 +66,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ManagedHsmPrivateLinkServiceConnectionState IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ManagedHsmPrivateLinkServiceConnectionState IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ManagedHsmPrivateLinkServiceConnectionState 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(ManagedHsmPrivateLinkServiceConnectionState)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeManagedHsmPrivateLinkServiceConnectionState(document.RootElement, options); } - internal static ManagedHsmPrivateLinkServiceConnectionState DeserializeManagedHsmPrivateLinkServiceConnectionState(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ManagedHsmPrivateLinkServiceConnectionState DeserializeManagedHsmPrivateLinkServiceConnectionState(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -90,134 +94,70 @@ internal static ManagedHsmPrivateLinkServiceConnectionState DeserializeManagedHs ManagedHsmPrivateEndpointServiceConnectionStatus? status = default; string description = default; ManagedHsmActionsRequiredMessage? actionsRequired = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("status"u8)) + if (prop.NameEquals("status"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - status = new ManagedHsmPrivateEndpointServiceConnectionStatus(property.Value.GetString()); + status = new ManagedHsmPrivateEndpointServiceConnectionStatus(prop.Value.GetString()); continue; } - if (property.NameEquals("description"u8)) + if (prop.NameEquals("description"u8)) { - description = property.Value.GetString(); + description = prop.Value.GetString(); continue; } - if (property.NameEquals("actionsRequired"u8)) + if (prop.NameEquals("actionsRequired"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - actionsRequired = new ManagedHsmActionsRequiredMessage(property.Value.GetString()); + actionsRequired = new ManagedHsmActionsRequiredMessage(prop.Value.GetString()); 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 ManagedHsmPrivateLinkServiceConnectionState(status, description, actionsRequired, serializedAdditionalRawData); + return new ManagedHsmPrivateLinkServiceConnectionState(status, description, actionsRequired, additionalBinaryDataProperties); } - 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(Status), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" status: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Status)) - { - builder.Append(" status: "); - builder.AppendLine($"'{Status.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Description), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" description: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Description)) - { - builder.Append(" description: "); - if (Description.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Description}'''"); - } - else - { - builder.AppendLine($"'{Description}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ActionsRequired), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" actionsRequired: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ActionsRequired)) - { - builder.Append(" actionsRequired: "); - builder.AppendLine($"'{ActionsRequired.Value.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(ManagedHsmPrivateLinkServiceConnectionState)} does not support writing '{options.Format}' format."); } } - ManagedHsmPrivateLinkServiceConnectionState 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. + ManagedHsmPrivateLinkServiceConnectionState IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ManagedHsmPrivateLinkServiceConnectionState 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 DeserializeManagedHsmPrivateLinkServiceConnectionState(document.RootElement, options); } default: @@ -225,6 +165,7 @@ ManagedHsmPrivateLinkServiceConnectionState IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateLinkServiceConnectionState.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateLinkServiceConnectionState.cs index 182b497d5e0d..2bad58161752 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateLinkServiceConnectionState.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPrivateLinkServiceConnectionState.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// An object that represents the approval state of the private link connection. public partial class ManagedHsmPrivateLinkServiceConnectionState { - /// - /// 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 . public ManagedHsmPrivateLinkServiceConnectionState() @@ -54,21 +26,23 @@ public ManagedHsmPrivateLinkServiceConnectionState() /// Indicates whether the connection has been approved, rejected or removed by the key vault owner. /// The reason for approval or rejection. /// A message indicating if changes on the service provider require any updates on the consumer. - /// Keeps track of any properties unknown to the library. - internal ManagedHsmPrivateLinkServiceConnectionState(ManagedHsmPrivateEndpointServiceConnectionStatus? status, string description, ManagedHsmActionsRequiredMessage? actionsRequired, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal ManagedHsmPrivateLinkServiceConnectionState(ManagedHsmPrivateEndpointServiceConnectionStatus? status, string description, ManagedHsmActionsRequiredMessage? actionsRequired, IDictionary additionalBinaryDataProperties) { Status = status; Description = description; ActionsRequired = actionsRequired; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Indicates whether the connection has been approved, rejected or removed by the key vault owner. [WirePath("status")] public ManagedHsmPrivateEndpointServiceConnectionStatus? Status { get; set; } + /// The reason for approval or rejection. [WirePath("description")] public string Description { get; set; } + /// A message indicating if changes on the service provider require any updates on the consumer. [WirePath("actionsRequired")] public ManagedHsmActionsRequiredMessage? ActionsRequired { get; set; } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmProperties.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmProperties.Serialization.cs index 1f2533c7aa39..6970a812eafc 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmProperties.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmProperties.Serialization.cs @@ -8,17 +8,16 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class ManagedHsmProperties : IUtf8JsonSerializable, IJsonModel + /// Properties of the managed HSM Pool. + public partial class ManagedHsmProperties : 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(); @@ -30,12 +29,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr /// The client options for reading and writing models. protected virtual 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(ManagedHsmProperties)} does not support writing '{format}' format."); } - if (Optional.IsDefined(TenantId)) { writer.WritePropertyName("tenantId"u8); @@ -45,8 +43,13 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("initialAdminObjectIds"u8); writer.WriteStartArray(); - foreach (var item in InitialAdminObjectIds) + foreach (string item in InitialAdminObjectIds) { + if (item == null) + { + writer.WriteNullValue(); + continue; + } writer.WriteStringValue(item); } writer.WriteEndArray(); @@ -95,7 +98,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("regions"u8); writer.WriteStartArray(); - foreach (var item in Regions) + foreach (ManagedHsmGeoReplicatedRegion item in Regions) { writer.WriteObjectValue(item, options); } @@ -105,7 +108,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("privateEndpointConnections"u8); writer.WriteStartArray(); - foreach (var item in PrivateEndpointConnections) + foreach (ManagedHsmPrivateEndpointConnectionItemData item in PrivateEndpointConnections) { writer.WriteObjectValue(item, options); } @@ -126,15 +129,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("securityDomainProperties"u8); writer.WriteObjectValue(SecurityDomainProperties, options); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -143,22 +146,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ManagedHsmProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ManagedHsmProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ManagedHsmProperties 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(ManagedHsmProperties)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeManagedHsmProperties(document.RootElement, options); } - internal static ManagedHsmProperties DeserializeManagedHsmProperties(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ManagedHsmProperties DeserializeManagedHsmProperties(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -172,168 +180,173 @@ internal static ManagedHsmProperties DeserializeManagedHsmProperties(JsonElement ManagedHsmCreateMode? createMode = default; string statusMessage = default; ManagedHsmProvisioningState? provisioningState = default; - ManagedHsmNetworkRuleSet networkAcls = default; + ManagedHsmNetworkRuleSet networkRuleSet = default; IList regions = default; IReadOnlyList privateEndpointConnections = default; ManagedHsmPublicNetworkAccess? publicNetworkAccess = default; - DateTimeOffset? scheduledPurgeDate = default; + DateTimeOffset? scheduledPurgeOn = default; ManagedHSMSecurityDomainProperties securityDomainProperties = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tenantId"u8)) + if (prop.NameEquals("tenantId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - tenantId = property.Value.GetGuid(); + tenantId = new Guid(prop.Value.GetString()); continue; } - if (property.NameEquals("initialAdminObjectIds"u8)) + if (prop.NameEquals("initialAdminObjectIds"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { - array.Add(item.GetString()); + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } } initialAdminObjectIds = array; continue; } - if (property.NameEquals("hsmUri"u8)) + if (prop.NameEquals("hsmUri"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - hsmUri = new Uri(property.Value.GetString()); + hsmUri = new Uri(prop.Value.GetString()); continue; } - if (property.NameEquals("enableSoftDelete"u8)) + if (prop.NameEquals("enableSoftDelete"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - enableSoftDelete = property.Value.GetBoolean(); + enableSoftDelete = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("softDeleteRetentionInDays"u8)) + if (prop.NameEquals("softDeleteRetentionInDays"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - softDeleteRetentionInDays = property.Value.GetInt32(); + softDeleteRetentionInDays = prop.Value.GetInt32(); continue; } - if (property.NameEquals("enablePurgeProtection"u8)) + if (prop.NameEquals("enablePurgeProtection"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - enablePurgeProtection = property.Value.GetBoolean(); + enablePurgeProtection = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("createMode"u8)) + if (prop.NameEquals("createMode"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - createMode = property.Value.GetString().ToManagedHsmCreateMode(); + createMode = prop.Value.GetString().ToManagedHsmCreateMode(); continue; } - if (property.NameEquals("statusMessage"u8)) + if (prop.NameEquals("statusMessage"u8)) { - statusMessage = property.Value.GetString(); + statusMessage = prop.Value.GetString(); continue; } - if (property.NameEquals("provisioningState"u8)) + if (prop.NameEquals("provisioningState"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - provisioningState = new ManagedHsmProvisioningState(property.Value.GetString()); + provisioningState = new ManagedHsmProvisioningState(prop.Value.GetString()); continue; } - if (property.NameEquals("networkAcls"u8)) + if (prop.NameEquals("networkAcls"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - networkAcls = ManagedHsmNetworkRuleSet.DeserializeManagedHsmNetworkRuleSet(property.Value, options); + networkRuleSet = ManagedHsmNetworkRuleSet.DeserializeManagedHsmNetworkRuleSet(prop.Value, options); continue; } - if (property.NameEquals("regions"u8)) + if (prop.NameEquals("regions"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(ManagedHsmGeoReplicatedRegion.DeserializeManagedHsmGeoReplicatedRegion(item, options)); } regions = array; continue; } - if (property.NameEquals("privateEndpointConnections"u8)) + if (prop.NameEquals("privateEndpointConnections"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(ManagedHsmPrivateEndpointConnectionItemData.DeserializeManagedHsmPrivateEndpointConnectionItemData(item, options)); } privateEndpointConnections = array; continue; } - if (property.NameEquals("publicNetworkAccess"u8)) + if (prop.NameEquals("publicNetworkAccess"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - publicNetworkAccess = new ManagedHsmPublicNetworkAccess(property.Value.GetString()); + publicNetworkAccess = new ManagedHsmPublicNetworkAccess(prop.Value.GetString()); continue; } - if (property.NameEquals("scheduledPurgeDate"u8)) + if (prop.NameEquals("scheduledPurgeDate"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - scheduledPurgeDate = property.Value.GetDateTimeOffset("O"); + scheduledPurgeOn = prop.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("securityDomainProperties"u8)) + if (prop.NameEquals("securityDomainProperties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - securityDomainProperties = ManagedHSMSecurityDomainProperties.DeserializeManagedHSMSecurityDomainProperties(property.Value, options); + securityDomainProperties = ManagedHSMSecurityDomainProperties.DeserializeManagedHSMSecurityDomainProperties(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 ManagedHsmProperties( tenantId, initialAdminObjectIds ?? new ChangeTrackingList(), @@ -344,327 +357,45 @@ internal static ManagedHsmProperties DeserializeManagedHsmProperties(JsonElement createMode, statusMessage, provisioningState, - networkAcls, + networkRuleSet, regions ?? new ChangeTrackingList(), privateEndpointConnections ?? new ChangeTrackingList(), publicNetworkAccess, - scheduledPurgeDate, + scheduledPurgeOn, securityDomainProperties, - serializedAdditionalRawData); + additionalBinaryDataProperties); } - 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(TenantId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" tenantId: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(TenantId)) - { - builder.Append(" tenantId: "); - builder.AppendLine($"'{TenantId.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(InitialAdminObjectIds), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" initialAdminObjectIds: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(InitialAdminObjectIds)) - { - if (InitialAdminObjectIds.Any()) - { - builder.Append(" initialAdminObjectIds: "); - builder.AppendLine("["); - foreach (var item in InitialAdminObjectIds) - { - if (item == null) - { - builder.Append("null"); - continue; - } - if (item.Contains(Environment.NewLine)) - { - builder.AppendLine(" '''"); - builder.AppendLine($"{item}'''"); - } - else - { - builder.AppendLine($" '{item}'"); - } - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(HsmUri), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" hsmUri: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(HsmUri)) - { - builder.Append(" hsmUri: "); - builder.AppendLine($"'{HsmUri.AbsoluteUri}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableSoftDelete), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enableSoftDelete: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(EnableSoftDelete)) - { - builder.Append(" enableSoftDelete: "); - var boolValue = EnableSoftDelete.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SoftDeleteRetentionInDays), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" softDeleteRetentionInDays: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(SoftDeleteRetentionInDays)) - { - builder.Append(" softDeleteRetentionInDays: "); - builder.AppendLine($"{SoftDeleteRetentionInDays.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnablePurgeProtection), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enablePurgeProtection: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(EnablePurgeProtection)) - { - builder.Append(" enablePurgeProtection: "); - var boolValue = EnablePurgeProtection.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CreateMode), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" createMode: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(CreateMode)) - { - builder.Append(" createMode: "); - builder.AppendLine($"'{CreateMode.Value.ToSerialString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StatusMessage), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" statusMessage: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(StatusMessage)) - { - builder.Append(" statusMessage: "); - if (StatusMessage.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{StatusMessage}'''"); - } - else - { - builder.AppendLine($"'{StatusMessage}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" provisioningState: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ProvisioningState)) - { - builder.Append(" provisioningState: "); - builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetworkRuleSet), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" networkAcls: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NetworkRuleSet)) - { - builder.Append(" networkAcls: "); - BicepSerializationHelpers.AppendChildObject(builder, NetworkRuleSet, options, 2, false, " networkAcls: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Regions), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" regions: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Regions)) - { - if (Regions.Any()) - { - builder.Append(" regions: "); - builder.AppendLine("["); - foreach (var item in Regions) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " regions: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PrivateEndpointConnections), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" privateEndpointConnections: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(PrivateEndpointConnections)) - { - if (PrivateEndpointConnections.Any()) - { - builder.Append(" privateEndpointConnections: "); - builder.AppendLine("["); - foreach (var item in PrivateEndpointConnections) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " privateEndpointConnections: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PublicNetworkAccess), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" publicNetworkAccess: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PublicNetworkAccess)) - { - builder.Append(" publicNetworkAccess: "); - builder.AppendLine($"'{PublicNetworkAccess.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ScheduledPurgeOn), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" scheduledPurgeDate: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ScheduledPurgeOn)) - { - builder.Append(" scheduledPurgeDate: "); - var formattedDateTimeString = TypeFormatters.ToString(ScheduledPurgeOn.Value, "o"); - builder.AppendLine($"'{formattedDateTimeString}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SecurityDomainProperties), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" securityDomainProperties: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(SecurityDomainProperties)) - { - builder.Append(" securityDomainProperties: "); - BicepSerializationHelpers.AppendChildObject(builder, SecurityDomainProperties, options, 2, false, " securityDomainProperties: "); - } - } - - 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(ManagedHsmProperties)} does not support writing '{options.Format}' format."); } } - ManagedHsmProperties 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. + ManagedHsmProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ManagedHsmProperties 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 DeserializeManagedHsmProperties(document.RootElement, options); } default: @@ -672,6 +403,7 @@ ManagedHsmProperties IPersistableModel.Create(BinaryData d } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmProperties.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmProperties.cs index a6d24a3777e6..a1f76472aa97 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmProperties.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmProperties.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// Properties of the managed HSM Pool. public partial class ManagedHsmProperties { - /// - /// 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 . public ManagedHsmProperties() @@ -69,8 +41,8 @@ public ManagedHsmProperties() /// Control permission to the managed HSM from public networks. /// The scheduled purge date in UTC. /// Managed HSM security domain properties. - /// Keeps track of any properties unknown to the library. - internal ManagedHsmProperties(Guid? tenantId, IList initialAdminObjectIds, Uri hsmUri, bool? enableSoftDelete, int? softDeleteRetentionInDays, bool? enablePurgeProtection, ManagedHsmCreateMode? createMode, string statusMessage, ManagedHsmProvisioningState? provisioningState, ManagedHsmNetworkRuleSet networkRuleSet, IList regions, IReadOnlyList privateEndpointConnections, ManagedHsmPublicNetworkAccess? publicNetworkAccess, DateTimeOffset? scheduledPurgeOn, ManagedHSMSecurityDomainProperties securityDomainProperties, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal ManagedHsmProperties(Guid? tenantId, IList initialAdminObjectIds, Uri hsmUri, bool? enableSoftDelete, int? softDeleteRetentionInDays, bool? enablePurgeProtection, ManagedHsmCreateMode? createMode, string statusMessage, ManagedHsmProvisioningState? provisioningState, ManagedHsmNetworkRuleSet networkRuleSet, IList regions, IReadOnlyList privateEndpointConnections, ManagedHsmPublicNetworkAccess? publicNetworkAccess, DateTimeOffset? scheduledPurgeOn, ManagedHSMSecurityDomainProperties securityDomainProperties, IDictionary additionalBinaryDataProperties) { TenantId = tenantId; InitialAdminObjectIds = initialAdminObjectIds; @@ -87,51 +59,65 @@ internal ManagedHsmProperties(Guid? tenantId, IList initialAdminObjectId PublicNetworkAccess = publicNetworkAccess; ScheduledPurgeOn = scheduledPurgeOn; SecurityDomainProperties = securityDomainProperties; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The Azure Active Directory tenant ID that should be used for authenticating requests to the managed HSM pool. [WirePath("tenantId")] public Guid? TenantId { get; set; } + /// Array of initial administrators object ids for this managed hsm pool. [WirePath("initialAdminObjectIds")] public IList InitialAdminObjectIds { get; } + /// The URI of the managed hsm pool for performing operations on keys. [WirePath("hsmUri")] public Uri HsmUri { get; } + /// Property to specify whether the 'soft delete' functionality is enabled for this managed HSM pool. Soft delete is enabled by default for all managed HSMs and is immutable. [WirePath("enableSoftDelete")] public bool? EnableSoftDelete { get; set; } + /// Soft deleted data retention days. When you delete an HSM or a key, it will remain recoverable for the configured retention period or for a default period of 90 days. It accepts values between 7 and 90. [WirePath("softDeleteRetentionInDays")] public int? SoftDeleteRetentionInDays { get; set; } + /// Property specifying whether protection against purge is enabled for this managed HSM pool. Setting this property to true activates protection against purge for this managed HSM pool and its content - only the Managed HSM service may initiate a hard, irrecoverable deletion. Enabling this functionality is irreversible. [WirePath("enablePurgeProtection")] public bool? EnablePurgeProtection { get; set; } + /// The create mode to indicate whether the resource is being created or is being recovered from a deleted resource. [WirePath("createMode")] public ManagedHsmCreateMode? CreateMode { get; set; } + /// Resource Status Message. [WirePath("statusMessage")] public string StatusMessage { get; } + /// Provisioning state. [WirePath("provisioningState")] public ManagedHsmProvisioningState? ProvisioningState { get; } + /// Rules governing the accessibility of the key vault from specific network locations. [WirePath("networkAcls")] public ManagedHsmNetworkRuleSet NetworkRuleSet { get; set; } + /// List of all regions associated with the managed hsm pool. [WirePath("regions")] public IList Regions { get; } + /// List of private endpoint connections associated with the managed hsm pool. [WirePath("privateEndpointConnections")] public IReadOnlyList PrivateEndpointConnections { get; } + /// Control permission to the managed HSM from public networks. [WirePath("publicNetworkAccess")] public ManagedHsmPublicNetworkAccess? PublicNetworkAccess { get; set; } + /// The scheduled purge date in UTC. [WirePath("scheduledPurgeDate")] public DateTimeOffset? ScheduledPurgeOn { get; } + /// Managed HSM security domain properties. [WirePath("securityDomainProperties")] public ManagedHSMSecurityDomainProperties SecurityDomainProperties { get; } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmProvisioningState.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmProvisioningState.cs index f92fa693b037..c5fda69db733 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmProvisioningState.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmProvisioningState.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { @@ -14,56 +15,87 @@ namespace Azure.ResourceManager.KeyVault.Models public readonly partial struct ManagedHsmProvisioningState : IEquatable { private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ManagedHsmProvisioningState(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - + /// The managed HSM Pool has been full provisioned. private const string SucceededValue = "Succeeded"; + /// The managed HSM Pool is currently being provisioned. private const string ProvisioningValue = "Provisioning"; + /// Provisioning of the managed HSM Pool has failed. private const string FailedValue = "Failed"; + /// The managed HSM Pool is currently being updated. private const string UpdatingValue = "Updating"; + /// The managed HSM Pool is currently being deleted. private const string DeletingValue = "Deleting"; + /// The managed HSM pool is ready for normal use. private const string ActivatedValue = "Activated"; + /// The managed HSM pool is waiting for a security domain restore action. private const string SecurityDomainRestoreValue = "SecurityDomainRestore"; + /// The managed HSM pool is being restored from full HSM backup. private const string RestoringValue = "Restoring"; + /// Initializes a new instance of . + /// The value. + /// is null. + public ManagedHsmProvisioningState(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + /// The managed HSM Pool has been full provisioned. public static ManagedHsmProvisioningState Succeeded { get; } = new ManagedHsmProvisioningState(SucceededValue); + /// The managed HSM Pool is currently being provisioned. public static ManagedHsmProvisioningState Provisioning { get; } = new ManagedHsmProvisioningState(ProvisioningValue); + /// Provisioning of the managed HSM Pool has failed. public static ManagedHsmProvisioningState Failed { get; } = new ManagedHsmProvisioningState(FailedValue); + /// The managed HSM Pool is currently being updated. public static ManagedHsmProvisioningState Updating { get; } = new ManagedHsmProvisioningState(UpdatingValue); + /// The managed HSM Pool is currently being deleted. public static ManagedHsmProvisioningState Deleting { get; } = new ManagedHsmProvisioningState(DeletingValue); + /// The managed HSM pool is ready for normal use. public static ManagedHsmProvisioningState Activated { get; } = new ManagedHsmProvisioningState(ActivatedValue); + /// The managed HSM pool is waiting for a security domain restore action. public static ManagedHsmProvisioningState SecurityDomainRestore { get; } = new ManagedHsmProvisioningState(SecurityDomainRestoreValue); + /// The managed HSM pool is being restored from full HSM backup. public static ManagedHsmProvisioningState Restoring { get; } = new ManagedHsmProvisioningState(RestoringValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(ManagedHsmProvisioningState left, ManagedHsmProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(ManagedHsmProvisioningState left, ManagedHsmProvisioningState right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator ManagedHsmProvisioningState(string value) => new ManagedHsmProvisioningState(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator ManagedHsmProvisioningState?(string value) => value == null ? null : new ManagedHsmProvisioningState(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is ManagedHsmProvisioningState other && Equals(other); - /// + + /// public bool Equals(ManagedHsmProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPublicNetworkAccess.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPublicNetworkAccess.cs index f0a5775b1ca2..15da54de6a54 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPublicNetworkAccess.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmPublicNetworkAccess.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { @@ -14,38 +15,55 @@ namespace Azure.ResourceManager.KeyVault.Models public readonly partial struct ManagedHsmPublicNetworkAccess : IEquatable { private readonly string _value; + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; /// Initializes a new instance of . + /// The value. /// is null. public ManagedHsmPublicNetworkAccess(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string EnabledValue = "Enabled"; - private const string DisabledValue = "Disabled"; + _value = value; + } - /// Enabled. + /// Gets the Enabled. public static ManagedHsmPublicNetworkAccess Enabled { get; } = new ManagedHsmPublicNetworkAccess(EnabledValue); - /// Disabled. + + /// Gets the Disabled. public static ManagedHsmPublicNetworkAccess Disabled { get; } = new ManagedHsmPublicNetworkAccess(DisabledValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(ManagedHsmPublicNetworkAccess left, ManagedHsmPublicNetworkAccess right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(ManagedHsmPublicNetworkAccess left, ManagedHsmPublicNetworkAccess right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator ManagedHsmPublicNetworkAccess(string value) => new ManagedHsmPublicNetworkAccess(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator ManagedHsmPublicNetworkAccess?(string value) => value == null ? null : new ManagedHsmPublicNetworkAccess(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is ManagedHsmPublicNetworkAccess other && Equals(other); - /// + + /// public bool Equals(ManagedHsmPublicNetworkAccess other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmRegionsListResult.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmRegionsListResult.Serialization.cs index 4ac58ede6b92..ef4468ecb71e 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmRegionsListResult.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmRegionsListResult.Serialization.cs @@ -8,17 +8,22 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - internal partial class ManagedHsmRegionsListResult : IUtf8JsonSerializable, IJsonModel + /// List of regions associated with a managed HSM Pools. + internal partial class ManagedHsmRegionsListResult : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal ManagedHsmRegionsListResult() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -30,15 +35,14 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR /// The client options for reading and writing models. protected virtual 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(ManagedHsmRegionsListResult)} does not support writing '{format}' format."); } - writer.WritePropertyName("value"u8); writer.WriteStartArray(); - foreach (var item in Value) + foreach (ManagedHsmGeoReplicatedRegion item in Value) { writer.WriteObjectValue(item, options); } @@ -48,15 +52,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("nextLink"u8); writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -65,137 +69,93 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ManagedHsmRegionsListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ManagedHsmRegionsListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ManagedHsmRegionsListResult 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(ManagedHsmRegionsListResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeManagedHsmRegionsListResult(document.RootElement, options); } - internal static ManagedHsmRegionsListResult DeserializeManagedHsmRegionsListResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ManagedHsmRegionsListResult DeserializeManagedHsmRegionsListResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; + IList value = default; Uri nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(ManagedHsmGeoReplicatedRegion.DeserializeManagedHsmGeoReplicatedRegion(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - nextLink = new Uri(property.Value.GetString()); + nextLink = new Uri(prop.Value.GetString()); 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 ManagedHsmRegionsListResult(value, nextLink, serializedAdditionalRawData); + return new ManagedHsmRegionsListResult(value, nextLink, additionalBinaryDataProperties); } - 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(Value), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" value: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Value)) - { - if (Value.Any()) - { - builder.Append(" value: "); - builder.AppendLine("["); - foreach (var item in Value) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nextLink: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NextLink)) - { - builder.Append(" nextLink: "); - builder.AppendLine($"'{NextLink.AbsoluteUri}'"); - } - } - - 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(ManagedHsmRegionsListResult)} does not support writing '{options.Format}' format."); } } - ManagedHsmRegionsListResult 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. + ManagedHsmRegionsListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ManagedHsmRegionsListResult 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 DeserializeManagedHsmRegionsListResult(document.RootElement, options); } default: @@ -203,6 +163,15 @@ ManagedHsmRegionsListResult IPersistableModel.Creat } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static ManagedHsmRegionsListResult FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeManagedHsmRegionsListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmRegionsListResult.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmRegionsListResult.cs index fd08c366459a..5b4801a68250 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmRegionsListResult.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmRegionsListResult.cs @@ -8,73 +8,40 @@ using System; using System.Collections.Generic; using System.Linq; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// List of regions associated with a managed HSM Pools. internal partial class ManagedHsmRegionsListResult { - /// - /// 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 . /// The MhsmGeoReplicatedRegion items on this page. - /// is null. internal ManagedHsmRegionsListResult(IEnumerable value) { - Argument.AssertNotNull(value, nameof(value)); - Value = value.ToList(); } /// Initializes a new instance of . /// The MhsmGeoReplicatedRegion items on this page. /// The link to the next page of items. - /// Keeps track of any properties unknown to the library. - internal ManagedHsmRegionsListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal ManagedHsmRegionsListResult(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ManagedHsmRegionsListResult() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The MhsmGeoReplicatedRegion items on this page. - public IReadOnlyList Value { get; } + [WirePath("value")] + public IList Value { get; } + /// The link to the next page of items. + [WirePath("nextLink")] public Uri NextLink { get; } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmServiceTagRule.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmServiceTagRule.Serialization.cs index 6f2277b25fa9..c3aec6df20bb 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmServiceTagRule.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmServiceTagRule.Serialization.cs @@ -8,16 +8,21 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class ManagedHsmServiceTagRule : IUtf8JsonSerializable, IJsonModel + /// A rule governing the accessibility of a managed hsm pool from a specific service tags. + public partial class ManagedHsmServiceTagRule : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal ManagedHsmServiceTagRule() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -29,23 +34,22 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead /// The client options for reading and writing models. protected virtual 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(ManagedHsmServiceTagRule)} does not support writing '{format}' format."); } - writer.WritePropertyName("tag"u8); writer.WriteStringValue(Tag); - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -54,107 +58,78 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ManagedHsmServiceTagRule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ManagedHsmServiceTagRule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ManagedHsmServiceTagRule 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(ManagedHsmServiceTagRule)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeManagedHsmServiceTagRule(document.RootElement, options); } - internal static ManagedHsmServiceTagRule DeserializeManagedHsmServiceTagRule(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ManagedHsmServiceTagRule DeserializeManagedHsmServiceTagRule(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } string tag = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tag"u8)) + if (prop.NameEquals("tag"u8)) { - tag = property.Value.GetString(); + tag = prop.Value.GetString(); 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 ManagedHsmServiceTagRule(tag, serializedAdditionalRawData); + return new ManagedHsmServiceTagRule(tag, additionalBinaryDataProperties); } - 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(Tag), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" tag: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Tag)) - { - builder.Append(" tag: "); - if (Tag.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Tag}'''"); - } - else - { - builder.AppendLine($"'{Tag}'"); - } - } - } - - 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(ManagedHsmServiceTagRule)} does not support writing '{options.Format}' format."); } } - ManagedHsmServiceTagRule 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. + ManagedHsmServiceTagRule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ManagedHsmServiceTagRule 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 DeserializeManagedHsmServiceTagRule(document.RootElement, options); } default: @@ -162,6 +137,7 @@ ManagedHsmServiceTagRule IPersistableModel.Create(Bina } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmServiceTagRule.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmServiceTagRule.cs index 1cb70087bc58..deba81d7cea3 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmServiceTagRule.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmServiceTagRule.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// A rule governing the accessibility of a managed hsm pool from a specific service tags. public partial class ManagedHsmServiceTagRule { - /// - /// 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 . /// Name of the service tag. @@ -57,16 +29,11 @@ public ManagedHsmServiceTagRule(string tag) /// Initializes a new instance of . /// Name of the service tag. - /// Keeps track of any properties unknown to the library. - internal ManagedHsmServiceTagRule(string tag, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal ManagedHsmServiceTagRule(string tag, IDictionary additionalBinaryDataProperties) { Tag = tag; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ManagedHsmServiceTagRule() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Name of the service tag. diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmSku.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmSku.Serialization.cs index 7ab4b30f086e..fdfe635a8e1e 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmSku.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmSku.Serialization.cs @@ -8,16 +8,21 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class ManagedHsmSku : IUtf8JsonSerializable, IJsonModel + /// SKU details. + public partial class ManagedHsmSku : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal ManagedHsmSku() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -29,25 +34,24 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOpt /// The client options for reading and writing models. protected virtual 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(ManagedHsmSku)} does not support writing '{format}' format."); } - writer.WritePropertyName("family"u8); writer.WriteStringValue(Family.ToString()); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name.ToSerialString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -56,114 +60,84 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ManagedHsmSku IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ManagedHsmSku IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ManagedHsmSku 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(ManagedHsmSku)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeManagedHsmSku(document.RootElement, options); } - internal static ManagedHsmSku DeserializeManagedHsmSku(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ManagedHsmSku DeserializeManagedHsmSku(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } ManagedHsmSkuFamily family = default; ManagedHsmSkuName name = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("family"u8)) + if (prop.NameEquals("family"u8)) { - family = new ManagedHsmSkuFamily(property.Value.GetString()); + family = new ManagedHsmSkuFamily(prop.Value.GetString()); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("name"u8)) { - name = property.Value.GetString().ToManagedHsmSkuName(); + name = prop.Value.GetString().ToManagedHsmSkuName(); 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 ManagedHsmSku(family, name, serializedAdditionalRawData); + return new ManagedHsmSku(family, name, additionalBinaryDataProperties); } - 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(Family), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" family: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" family: "); - builder.AppendLine($"'{Family.ToString()}'"); - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" name: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" name: "); - builder.AppendLine($"'{Name.ToSerialString()}'"); - } - - 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(ManagedHsmSku)} does not support writing '{options.Format}' format."); } } - ManagedHsmSku 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. + ManagedHsmSku IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ManagedHsmSku 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 DeserializeManagedHsmSku(document.RootElement, options); } default: @@ -171,6 +145,7 @@ ManagedHsmSku IPersistableModel.Create(BinaryData data, ModelRead } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmSku.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmSku.cs index 8022bdfb296e..3d70cde711d1 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmSku.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmSku.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// SKU details. public partial class ManagedHsmSku { - /// - /// 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 . /// SKU Family of the managed HSM Pool. @@ -57,22 +29,18 @@ public ManagedHsmSku(ManagedHsmSkuFamily family, ManagedHsmSkuName name) /// Initializes a new instance of . /// SKU Family of the managed HSM Pool. /// SKU of the managed HSM Pool. - /// Keeps track of any properties unknown to the library. - internal ManagedHsmSku(ManagedHsmSkuFamily family, ManagedHsmSkuName name, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal ManagedHsmSku(ManagedHsmSkuFamily family, ManagedHsmSkuName name, IDictionary additionalBinaryDataProperties) { Family = family; Name = name; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ManagedHsmSku() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// SKU Family of the managed HSM Pool. [WirePath("family")] public ManagedHsmSkuFamily Family { get; set; } + /// SKU of the managed HSM Pool. [WirePath("name")] public ManagedHsmSkuName Name { get; set; } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmSkuFamily.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmSkuFamily.cs index 4c28399cb60c..4b370220d3de 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmSkuFamily.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmSkuFamily.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { @@ -14,38 +15,55 @@ namespace Azure.ResourceManager.KeyVault.Models public readonly partial struct ManagedHsmSkuFamily : IEquatable { private readonly string _value; + private const string BValue = "B"; + private const string CValue = "C"; /// Initializes a new instance of . + /// The value. /// is null. public ManagedHsmSkuFamily(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string BValue = "B"; - private const string CValue = "C"; + _value = value; + } - /// B. + /// Gets the B. public static ManagedHsmSkuFamily B { get; } = new ManagedHsmSkuFamily(BValue); - /// C. + + /// Gets the C. public static ManagedHsmSkuFamily C { get; } = new ManagedHsmSkuFamily(CValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(ManagedHsmSkuFamily left, ManagedHsmSkuFamily right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(ManagedHsmSkuFamily left, ManagedHsmSkuFamily right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator ManagedHsmSkuFamily(string value) => new ManagedHsmSkuFamily(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator ManagedHsmSkuFamily?(string value) => value == null ? null : new ManagedHsmSkuFamily(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is ManagedHsmSkuFamily other && Equals(other); - /// + + /// public bool Equals(ManagedHsmSkuFamily other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmSkuName.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmSkuName.Serialization.cs index 634313f9f09c..10fa9f4ee038 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmSkuName.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmSkuName.Serialization.cs @@ -11,6 +11,7 @@ namespace Azure.ResourceManager.KeyVault.Models { internal static partial class ManagedHsmSkuNameExtensions { + /// The value to serialize. public static string ToSerialString(this ManagedHsmSkuName value) => value switch { ManagedHsmSkuName.StandardB1 => "Standard_B1", @@ -21,13 +22,29 @@ internal static partial class ManagedHsmSkuNameExtensions _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ManagedHsmSkuName value.") }; + /// The value to deserialize. public static ManagedHsmSkuName ToManagedHsmSkuName(this string value) { - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Standard_B1")) return ManagedHsmSkuName.StandardB1; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Custom_B32")) return ManagedHsmSkuName.CustomB32; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Custom_B6")) return ManagedHsmSkuName.CustomB6; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Custom_C42")) return ManagedHsmSkuName.CustomC42; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Custom_C10")) return ManagedHsmSkuName.CustomC10; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Standard_B1")) + { + return ManagedHsmSkuName.StandardB1; + } + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Custom_B32")) + { + return ManagedHsmSkuName.CustomB32; + } + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Custom_B6")) + { + return ManagedHsmSkuName.CustomB6; + } + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Custom_C42")) + { + return ManagedHsmSkuName.CustomC42; + } + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Custom_C10")) + { + return ManagedHsmSkuName.CustomC10; + } throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ManagedHsmSkuName value."); } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmSkuName.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmSkuName.cs index 01a23594aebf..efe21b2774e0 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmSkuName.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmSkuName.cs @@ -10,15 +10,15 @@ namespace Azure.ResourceManager.KeyVault.Models /// SKU of the managed HSM Pool. public enum ManagedHsmSkuName { - /// Standard_B1. + /// StandardB1. StandardB1, - /// Custom_B32. + /// CustomB32. CustomB32, - /// Custom_B6. + /// CustomB6. CustomB6, - /// Custom_C42. + /// CustomC42. CustomC42, - /// Custom_C10. + /// CustomC10. CustomC10 } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmVirtualNetworkRule.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmVirtualNetworkRule.Serialization.cs index 50b209808cb3..07363a034be1 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmVirtualNetworkRule.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmVirtualNetworkRule.Serialization.cs @@ -8,16 +8,22 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Text; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class ManagedHsmVirtualNetworkRule : IUtf8JsonSerializable, IJsonModel + /// A rule governing the accessibility of a managed hsm pool from a specific virtual network. + public partial class ManagedHsmVirtualNetworkRule : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal ManagedHsmVirtualNetworkRule() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -29,23 +35,22 @@ void IJsonModel.Write(Utf8JsonWriter writer, Model /// The client options for reading and writing models. protected virtual 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(ManagedHsmVirtualNetworkRule)} does not support writing '{format}' format."); } - writer.WritePropertyName("id"u8); - writer.WriteStringValue(SubnetId); - if (options.Format != "W" && _serializedAdditionalRawData != null) + writer.WriteStringValue(Id); + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -54,99 +59,78 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ManagedHsmVirtualNetworkRule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ManagedHsmVirtualNetworkRule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ManagedHsmVirtualNetworkRule 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(ManagedHsmVirtualNetworkRule)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeManagedHsmVirtualNetworkRule(document.RootElement, options); } - internal static ManagedHsmVirtualNetworkRule DeserializeManagedHsmVirtualNetworkRule(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ManagedHsmVirtualNetworkRule DeserializeManagedHsmVirtualNetworkRule(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } ResourceIdentifier id = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("id"u8)) + if (prop.NameEquals("id"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + id = new ResourceIdentifier(prop.Value.GetString()); 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 ManagedHsmVirtualNetworkRule(id, serializedAdditionalRawData); + return new ManagedHsmVirtualNetworkRule(id, additionalBinaryDataProperties); } - 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(SubnetId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" id: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(SubnetId)) - { - builder.Append(" id: "); - builder.AppendLine($"'{SubnetId.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(ManagedHsmVirtualNetworkRule)} does not support writing '{options.Format}' format."); } } - ManagedHsmVirtualNetworkRule 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. + ManagedHsmVirtualNetworkRule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ManagedHsmVirtualNetworkRule 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 DeserializeManagedHsmVirtualNetworkRule(document.RootElement, options); } default: @@ -154,6 +138,7 @@ ManagedHsmVirtualNetworkRule IPersistableModel.Cre } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmVirtualNetworkRule.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmVirtualNetworkRule.cs index 6957ee9e7083..c4d079bee177 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmVirtualNetworkRule.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmVirtualNetworkRule.cs @@ -8,70 +8,37 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// A rule governing the accessibility of a managed hsm pool from a specific virtual network. public partial class ManagedHsmVirtualNetworkRule { - /// - /// 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 . - /// Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. - /// is null. - public ManagedHsmVirtualNetworkRule(ResourceIdentifier subnetId) + /// Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + /// is null. + public ManagedHsmVirtualNetworkRule(ResourceIdentifier id) { - Argument.AssertNotNull(subnetId, nameof(subnetId)); + Argument.AssertNotNull(id, nameof(id)); - SubnetId = subnetId; + Id = id; } /// Initializes a new instance of . - /// Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. - /// Keeps track of any properties unknown to the library. - internal ManagedHsmVirtualNetworkRule(ResourceIdentifier subnetId, IDictionary serializedAdditionalRawData) - { - SubnetId = subnetId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ManagedHsmVirtualNetworkRule() + /// Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + /// Keeps track of any properties unknown to the library. + internal ManagedHsmVirtualNetworkRule(ResourceIdentifier id, IDictionary additionalBinaryDataProperties) { + Id = id; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. [WirePath("id")] - public ResourceIdentifier SubnetId { get; set; } + public ResourceIdentifier Id { get; set; } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmPrivateLinkResourceProperties.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmPrivateLinkResourceProperties.Serialization.cs new file mode 100644 index 000000000000..6aa9fcab777b --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmPrivateLinkResourceProperties.Serialization.cs @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.KeyVault; + +namespace Azure.ResourceManager.KeyVault.Models +{ + /// Properties of a private link resource. + internal partial class MhsmPrivateLinkResourceProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MhsmPrivateLinkResourceProperties)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(GroupId)) + { + writer.WritePropertyName("groupId"u8); + writer.WriteStringValue(GroupId); + } + if (options.Format != "W" && Optional.IsCollectionDefined(RequiredMembers)) + { + writer.WritePropertyName("requiredMembers"u8); + writer.WriteStartArray(); + foreach (string item in RequiredMembers) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(RequiredZoneNames)) + { + writer.WritePropertyName("requiredZoneNames"u8); + writer.WriteStartArray(); + foreach (string item in RequiredZoneNames) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + MhsmPrivateLinkResourceProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual MhsmPrivateLinkResourceProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MhsmPrivateLinkResourceProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMhsmPrivateLinkResourceProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static MhsmPrivateLinkResourceProperties DeserializeMhsmPrivateLinkResourceProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ManagedHsmProvisioningState? provisioningState = default; + string groupId = default; + IReadOnlyList requiredMembers = default; + IList requiredZoneNames = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("provisioningState"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ManagedHsmProvisioningState(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("groupId"u8)) + { + groupId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("requiredMembers"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + requiredMembers = array; + continue; + } + if (prop.NameEquals("requiredZoneNames"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + requiredZoneNames = array; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new MhsmPrivateLinkResourceProperties(provisioningState, groupId, requiredMembers ?? new ChangeTrackingList(), requiredZoneNames ?? new ChangeTrackingList(), additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerKeyVaultContext.Default); + default: + throw new FormatException($"The model {nameof(MhsmPrivateLinkResourceProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + MhsmPrivateLinkResourceProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual MhsmPrivateLinkResourceProperties 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)) + { + return DeserializeMhsmPrivateLinkResourceProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MhsmPrivateLinkResourceProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmPrivateLinkResourceProperties.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmPrivateLinkResourceProperties.cs new file mode 100644 index 000000000000..801ff9bc79a5 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmPrivateLinkResourceProperties.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; + +namespace Azure.ResourceManager.KeyVault.Models +{ + /// Properties of a private link resource. + internal partial class MhsmPrivateLinkResourceProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal MhsmPrivateLinkResourceProperties() + { + RequiredMembers = new ChangeTrackingList(); + RequiredZoneNames = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// 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. + /// Keeps track of any properties unknown to the library. + internal MhsmPrivateLinkResourceProperties(ManagedHsmProvisioningState? provisioningState, string groupId, IReadOnlyList requiredMembers, IList requiredZoneNames, IDictionary additionalBinaryDataProperties) + { + ProvisioningState = provisioningState; + GroupId = groupId; + RequiredMembers = requiredMembers; + RequiredZoneNames = requiredZoneNames; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The provisioned state of the resource. + [WirePath("provisioningState")] + public ManagedHsmProvisioningState? ProvisioningState { get; } + + /// Group identifier of private link resource. + [WirePath("groupId")] + public string GroupId { get; } + + /// Required member names of private link resource. + [WirePath("requiredMembers")] + public IReadOnlyList RequiredMembers { get; } = new ChangeTrackingList(); + + /// Required DNS zone names of the the private link resource. + [WirePath("requiredZoneNames")] + public IList RequiredZoneNames { get; } = new ChangeTrackingList(); + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/PrivateEndpoint.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/PrivateEndpoint.Serialization.cs new file mode 100644 index 000000000000..8f0a84a12cb6 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/PrivateEndpoint.Serialization.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.KeyVault; + +namespace Azure.ResourceManager.KeyVault.Models +{ + /// Private endpoint object properties. + internal partial class PrivateEndpoint : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PrivateEndpoint)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + PrivateEndpoint IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual PrivateEndpoint JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PrivateEndpoint)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePrivateEndpoint(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static PrivateEndpoint DeserializePrivateEndpoint(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("id"u8)) + { + id = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new PrivateEndpoint(id, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerKeyVaultContext.Default); + default: + throw new FormatException($"The model {nameof(PrivateEndpoint)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + PrivateEndpoint IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual PrivateEndpoint 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)) + { + return DeserializePrivateEndpoint(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PrivateEndpoint)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/PrivateEndpoint.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/PrivateEndpoint.cs new file mode 100644 index 000000000000..96f41cd3743d --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/PrivateEndpoint.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; + +namespace Azure.ResourceManager.KeyVault.Models +{ + /// Private endpoint object properties. + internal partial class PrivateEndpoint + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public PrivateEndpoint() + { + } + + /// Initializes a new instance of . + /// Full identifier of the private endpoint resource. + /// Keeps track of any properties unknown to the library. + internal PrivateEndpoint(string id, IDictionary additionalBinaryDataProperties) + { + Id = id; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Full identifier of the private endpoint resource. + [WirePath("id")] + public string Id { get; } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/PrivateEndpointConnectionProperties.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/PrivateEndpointConnectionProperties.Serialization.cs new file mode 100644 index 000000000000..b7626c940703 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/PrivateEndpointConnectionProperties.Serialization.cs @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.KeyVault; + +namespace Azure.ResourceManager.KeyVault.Models +{ + /// Properties of the private endpoint connection resource. + internal partial class PrivateEndpointConnectionProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PrivateEndpointConnectionProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(PrivateEndpoint)) + { + writer.WritePropertyName("privateEndpoint"u8); + writer.WriteObjectValue(PrivateEndpoint, options); + } + if (Optional.IsDefined(ConnectionState)) + { + writer.WritePropertyName("privateLinkServiceConnectionState"u8); + writer.WriteObjectValue(ConnectionState, options); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + PrivateEndpointConnectionProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual PrivateEndpointConnectionProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PrivateEndpointConnectionProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePrivateEndpointConnectionProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static PrivateEndpointConnectionProperties DeserializePrivateEndpointConnectionProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PrivateEndpoint privateEndpoint = default; + KeyVaultPrivateLinkServiceConnectionState connectionState = default; + KeyVaultPrivateEndpointConnectionProvisioningState? provisioningState = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("privateEndpoint"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + privateEndpoint = PrivateEndpoint.DeserializePrivateEndpoint(prop.Value, options); + continue; + } + if (prop.NameEquals("privateLinkServiceConnectionState"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + connectionState = KeyVaultPrivateLinkServiceConnectionState.DeserializeKeyVaultPrivateLinkServiceConnectionState(prop.Value, options); + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new KeyVaultPrivateEndpointConnectionProvisioningState(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new PrivateEndpointConnectionProperties(privateEndpoint, connectionState, provisioningState, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerKeyVaultContext.Default); + default: + throw new FormatException($"The model {nameof(PrivateEndpointConnectionProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + PrivateEndpointConnectionProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual PrivateEndpointConnectionProperties 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)) + { + return DeserializePrivateEndpointConnectionProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PrivateEndpointConnectionProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/PrivateEndpointConnectionProperties.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/PrivateEndpointConnectionProperties.cs new file mode 100644 index 000000000000..37e1f32092d1 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/PrivateEndpointConnectionProperties.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; + +namespace Azure.ResourceManager.KeyVault.Models +{ + /// Properties of the private endpoint connection resource. + internal partial class PrivateEndpointConnectionProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public PrivateEndpointConnectionProperties() + { + } + + /// Initializes a new instance of . + /// Properties of the private endpoint object. + /// Approval state of the private link connection. + /// Provisioning state of the private endpoint connection. + /// Keeps track of any properties unknown to the library. + internal PrivateEndpointConnectionProperties(PrivateEndpoint privateEndpoint, KeyVaultPrivateLinkServiceConnectionState connectionState, KeyVaultPrivateEndpointConnectionProvisioningState? provisioningState, IDictionary additionalBinaryDataProperties) + { + PrivateEndpoint = privateEndpoint; + ConnectionState = connectionState; + ProvisioningState = provisioningState; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Properties of the private endpoint object. + [WirePath("privateEndpoint")] + internal PrivateEndpoint PrivateEndpoint { get; set; } + + /// Approval state of the private link connection. + [WirePath("privateLinkServiceConnectionState")] + public KeyVaultPrivateLinkServiceConnectionState ConnectionState { get; set; } + + /// Provisioning state of the private endpoint connection. + [WirePath("provisioningState")] + public KeyVaultPrivateEndpointConnectionProvisioningState? ProvisioningState { get; } + + /// Full identifier of the private endpoint resource. + [WirePath("privateEndpoint.id")] + public string PrivateEndpointId + { + get + { + return PrivateEndpoint is null ? default : PrivateEndpoint.Id; + } + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretAttributes.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretAttributes.Serialization.cs index 9e395bd6b53e..5d2c1d8732f7 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretAttributes.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretAttributes.Serialization.cs @@ -8,16 +8,16 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class SecretAttributes : IUtf8JsonSerializable, IJsonModel + /// The secret management attributes. + public partial class SecretAttributes : SecretBaseAttributes, 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(); @@ -29,223 +29,136 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriter /// 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(SecretAttributes)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); } - SecretAttributes IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + SecretAttributes IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (SecretAttributes)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected override SecretBaseAttributes 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(SecretAttributes)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeSecretAttributes(document.RootElement, options); } - internal static SecretAttributes DeserializeSecretAttributes(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SecretAttributes DeserializeSecretAttributes(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } bool? enabled = default; - DateTimeOffset? nbf = default; - DateTimeOffset? exp = default; + DateTimeOffset? notBefore = default; + DateTimeOffset? expires = default; DateTimeOffset? created = default; DateTimeOffset? updated = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("enabled"u8)) + if (prop.NameEquals("enabled"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - enabled = property.Value.GetBoolean(); + enabled = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("nbf"u8)) + if (prop.NameEquals("nbf"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - nbf = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); + notBefore = DateTimeOffset.FromUnixTimeSeconds(prop.Value.GetInt64()); continue; } - if (property.NameEquals("exp"u8)) + if (prop.NameEquals("exp"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - exp = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); + expires = DateTimeOffset.FromUnixTimeSeconds(prop.Value.GetInt64()); continue; } - if (property.NameEquals("created"u8)) + if (prop.NameEquals("created"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - created = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); + created = DateTimeOffset.FromUnixTimeSeconds(prop.Value.GetInt64()); continue; } - if (property.NameEquals("updated"u8)) + if (prop.NameEquals("updated"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - updated = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); + updated = DateTimeOffset.FromUnixTimeSeconds(prop.Value.GetInt64()); 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 SecretAttributes( enabled, - nbf, - exp, + notBefore, + expires, created, updated, - serializedAdditionalRawData); + additionalBinaryDataProperties); } - 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(Enabled), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enabled: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Enabled)) - { - builder.Append(" enabled: "); - var boolValue = Enabled.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NotBefore), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nbf: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NotBefore)) - { - builder.Append(" nbf: "); - var formattedDateTimeString = TypeFormatters.ToString(NotBefore.Value, "o"); - builder.AppendLine($"'{formattedDateTimeString}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Expires), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" exp: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Expires)) - { - builder.Append(" exp: "); - var formattedDateTimeString = TypeFormatters.ToString(Expires.Value, "o"); - builder.AppendLine($"'{formattedDateTimeString}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Created), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" created: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Created)) - { - builder.Append(" created: "); - var formattedDateTimeString = TypeFormatters.ToString(Created.Value, "o"); - builder.AppendLine($"'{formattedDateTimeString}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Updated), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" updated: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Updated)) - { - builder.Append(" updated: "); - var formattedDateTimeString = TypeFormatters.ToString(Updated.Value, "o"); - builder.AppendLine($"'{formattedDateTimeString}'"); - } - } - - 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 override 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(SecretAttributes)} does not support writing '{options.Format}' format."); } } - SecretAttributes 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. + SecretAttributes IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (SecretAttributes)PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected override SecretBaseAttributes 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 DeserializeSecretAttributes(document.RootElement, options); } default: @@ -253,6 +166,7 @@ SecretAttributes IPersistableModel.Create(BinaryData data, Mod } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretAttributes.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretAttributes.cs index 3785b2fe23d5..a72a816163a2 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretAttributes.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretAttributes.cs @@ -24,8 +24,8 @@ public SecretAttributes() /// 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. - /// Keeps track of any properties unknown to the library. - internal SecretAttributes(bool? enabled, DateTimeOffset? notBefore, DateTimeOffset? expires, DateTimeOffset? created, DateTimeOffset? updated, IDictionary serializedAdditionalRawData) : base(enabled, notBefore, expires, created, updated, serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal SecretAttributes(bool? enabled, DateTimeOffset? notBefore, DateTimeOffset? expires, DateTimeOffset? created, DateTimeOffset? updated, IDictionary additionalBinaryDataProperties) : base(enabled, notBefore, expires, created, updated, additionalBinaryDataProperties) { } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretBaseAttributes.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretBaseAttributes.Serialization.cs index 239062f6dc9e..9434dd614761 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretBaseAttributes.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretBaseAttributes.Serialization.cs @@ -8,16 +8,16 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class SecretBaseAttributes : IUtf8JsonSerializable, IJsonModel + /// The object attributes managed by the KeyVault service. + public partial class SecretBaseAttributes : 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(); @@ -29,12 +29,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr /// The client options for reading and writing models. protected virtual 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(SecretBaseAttributes)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Enabled)) { writer.WritePropertyName("enabled"u8); @@ -60,15 +59,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("updated"u8); writer.WriteNumberValue(Updated.Value, "U"); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -77,214 +76,128 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - SecretBaseAttributes IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + SecretBaseAttributes IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SecretBaseAttributes 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(SecretBaseAttributes)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeSecretBaseAttributes(document.RootElement, options); } - internal static SecretBaseAttributes DeserializeSecretBaseAttributes(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SecretBaseAttributes DeserializeSecretBaseAttributes(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } bool? enabled = default; - DateTimeOffset? nbf = default; - DateTimeOffset? exp = default; + DateTimeOffset? notBefore = default; + DateTimeOffset? expires = default; DateTimeOffset? created = default; DateTimeOffset? updated = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("enabled"u8)) + if (prop.NameEquals("enabled"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - enabled = property.Value.GetBoolean(); + enabled = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("nbf"u8)) + if (prop.NameEquals("nbf"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - nbf = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); + notBefore = DateTimeOffset.FromUnixTimeSeconds(prop.Value.GetInt64()); continue; } - if (property.NameEquals("exp"u8)) + if (prop.NameEquals("exp"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - exp = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); + expires = DateTimeOffset.FromUnixTimeSeconds(prop.Value.GetInt64()); continue; } - if (property.NameEquals("created"u8)) + if (prop.NameEquals("created"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - created = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); + created = DateTimeOffset.FromUnixTimeSeconds(prop.Value.GetInt64()); continue; } - if (property.NameEquals("updated"u8)) + if (prop.NameEquals("updated"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - updated = DateTimeOffset.FromUnixTimeSeconds(property.Value.GetInt64()); + updated = DateTimeOffset.FromUnixTimeSeconds(prop.Value.GetInt64()); 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 SecretBaseAttributes( enabled, - nbf, - exp, + notBefore, + expires, created, updated, - serializedAdditionalRawData); + additionalBinaryDataProperties); } - 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(Enabled), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enabled: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Enabled)) - { - builder.Append(" enabled: "); - var boolValue = Enabled.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NotBefore), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nbf: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NotBefore)) - { - builder.Append(" nbf: "); - var formattedDateTimeString = TypeFormatters.ToString(NotBefore.Value, "o"); - builder.AppendLine($"'{formattedDateTimeString}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Expires), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" exp: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Expires)) - { - builder.Append(" exp: "); - var formattedDateTimeString = TypeFormatters.ToString(Expires.Value, "o"); - builder.AppendLine($"'{formattedDateTimeString}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Created), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" created: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Created)) - { - builder.Append(" created: "); - var formattedDateTimeString = TypeFormatters.ToString(Created.Value, "o"); - builder.AppendLine($"'{formattedDateTimeString}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Updated), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" updated: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Updated)) - { - builder.Append(" updated: "); - var formattedDateTimeString = TypeFormatters.ToString(Updated.Value, "o"); - builder.AppendLine($"'{formattedDateTimeString}'"); - } - } - - 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(SecretBaseAttributes)} does not support writing '{options.Format}' format."); } } - SecretBaseAttributes 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. + SecretBaseAttributes IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SecretBaseAttributes 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 DeserializeSecretBaseAttributes(document.RootElement, options); } default: @@ -292,6 +205,7 @@ SecretBaseAttributes IPersistableModel.Create(BinaryData d } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretBaseAttributes.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretBaseAttributes.cs index e5177d3ce5a6..a3f3affa18b6 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretBaseAttributes.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretBaseAttributes.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// The object attributes managed by the KeyVault service. public partial class SecretBaseAttributes { - /// - /// 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 protected IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . public SecretBaseAttributes() @@ -56,29 +28,33 @@ public SecretBaseAttributes() /// 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. - /// Keeps track of any properties unknown to the library. - internal SecretBaseAttributes(bool? enabled, DateTimeOffset? notBefore, DateTimeOffset? expires, DateTimeOffset? created, DateTimeOffset? updated, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal SecretBaseAttributes(bool? enabled, DateTimeOffset? notBefore, DateTimeOffset? expires, DateTimeOffset? created, DateTimeOffset? updated, IDictionary additionalBinaryDataProperties) { Enabled = enabled; NotBefore = notBefore; Expires = expires; Created = created; Updated = updated; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Determines whether the object is enabled. [WirePath("enabled")] public bool? Enabled { get; set; } + /// Not before date in seconds since 1970-01-01T00:00:00Z. [WirePath("nbf")] public DateTimeOffset? NotBefore { get; set; } + /// Expiry date in seconds since 1970-01-01T00:00:00Z. [WirePath("exp")] public DateTimeOffset? Expires { get; set; } + /// Creation time in seconds since 1970-01-01T00:00:00Z. [WirePath("created")] public DateTimeOffset? Created { get; } + /// Last updated time in seconds since 1970-01-01T00:00:00Z. [WirePath("updated")] public DateTimeOffset? Updated { get; } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretCreateOrUpdateParameters.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretCreateOrUpdateParameters.Serialization.cs new file mode 100644 index 000000000000..da0ac44050cf --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretCreateOrUpdateParameters.Serialization.cs @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.KeyVault; + +namespace Azure.ResourceManager.KeyVault.Models +{ + /// Parameters for creating or updating a secret. + public partial class SecretCreateOrUpdateParameters : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal SecretCreateOrUpdateParameters() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SecretCreateOrUpdateParameters)} does not support writing '{format}' format."); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + SecretCreateOrUpdateParameters IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SecretCreateOrUpdateParameters JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SecretCreateOrUpdateParameters)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSecretCreateOrUpdateParameters(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SecretCreateOrUpdateParameters DeserializeSecretCreateOrUpdateParameters(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary tags = default; + SecretProperties properties = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("tags"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + if (prop.NameEquals("properties"u8)) + { + properties = SecretProperties.DeserializeSecretProperties(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new SecretCreateOrUpdateParameters(tags ?? new ChangeTrackingDictionary(), properties, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerKeyVaultContext.Default); + default: + throw new FormatException($"The model {nameof(SecretCreateOrUpdateParameters)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + SecretCreateOrUpdateParameters IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SecretCreateOrUpdateParameters 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)) + { + return DeserializeSecretCreateOrUpdateParameters(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SecretCreateOrUpdateParameters)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(SecretCreateOrUpdateParameters secretCreateOrUpdateParameters) + { + if (secretCreateOrUpdateParameters == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(secretCreateOrUpdateParameters, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretCreateOrUpdateParameters.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretCreateOrUpdateParameters.cs new file mode 100644 index 000000000000..d0e9b7e94368 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretCreateOrUpdateParameters.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; + +namespace Azure.ResourceManager.KeyVault.Models +{ + /// Parameters for creating or updating a secret. + public partial class SecretCreateOrUpdateParameters + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// Properties of the secret. + /// is null. + public SecretCreateOrUpdateParameters(SecretProperties properties) + { + Argument.AssertNotNull(properties, nameof(properties)); + + Tags = new ChangeTrackingDictionary(); + Properties = properties; + } + + /// Initializes a new instance of . + /// The tags that will be assigned to the secret. + /// Properties of the secret. + /// Keeps track of any properties unknown to the library. + internal SecretCreateOrUpdateParameters(IDictionary tags, SecretProperties properties, IDictionary additionalBinaryDataProperties) + { + Tags = tags; + Properties = properties; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The tags that will be assigned to the secret. + [WirePath("tags")] + public IDictionary Tags { get; } + + /// Properties of the secret. + [WirePath("properties")] + public SecretProperties Properties { get; } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretListResult.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretListResult.Serialization.cs index be16103207b1..804956eea43b 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretListResult.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretListResult.Serialization.cs @@ -8,17 +8,22 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - internal partial class SecretListResult : IUtf8JsonSerializable, IJsonModel + /// The response of a Secret list operation. + internal partial class SecretListResult : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal SecretListResult() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -30,15 +35,14 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriter /// The client options for reading and writing models. protected virtual 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(SecretListResult)} does not support writing '{format}' format."); } - writer.WritePropertyName("value"u8); writer.WriteStartArray(); - foreach (var item in Value) + foreach (KeyVaultSecretData item in Value) { writer.WriteObjectValue(item, options); } @@ -48,15 +52,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("nextLink"u8); writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -65,137 +69,93 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - SecretListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + SecretListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SecretListResult 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(SecretListResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeSecretListResult(document.RootElement, options); } - internal static SecretListResult DeserializeSecretListResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SecretListResult DeserializeSecretListResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; + IList value = default; Uri nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(KeyVaultSecretData.DeserializeKeyVaultSecretData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - nextLink = new Uri(property.Value.GetString()); + nextLink = new Uri(prop.Value.GetString()); 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 SecretListResult(value, nextLink, serializedAdditionalRawData); + return new SecretListResult(value, nextLink, additionalBinaryDataProperties); } - 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(Value), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" value: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Value)) - { - if (Value.Any()) - { - builder.Append(" value: "); - builder.AppendLine("["); - foreach (var item in Value) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nextLink: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NextLink)) - { - builder.Append(" nextLink: "); - builder.AppendLine($"'{NextLink.AbsoluteUri}'"); - } - } - - 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(SecretListResult)} does not support writing '{options.Format}' format."); } } - SecretListResult 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. + SecretListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SecretListResult 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 DeserializeSecretListResult(document.RootElement, options); } default: @@ -203,6 +163,15 @@ SecretListResult IPersistableModel.Create(BinaryData data, Mod } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static SecretListResult FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeSecretListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretListResult.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretListResult.cs index cdeb4af0f893..4a625fa20e2a 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretListResult.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretListResult.cs @@ -8,73 +8,40 @@ using System; using System.Collections.Generic; using System.Linq; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// The response of a Secret list operation. internal partial class SecretListResult { - /// - /// 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 . /// The Secret items on this page. - /// is null. internal SecretListResult(IEnumerable value) { - Argument.AssertNotNull(value, nameof(value)); - Value = value.ToList(); } /// Initializes a new instance of . /// The Secret items on this page. /// The link to the next page of items. - /// Keeps track of any properties unknown to the library. - internal SecretListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal SecretListResult(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal SecretListResult() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The Secret items on this page. - public IReadOnlyList Value { get; } + [WirePath("value")] + public IList Value { get; } + /// The link to the next page of items. + [WirePath("nextLink")] public Uri NextLink { get; } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretPatchProperties.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretPatchProperties.Serialization.cs index 350a5865e3b9..2ae568d029d6 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretPatchProperties.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretPatchProperties.Serialization.cs @@ -9,14 +9,15 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class SecretPatchProperties : IUtf8JsonSerializable, IJsonModel + /// Properties of the secret. + public partial class SecretPatchProperties : 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(); @@ -28,12 +29,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW /// The client options for reading and writing models. protected virtual 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(SecretPatchProperties)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Value)) { writer.WritePropertyName("value"u8); @@ -49,15 +49,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("attributes"u8); writer.WriteObjectValue(Attributes, options); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -66,22 +66,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - SecretPatchProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + SecretPatchProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SecretPatchProperties 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(SecretPatchProperties)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeSecretPatchProperties(document.RootElement, options); } - internal static SecretPatchProperties DeserializeSecretPatchProperties(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SecretPatchProperties DeserializeSecretPatchProperties(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -89,42 +94,43 @@ internal static SecretPatchProperties DeserializeSecretPatchProperties(JsonEleme string value = default; string contentType = default; SecretAttributes attributes = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - value = property.Value.GetString(); + value = prop.Value.GetString(); continue; } - if (property.NameEquals("contentType"u8)) + if (prop.NameEquals("contentType"u8)) { - contentType = property.Value.GetString(); + contentType = prop.Value.GetString(); continue; } - if (property.NameEquals("attributes"u8)) + if (prop.NameEquals("attributes"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - attributes = SecretAttributes.DeserializeSecretAttributes(property.Value, options); + attributes = SecretAttributes.DeserializeSecretAttributes(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 SecretPatchProperties(value, contentType, attributes, serializedAdditionalRawData); + return new SecretPatchProperties(value, contentType, attributes, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -134,15 +140,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptio } } - SecretPatchProperties 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. + SecretPatchProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SecretPatchProperties 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 DeserializeSecretPatchProperties(document.RootElement, options); } default: @@ -150,6 +161,7 @@ SecretPatchProperties IPersistableModel.Create(BinaryData } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretPatchProperties.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretPatchProperties.cs index 361fb8f08a09..17b2366083e1 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretPatchProperties.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretPatchProperties.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// Properties of the secret. public partial class SecretPatchProperties { - /// - /// 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 . public SecretPatchProperties() @@ -54,21 +26,23 @@ public SecretPatchProperties() /// The value of the secret. /// The content type of the secret. /// The attributes of the secret. - /// Keeps track of any properties unknown to the library. - internal SecretPatchProperties(string value, string contentType, SecretAttributes attributes, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal SecretPatchProperties(string value, string contentType, SecretAttributes attributes, IDictionary additionalBinaryDataProperties) { Value = value; ContentType = contentType; Attributes = attributes; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The value of the secret. [WirePath("value")] public string Value { get; set; } + /// The content type of the secret. [WirePath("contentType")] public string ContentType { get; set; } + /// The attributes of the secret. [WirePath("attributes")] public SecretAttributes Attributes { get; set; } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretProperties.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretProperties.Serialization.cs index aa1b74f72f07..11c4630b8a0a 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretProperties.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretProperties.Serialization.cs @@ -8,16 +8,16 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - public partial class SecretProperties : IUtf8JsonSerializable, IJsonModel + /// Properties of the secret. + public partial class SecretProperties : 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(); @@ -29,12 +29,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriter /// The client options for reading and writing models. protected virtual 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(SecretProperties)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Value)) { writer.WritePropertyName("value"u8); @@ -60,15 +59,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("secretUriWithVersion"u8); writer.WriteStringValue(SecretUriWithVersion); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -77,22 +76,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - SecretProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + SecretProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SecretProperties 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(SecretProperties)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeSecretProperties(document.RootElement, options); } - internal static SecretProperties DeserializeSecretProperties(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SecretProperties DeserializeSecretProperties(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -102,196 +106,86 @@ internal static SecretProperties DeserializeSecretProperties(JsonElement element SecretAttributes attributes = default; Uri secretUri = default; string secretUriWithVersion = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - value = property.Value.GetString(); + value = prop.Value.GetString(); continue; } - if (property.NameEquals("contentType"u8)) + if (prop.NameEquals("contentType"u8)) { - contentType = property.Value.GetString(); + contentType = prop.Value.GetString(); continue; } - if (property.NameEquals("attributes"u8)) + if (prop.NameEquals("attributes"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - attributes = SecretAttributes.DeserializeSecretAttributes(property.Value, options); + attributes = SecretAttributes.DeserializeSecretAttributes(prop.Value, options); continue; } - if (property.NameEquals("secretUri"u8)) + if (prop.NameEquals("secretUri"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - secretUri = new Uri(property.Value.GetString()); + secretUri = new Uri(prop.Value.GetString()); continue; } - if (property.NameEquals("secretUriWithVersion"u8)) + if (prop.NameEquals("secretUriWithVersion"u8)) { - secretUriWithVersion = property.Value.GetString(); + secretUriWithVersion = prop.Value.GetString(); 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 SecretProperties( value, contentType, attributes, secretUri, secretUriWithVersion, - serializedAdditionalRawData); + additionalBinaryDataProperties); } - 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(Value), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" value: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Value)) - { - builder.Append(" value: "); - if (Value.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Value}'''"); - } - else - { - builder.AppendLine($"'{Value}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ContentType), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" contentType: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ContentType)) - { - builder.Append(" contentType: "); - if (ContentType.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{ContentType}'''"); - } - else - { - builder.AppendLine($"'{ContentType}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Attributes), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" attributes: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Attributes)) - { - builder.Append(" attributes: "); - BicepSerializationHelpers.AppendChildObject(builder, Attributes, options, 2, false, " attributes: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SecretUri), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" secretUri: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(SecretUri)) - { - builder.Append(" secretUri: "); - builder.AppendLine($"'{SecretUri.AbsoluteUri}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SecretUriWithVersion), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" secretUriWithVersion: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(SecretUriWithVersion)) - { - builder.Append(" secretUriWithVersion: "); - if (SecretUriWithVersion.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{SecretUriWithVersion}'''"); - } - else - { - builder.AppendLine($"'{SecretUriWithVersion}'"); - } - } - } - - 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(SecretProperties)} does not support writing '{options.Format}' format."); } } - SecretProperties 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. + SecretProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SecretProperties 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 DeserializeSecretProperties(document.RootElement, options); } default: @@ -299,6 +193,7 @@ SecretProperties IPersistableModel.Create(BinaryData data, Mod } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretProperties.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretProperties.cs index 80cb6da8487d..fe8a31a7db75 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretProperties.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/SecretProperties.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// Properties of the secret. public partial class SecretProperties { - /// - /// 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 . public SecretProperties() @@ -56,29 +28,33 @@ public SecretProperties() /// 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. - /// Keeps track of any properties unknown to the library. - internal SecretProperties(string value, string contentType, SecretAttributes attributes, Uri secretUri, string secretUriWithVersion, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal SecretProperties(string value, string contentType, SecretAttributes attributes, Uri secretUri, string secretUriWithVersion, IDictionary additionalBinaryDataProperties) { Value = value; ContentType = contentType; Attributes = attributes; SecretUri = secretUri; SecretUriWithVersion = secretUriWithVersion; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// 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. [WirePath("value")] public string Value { get; set; } + /// The content type of the secret. [WirePath("contentType")] public string ContentType { get; set; } + /// The attributes of the secret. [WirePath("attributes")] public SecretAttributes Attributes { get; set; } + /// The URI to retrieve the current version of the secret. [WirePath("secretUri")] public Uri SecretUri { get; } + /// The URI to retrieve the specific version of the secret. [WirePath("secretUriWithVersion")] public string SecretUriWithVersion { get; } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/VaultCreateOrUpdateParameters.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/VaultCreateOrUpdateParameters.Serialization.cs new file mode 100644 index 000000000000..8b6da24df757 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/VaultCreateOrUpdateParameters.Serialization.cs @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.KeyVault; + +namespace Azure.ResourceManager.KeyVault.Models +{ + /// Parameters for creating or updating a vault. + public partial class VaultCreateOrUpdateParameters : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal VaultCreateOrUpdateParameters() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VaultCreateOrUpdateParameters)} does not support writing '{format}' format."); + } + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + VaultCreateOrUpdateParameters IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual VaultCreateOrUpdateParameters JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VaultCreateOrUpdateParameters)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVaultCreateOrUpdateParameters(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static VaultCreateOrUpdateParameters DeserializeVaultCreateOrUpdateParameters(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AzureLocation location = default; + IDictionary tags = default; + KeyVaultProperties properties = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("location"u8)) + { + location = new AzureLocation(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("tags"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + if (prop.NameEquals("properties"u8)) + { + properties = KeyVaultProperties.DeserializeKeyVaultProperties(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new VaultCreateOrUpdateParameters(location, tags ?? new ChangeTrackingDictionary(), properties, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerKeyVaultContext.Default); + default: + throw new FormatException($"The model {nameof(VaultCreateOrUpdateParameters)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + VaultCreateOrUpdateParameters IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual VaultCreateOrUpdateParameters 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)) + { + return DeserializeVaultCreateOrUpdateParameters(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VaultCreateOrUpdateParameters)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(VaultCreateOrUpdateParameters vaultCreateOrUpdateParameters) + { + if (vaultCreateOrUpdateParameters == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(vaultCreateOrUpdateParameters, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/VaultCreateOrUpdateParameters.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/VaultCreateOrUpdateParameters.cs new file mode 100644 index 000000000000..953118b5c7fe --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/VaultCreateOrUpdateParameters.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.KeyVault; + +namespace Azure.ResourceManager.KeyVault.Models +{ + /// Parameters for creating or updating a vault. + public partial class VaultCreateOrUpdateParameters + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The supported Azure location where the key vault should be created. + /// Properties of the vault. + /// is null. + public VaultCreateOrUpdateParameters(AzureLocation location, KeyVaultProperties properties) + { + Argument.AssertNotNull(properties, nameof(properties)); + + Location = location; + Tags = new ChangeTrackingDictionary(); + Properties = properties; + } + + /// 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. + /// Keeps track of any properties unknown to the library. + internal VaultCreateOrUpdateParameters(AzureLocation location, IDictionary tags, KeyVaultProperties properties, IDictionary additionalBinaryDataProperties) + { + Location = location; + Tags = tags; + Properties = properties; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The supported Azure location where the key vault should be created. + [WirePath("location")] + public AzureLocation Location { get; } + + /// The tags that will be assigned to the key vault. + [WirePath("tags")] + public IDictionary Tags { get; } + + /// Properties of the vault. + [WirePath("properties")] + public KeyVaultProperties Properties { get; } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/VaultListResult.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/VaultListResult.Serialization.cs index 93dc6a9943ca..f6544e8b7e22 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/VaultListResult.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/VaultListResult.Serialization.cs @@ -8,17 +8,22 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { - internal partial class VaultListResult : IUtf8JsonSerializable, IJsonModel + /// The response of a Vault list operation. + internal partial class VaultListResult : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal VaultListResult() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -30,15 +35,14 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterO /// The client options for reading and writing models. protected virtual 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(VaultListResult)} does not support writing '{format}' format."); } - writer.WritePropertyName("value"u8); writer.WriteStartArray(); - foreach (var item in Value) + foreach (KeyVaultData item in Value) { writer.WriteObjectValue(item, options); } @@ -48,15 +52,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("nextLink"u8); writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -65,137 +69,93 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - VaultListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + VaultListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual VaultListResult 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(VaultListResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeVaultListResult(document.RootElement, options); } - internal static VaultListResult DeserializeVaultListResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static VaultListResult DeserializeVaultListResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; + IList value = default; Uri nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(KeyVaultData.DeserializeKeyVaultData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - nextLink = new Uri(property.Value.GetString()); + nextLink = new Uri(prop.Value.GetString()); 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 VaultListResult(value, nextLink, serializedAdditionalRawData); + return new VaultListResult(value, nextLink, additionalBinaryDataProperties); } - 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(Value), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" value: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Value)) - { - if (Value.Any()) - { - builder.Append(" value: "); - builder.AppendLine("["); - foreach (var item in Value) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nextLink: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NextLink)) - { - builder.Append(" nextLink: "); - builder.AppendLine($"'{NextLink.AbsoluteUri}'"); - } - } - - 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(VaultListResult)} does not support writing '{options.Format}' format."); } } - VaultListResult 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. + VaultListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual VaultListResult 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 DeserializeVaultListResult(document.RootElement, options); } default: @@ -203,6 +163,15 @@ VaultListResult IPersistableModel.Create(BinaryData data, Model } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static VaultListResult FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeVaultListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/VaultListResult.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/VaultListResult.cs index 835445ed56af..1bb7a32b88d0 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/VaultListResult.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/VaultListResult.cs @@ -8,73 +8,40 @@ using System; using System.Collections.Generic; using System.Linq; +using Azure.ResourceManager.KeyVault; namespace Azure.ResourceManager.KeyVault.Models { /// The response of a Vault list operation. internal partial class VaultListResult { - /// - /// 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 . /// The Vault items on this page. - /// is null. internal VaultListResult(IEnumerable value) { - Argument.AssertNotNull(value, nameof(value)); - Value = value.ToList(); } /// Initializes a new instance of . /// The Vault items on this page. /// The link to the next page of items. - /// Keeps track of any properties unknown to the library. - internal VaultListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal VaultListResult(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal VaultListResult() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The Vault items on this page. - public IReadOnlyList Value { get; } + [WirePath("value")] + public IList Value { get; } + /// The link to the next page of items. + [WirePath("nextLink")] public Uri NextLink { get; } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/PrivateEndpointConnectionsGetByResourceAsyncCollectionResultOfT.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/PrivateEndpointConnectionsGetByResourceAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..d3da649ca3e9 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/PrivateEndpointConnectionsGetByResourceAsyncCollectionResultOfT.cs @@ -0,0 +1,89 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.KeyVault.Models; + +namespace Azure.ResourceManager.KeyVault +{ + internal partial class PrivateEndpointConnectionsGetByResourceAsyncCollectionResultOfT : AsyncPageable + { + private readonly PrivateEndpointConnections _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _vaultName; + private readonly RequestContext _context; + + /// Initializes a new instance of PrivateEndpointConnectionsGetByResourceAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The PrivateEndpointConnections client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the vault. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public PrivateEndpointConnectionsGetByResourceAsyncCollectionResultOfT(PrivateEndpointConnections client, Guid subscriptionId, string resourceGroupName, string vaultName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _vaultName = vaultName; + _context = context; + } + + /// Gets the pages of PrivateEndpointConnectionsGetByResourceAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of PrivateEndpointConnectionsGetByResourceAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + KeyVaultPrivateEndpointConnectionListResult result = KeyVaultPrivateEndpointConnectionListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByResourceRequest(nextLink, _subscriptionId, _resourceGroupName, _vaultName, _context) : _client.CreateGetByResourceRequest(_subscriptionId, _resourceGroupName, _vaultName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/PrivateEndpointConnectionsGetByResourceCollectionResultOfT.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/PrivateEndpointConnectionsGetByResourceCollectionResultOfT.cs new file mode 100644 index 000000000000..3e374047025b --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/PrivateEndpointConnectionsGetByResourceCollectionResultOfT.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.KeyVault.Models; + +namespace Azure.ResourceManager.KeyVault +{ + internal partial class PrivateEndpointConnectionsGetByResourceCollectionResultOfT : Pageable + { + private readonly PrivateEndpointConnections _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _vaultName; + private readonly RequestContext _context; + + /// Initializes a new instance of PrivateEndpointConnectionsGetByResourceCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The PrivateEndpointConnections client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the vault. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public PrivateEndpointConnectionsGetByResourceCollectionResultOfT(PrivateEndpointConnections client, Guid subscriptionId, string resourceGroupName, string vaultName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _vaultName = vaultName; + _context = context; + } + + /// Gets the pages of PrivateEndpointConnectionsGetByResourceCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of PrivateEndpointConnectionsGetByResourceCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + KeyVaultPrivateEndpointConnectionListResult result = KeyVaultPrivateEndpointConnectionListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByResourceRequest(nextLink, _subscriptionId, _resourceGroupName, _vaultName, _context) : _client.CreateGetByResourceRequest(_subscriptionId, _resourceGroupName, _vaultName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("KeyVaultPrivateEndpointConnectionCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ProviderConstants.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ProviderConstants.cs index e5df245fc695..4acf5bc34629 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ProviderConstants.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ProviderConstants.cs @@ -9,8 +9,9 @@ namespace Azure.ResourceManager.KeyVault { - internal static class ProviderConstants + internal static partial class ProviderConstants { + /// Gets the DefaultProviderNamespace. public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/DeletedManagedHsmsRestOperations.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/DeletedManagedHsmsRestOperations.cs new file mode 100644 index 000000000000..0f5c05ebbb54 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/DeletedManagedHsmsRestOperations.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.KeyVault +{ + internal partial class DeletedManagedHsms + { + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of DeletedManagedHsms for mocking. + protected DeletedManagedHsms() + { + } + + /// Initializes a new instance of DeletedManagedHsms. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal DeletedManagedHsms(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) + { + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; + } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + internal HttpMessage CreateGetDeletedRequest(Guid subscriptionId, AzureLocation location, string name, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/providers/Microsoft.KeyVault/locations/", false); + uri.AppendPath(location.ToString(), true); + uri.AppendPath("/deletedManagedHSMs/", false); + uri.AppendPath(name, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreatePurgeDeletedRequest(Guid subscriptionId, AzureLocation location, string name, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/providers/Microsoft.KeyVault/locations/", false); + uri.AppendPath(location.ToString(), true); + uri.AppendPath("/deletedManagedHSMs/", false); + uri.AppendPath(name, true); + uri.AppendPath("/purge", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + return message; + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/DeletedVaultsRestOperations.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/DeletedVaultsRestOperations.cs new file mode 100644 index 000000000000..599375116bd0 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/DeletedVaultsRestOperations.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.KeyVault +{ + internal partial class DeletedVaults + { + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of DeletedVaults for mocking. + protected DeletedVaults() + { + } + + /// Initializes a new instance of DeletedVaults. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal DeletedVaults(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) + { + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; + } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + internal HttpMessage CreateGetDeletedRequest(Guid subscriptionId, AzureLocation location, string vaultName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/providers/Microsoft.KeyVault/locations/", false); + uri.AppendPath(location.ToString(), true); + uri.AppendPath("/deletedVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreatePurgeDeletedRequest(Guid subscriptionId, AzureLocation location, string vaultName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/providers/Microsoft.KeyVault/locations/", false); + uri.AppendPath(location.ToString(), true); + uri.AppendPath("/deletedVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendPath("/purge", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + return message; + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/ManagedHsmsOperationGroupRestOperations.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/ManagedHsmsOperationGroupRestOperations.cs new file mode 100644 index 000000000000..b06839755d8a --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/ManagedHsmsOperationGroupRestOperations.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.KeyVault +{ + internal partial class ManagedHsmsOperationGroup + { + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ManagedHsmsOperationGroup for mocking. + protected ManagedHsmsOperationGroup() + { + } + + /// Initializes a new instance of ManagedHsmsOperationGroup. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal ManagedHsmsOperationGroup(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) + { + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; + } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + internal HttpMessage CreateGetDeletedManagedHsmsRequest(Guid subscriptionId, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/providers/Microsoft.KeyVault/deletedManagedHSMs", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateNextGetDeletedManagedHsmsRequest(Uri nextPage, Guid subscriptionId, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCheckManagedHsmNameAvailabilityRequest(Guid subscriptionId, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/providers/Microsoft.KeyVault/checkMhsmNameAvailability", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/ManagedHsmsRestOperations.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/ManagedHsmsRestOperations.cs index 55c3e87e4554..a7da87d6d439 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/ManagedHsmsRestOperations.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/ManagedHsmsRestOperations.cs @@ -6,1162 +6,236 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.KeyVault.Models; namespace Azure.ResourceManager.KeyVault { - internal partial class ManagedHsmsRestOperations + internal partial class ManagedHsms { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of ManagedHsmsRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public ManagedHsmsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of ManagedHsms for mocking. + protected ManagedHsms() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-05-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateCheckManagedHsmNameAvailabilityRequestUri(string subscriptionId, ManagedHsmNameAvailabilityContent content) + /// Initializes a new instance of ManagedHsms. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal ManagedHsms(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.KeyVault/checkMhsmNameAvailability", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - internal HttpMessage CreateCheckManagedHsmNameAvailabilityRequest(string subscriptionId, ManagedHsmNameAvailabilityContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.KeyVault/checkMhsmNameAvailability", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); - return message; - } - - /// Checks that the managed hsm name is valid and is not already in use. - /// The ID of the target subscription. The value must be an UUID. - /// The request body. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> CheckManagedHsmNameAvailabilityAsync(string subscriptionId, ManagedHsmNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNull(content, nameof(content)); + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - using var message = CreateCheckManagedHsmNameAvailabilityRequest(subscriptionId, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ManagedHsmNameAvailabilityResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ManagedHsmNameAvailabilityResult.DeserializeManagedHsmNameAvailabilityResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } - /// Checks that the managed hsm name is valid and is not already in use. - /// The ID of the target subscription. The value must be an UUID. - /// The request body. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response CheckManagedHsmNameAvailability(string subscriptionId, ManagedHsmNameAvailabilityContent content, CancellationToken cancellationToken = default) + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string name, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateCheckManagedHsmNameAvailabilityRequest(subscriptionId, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ManagedHsmNameAvailabilityResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ManagedHsmNameAvailabilityResult.DeserializeManagedHsmNameAvailabilityResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListDeletedRequestUri(string subscriptionId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.KeyVault/deletedManagedHSMs", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListDeletedRequest(string subscriptionId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.KeyVault/deletedManagedHSMs", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.KeyVault/managedHSMs/", false); + uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// The List operation gets information about the deleted managed HSMs associated with the subscription. - /// The ID of the target subscription. The value must be an UUID. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListDeletedAsync(string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListDeletedRequest(subscriptionId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DeletedManagedHsmListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DeletedManagedHsmListResult.DeserializeDeletedManagedHsmListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// The List operation gets information about the deleted managed HSMs associated with the subscription. - /// The ID of the target subscription. The value must be an UUID. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response ListDeleted(string subscriptionId, CancellationToken cancellationToken = default) + internal HttpMessage CreateCreateOrUpdateRequest(Guid subscriptionId, string resourceGroupName, string name, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListDeletedRequest(subscriptionId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DeletedManagedHsmListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DeletedManagedHsmListResult.DeserializeDeletedManagedHsmListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetDeletedRequestUri(string subscriptionId, AzureLocation location, string name) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.KeyVault/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/deletedManagedHSMs/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetDeletedRequest(string subscriptionId, AzureLocation location, string name) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.KeyVault/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/deletedManagedHSMs/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.KeyVault/managedHSMs/", false); uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; return message; } - /// Gets the specified deleted managed HSM. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The name of the deleted managed HSM. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> GetDeletedAsync(string subscriptionId, AzureLocation location, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetDeletedRequest(subscriptionId, location, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DeletedManagedHsmData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DeletedManagedHsmData.DeserializeDeletedManagedHsmData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DeletedManagedHsmData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets the specified deleted managed HSM. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The name of the deleted managed HSM. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response GetDeleted(string subscriptionId, AzureLocation location, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetDeletedRequest(subscriptionId, location, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DeletedManagedHsmData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DeletedManagedHsmData.DeserializeDeletedManagedHsmData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DeletedManagedHsmData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreatePurgeDeletedRequestUri(string subscriptionId, AzureLocation location, string name) + internal HttpMessage CreateUpdateRequest(Guid subscriptionId, string resourceGroupName, string name, RequestContent content, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.KeyVault/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/deletedManagedHSMs/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.KeyVault/managedHSMs/", false); uri.AppendPath(name, true); - uri.AppendPath("/purge", false); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; } - internal HttpMessage CreatePurgeDeletedRequest(string subscriptionId, AzureLocation location, string name) + internal HttpMessage CreateDeleteRequest(Guid subscriptionId, string resourceGroupName, string name, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.KeyVault/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/deletedManagedHSMs/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.KeyVault/managedHSMs/", false); uri.AppendPath(name, true); - uri.AppendPath("/purge", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Delete; return message; } - /// Permanently deletes the specified managed HSM. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The name of the deleted managed HSM. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task PurgeDeletedAsync(string subscriptionId, AzureLocation location, string name, CancellationToken cancellationToken = default) + internal HttpMessage CreateGetByResourceGroupRequest(Guid subscriptionId, string resourceGroupName, int? top, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreatePurgeDeletedRequest(subscriptionId, location, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Permanently deletes the specified managed HSM. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The name of the deleted managed HSM. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response PurgeDeleted(string subscriptionId, AzureLocation location, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreatePurgeDeletedRequest(subscriptionId, location, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId, int? top) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.KeyVault/managedHSMs", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - return uri; - } - - internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, int? top) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.KeyVault/managedHSMs", false); uri.AppendQuery("api-version", _apiVersion, true); if (top != null) { - uri.AppendQuery("$top", top.Value, true); + uri.AppendQuery("$top", TypeFormatters.ConvertToString(top), true); } + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// The List operation gets information about the managed HSM Pools associated with the subscription. - /// The ID of the target subscription. The value must be an UUID. - /// Maximum number of results to return. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListBySubscriptionAsync(string subscriptionId, int? top = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionRequest(subscriptionId, top); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ManagedHsmListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ManagedHsmListResult.DeserializeManagedHsmListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// The List operation gets information about the managed HSM Pools associated with the subscription. - /// The ID of the target subscription. The value must be an UUID. - /// Maximum number of results to return. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response ListBySubscription(string subscriptionId, int? top = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionRequest(subscriptionId, top); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ManagedHsmListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ManagedHsmListResult.DeserializeManagedHsmListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName, int? top) + internal HttpMessage CreateNextGetByResourceGroupRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, int? top, RequestContext context) { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/managedHSMs", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - return uri; + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName, int? top) + internal HttpMessage CreateGetBySubscriptionRequest(Guid subscriptionId, int? top, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/providers/Microsoft.KeyVault/managedHSMs", false); uri.AppendQuery("api-version", _apiVersion, true); if (top != null) { - uri.AppendQuery("$top", top.Value, true); + uri.AppendQuery("$top", TypeFormatters.ConvertToString(top), true); } + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// The List operation gets information about the managed HSM Pools associated with the subscription and within the specified resource group. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Maximum number of results to return. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, int? top = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, top); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ManagedHsmListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ManagedHsmListResult.DeserializeManagedHsmListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// The List operation gets information about the managed HSM Pools associated with the subscription and within the specified resource group. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Maximum number of results to return. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, int? top = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, top); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ManagedHsmListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ManagedHsmListResult.DeserializeManagedHsmListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string name) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/managedHSMs/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string name) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/managedHSMs/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Gets the specified managed HSM Pool. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the managed HSM Pool. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetBySubscriptionRequest(Uri nextPage, Guid subscriptionId, int? top, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ManagedHsmData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ManagedHsmData.DeserializeManagedHsmData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 204: - case 404: - return Response.FromValue((ManagedHsmData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets the specified managed HSM Pool. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the managed HSM Pool. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ManagedHsmData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ManagedHsmData.DeserializeManagedHsmData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 204: - case 404: - return Response.FromValue((ManagedHsmData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string name, ManagedHsmData data) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/managedHSMs/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string name, ManagedHsmData data) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/managedHSMs/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Create or update a managed HSM Pool in the specified subscription. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the managed HSM Pool. - /// Parameters to create or update the managed HSM Pool. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string name, ManagedHsmData data, CancellationToken cancellationToken = default) + internal HttpMessage CreateGetPrivateLinkResourcesRequest(Guid subscriptionId, string resourceGroupName, string name, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, name, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create or update a managed HSM Pool in the specified subscription. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the managed HSM Pool. - /// Parameters to create or update the managed HSM Pool. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string name, ManagedHsmData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, name, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string name, ManagedHsmData data) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/managedHSMs/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string name, ManagedHsmData data) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.KeyVault/managedHSMs/", false); uri.AppendPath(name, true); + uri.AppendPath("/privateLinkResources", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Update a managed HSM Pool in the specified subscription. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the managed HSM Pool. - /// Parameters to patch the managed HSM Pool. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string name, ManagedHsmData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, name, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Update a managed HSM Pool in the specified subscription. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the managed HSM Pool. - /// Parameters to patch the managed HSM Pool. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string name, ManagedHsmData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, name, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string name) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/managedHSMs/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string name) + internal HttpMessage CreateGetRegionsRequest(Guid subscriptionId, string resourceGroupName, string name, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.KeyVault/managedHSMs/", false); uri.AppendPath(name, true); + uri.AppendPath("/regions", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Deletes the specified managed HSM Pool. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the managed HSM Pool. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Deletes the specified managed HSM Pool. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the managed HSM Pool. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListDeletedNextPageRequestUri(string nextLink, string subscriptionId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListDeletedNextPageRequest(string nextLink, string subscriptionId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Headers.SetValue("Accept", "application/json"); return message; } - /// The List operation gets information about the deleted managed HSMs associated with the subscription. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListDeletedNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListDeletedNextPageRequest(nextLink, subscriptionId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DeletedManagedHsmListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DeletedManagedHsmListResult.DeserializeDeletedManagedHsmListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// The List operation gets information about the deleted managed HSMs associated with the subscription. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response ListDeletedNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListDeletedNextPageRequest(nextLink, subscriptionId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DeletedManagedHsmListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DeletedManagedHsmListResult.DeserializeDeletedManagedHsmListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId, int? top) + internal HttpMessage CreateNextGetRegionsRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, string name, RequestContext context) { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId, int? top) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// The List operation gets information about the managed HSM Pools associated with the subscription. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// Maximum number of results to return. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, int? top = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, top); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ManagedHsmListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ManagedHsmListResult.DeserializeManagedHsmListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// The List operation gets information about the managed HSM Pools associated with the subscription. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// Maximum number of results to return. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, int? top = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, top); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ManagedHsmListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ManagedHsmListResult.DeserializeManagedHsmListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, int? top) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, int? top) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Headers.SetValue("Accept", "application/json"); return message; } - - /// The List operation gets information about the managed HSM Pools associated with the subscription and within the specified resource group. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Maximum number of results to return. - /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, int? top = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, top); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ManagedHsmListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ManagedHsmListResult.DeserializeManagedHsmListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// The List operation gets information about the managed HSM Pools associated with the subscription and within the specified resource group. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Maximum number of results to return. - /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, int? top = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, top); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ManagedHsmListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ManagedHsmListResult.DeserializeManagedHsmListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/MhsmPrivateEndpointConnectionsRestOperations.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/MhsmPrivateEndpointConnectionsRestOperations.cs index 6d97ac6f21f7..02ec1c2b8d84 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/MhsmPrivateEndpointConnectionsRestOperations.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/MhsmPrivateEndpointConnectionsRestOperations.cs @@ -6,155 +6,47 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.KeyVault.Models; namespace Azure.ResourceManager.KeyVault { - internal partial class MhsmPrivateEndpointConnectionsRestOperations + internal partial class MhsmPrivateEndpointConnections { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of MhsmPrivateEndpointConnectionsRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public MhsmPrivateEndpointConnectionsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of MhsmPrivateEndpointConnections for mocking. + protected MhsmPrivateEndpointConnections() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-05-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListByResourceRequestUri(string subscriptionId, string resourceGroupName, string name) + /// Initializes a new instance of MhsmPrivateEndpointConnections. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal MhsmPrivateEndpointConnections(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/managedHSMs/", false); - uri.AppendPath(name, true); - uri.AppendPath("/privateEndpointConnections", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - internal HttpMessage CreateListByResourceRequest(string subscriptionId, string resourceGroupName, string name) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/managedHSMs/", false); - uri.AppendPath(name, true); - uri.AppendPath("/privateEndpointConnections", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// The List operation gets information about the private endpoint connections associated with the managed HSM Pool. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the managed HSM Pool. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceAsync(string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - using var message = CreateListByResourceRequest(subscriptionId, resourceGroupName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ManagedHsmPrivateEndpointConnectionsListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ManagedHsmPrivateEndpointConnectionsListResult.DeserializeManagedHsmPrivateEndpointConnectionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } - /// The List operation gets information about the private endpoint connections associated with the managed HSM Pool. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the managed HSM Pool. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListByResource(string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default) + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string name, string privateEndpointConnectionName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateListByResourceRequest(subscriptionId, resourceGroupName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ManagedHsmPrivateEndpointConnectionsListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ManagedHsmPrivateEndpointConnectionsListResult.DeserializeManagedHsmPrivateEndpointConnectionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string name, string privateEndpointConnectionName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/managedHSMs/", false); - uri.AppendPath(name, true); - uri.AppendPath("/privateEndpointConnections/", false); - uri.AppendPath(privateEndpointConnectionName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string name, string privateEndpointConnectionName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.KeyVault/managedHSMs/", false); @@ -162,103 +54,20 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath("/privateEndpointConnections/", false); uri.AppendPath(privateEndpointConnectionName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Gets the specified private endpoint connection associated with the managed HSM Pool. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the managed HSM Pool. - /// Name of the private endpoint connection associated with the managed hsm pool. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string name, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + internal HttpMessage CreatePutRequest(Guid subscriptionId, string resourceGroupName, string name, string privateEndpointConnectionName, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, name, privateEndpointConnectionName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ManagedHsmPrivateEndpointConnectionData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ManagedHsmPrivateEndpointConnectionData.DeserializeManagedHsmPrivateEndpointConnectionData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((ManagedHsmPrivateEndpointConnectionData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets the specified private endpoint connection associated with the managed HSM Pool. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the managed HSM Pool. - /// Name of the private endpoint connection associated with the managed hsm pool. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string name, string privateEndpointConnectionName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, name, privateEndpointConnectionName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ManagedHsmPrivateEndpointConnectionData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ManagedHsmPrivateEndpointConnectionData.DeserializeManagedHsmPrivateEndpointConnectionData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((ManagedHsmPrivateEndpointConnectionData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreatePutRequestUri(string subscriptionId, string resourceGroupName, string name, string privateEndpointConnectionName, ManagedHsmPrivateEndpointConnectionData data) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/managedHSMs/", false); - uri.AppendPath(name, true); - uri.AppendPath("/privateEndpointConnections/", false); - uri.AppendPath(privateEndpointConnectionName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreatePutRequest(string subscriptionId, string resourceGroupName, string name, string privateEndpointConnectionName, ManagedHsmPrivateEndpointConnectionData data) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.KeyVault/managedHSMs/", false); @@ -266,88 +75,22 @@ internal HttpMessage CreatePutRequest(string subscriptionId, string resourceGrou uri.AppendPath("/privateEndpointConnections/", false); uri.AppendPath(privateEndpointConnectionName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Updates the specified private endpoint connection associated with the managed hsm pool. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the managed HSM Pool. - /// Name of the private endpoint connection associated with the managed hsm pool. - /// The intended state of private endpoint connection. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> PutAsync(string subscriptionId, string resourceGroupName, string name, string privateEndpointConnectionName, ManagedHsmPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) + internal HttpMessage CreateDeleteRequest(Guid subscriptionId, string resourceGroupName, string name, string privateEndpointConnectionName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreatePutRequest(subscriptionId, resourceGroupName, name, privateEndpointConnectionName, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ManagedHsmPrivateEndpointConnectionData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ManagedHsmPrivateEndpointConnectionData.DeserializeManagedHsmPrivateEndpointConnectionData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Updates the specified private endpoint connection associated with the managed hsm pool. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the managed HSM Pool. - /// Name of the private endpoint connection associated with the managed hsm pool. - /// The intended state of private endpoint connection. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Put(string subscriptionId, string resourceGroupName, string name, string privateEndpointConnectionName, ManagedHsmPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreatePutRequest(subscriptionId, resourceGroupName, name, privateEndpointConnectionName, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ManagedHsmPrivateEndpointConnectionData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ManagedHsmPrivateEndpointConnectionData.DeserializeManagedHsmPrivateEndpointConnectionData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string name, string privateEndpointConnectionName) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.KeyVault/managedHSMs/", false); @@ -355,169 +98,44 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath("/privateEndpointConnections/", false); uri.AppendPath(privateEndpointConnectionName, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string name, string privateEndpointConnectionName) + internal HttpMessage CreateGetByResourceRequest(Guid subscriptionId, string resourceGroupName, string name, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.KeyVault/managedHSMs/", false); uri.AppendPath(name, true); - uri.AppendPath("/privateEndpointConnections/", false); - uri.AppendPath(privateEndpointConnectionName, true); + uri.AppendPath("/privateEndpointConnections", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Deletes the specified private endpoint connection associated with the managed hsm pool. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the managed HSM Pool. - /// Name of the private endpoint connection associated with the managed hsm pool. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string name, string privateEndpointConnectionName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, name, privateEndpointConnectionName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Deletes the specified private endpoint connection associated with the managed hsm pool. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the managed HSM Pool. - /// Name of the private endpoint connection associated with the managed hsm pool. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string name, string privateEndpointConnectionName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, name, privateEndpointConnectionName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByResourceNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string name) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListByResourceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string name) + internal HttpMessage CreateNextGetByResourceRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, string name, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - - /// The List operation gets information about the private endpoint connections associated with the managed HSM Pool. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the managed HSM Pool. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateListByResourceNextPageRequest(nextLink, subscriptionId, resourceGroupName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ManagedHsmPrivateEndpointConnectionsListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ManagedHsmPrivateEndpointConnectionsListResult.DeserializeManagedHsmPrivateEndpointConnectionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// The List operation gets information about the private endpoint connections associated with the managed HSM Pool. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the managed HSM Pool. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListByResourceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateListByResourceNextPageRequest(nextLink, subscriptionId, resourceGroupName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ManagedHsmPrivateEndpointConnectionsListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ManagedHsmPrivateEndpointConnectionsListResult.DeserializeManagedHsmPrivateEndpointConnectionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/MhsmPrivateLinkResourcesRestOperations.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/MhsmPrivateLinkResourcesRestOperations.cs deleted file mode 100644 index f9a752f325e6..000000000000 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/MhsmPrivateLinkResourcesRestOperations.cs +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.KeyVault.Models; - -namespace Azure.ResourceManager.KeyVault -{ - internal partial class MhsmPrivateLinkResourcesRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of MhsmPrivateLinkResourcesRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public MhsmPrivateLinkResourcesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-05-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListByManagedHsmResourceRequestUri(string subscriptionId, string resourceGroupName, string name) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/managedHSMs/", false); - uri.AppendPath(name, true); - uri.AppendPath("/privateLinkResources", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListByManagedHsmResourceRequest(string subscriptionId, string resourceGroupName, string name) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/managedHSMs/", false); - uri.AppendPath(name, true); - uri.AppendPath("/privateLinkResources", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Gets the private link resources supported for the managed hsm pool. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the managed HSM Pool. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByManagedHsmResourceAsync(string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateListByManagedHsmResourceRequest(subscriptionId, resourceGroupName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ManagedHsmPrivateLinkResourceListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ManagedHsmPrivateLinkResourceListResult.DeserializeManagedHsmPrivateLinkResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets the private link resources supported for the managed hsm pool. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the managed HSM Pool. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListByManagedHsmResource(string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateListByManagedHsmResourceRequest(subscriptionId, resourceGroupName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ManagedHsmPrivateLinkResourceListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ManagedHsmPrivateLinkResourceListResult.DeserializeManagedHsmPrivateLinkResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/MhsmRegionsRestOperations.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/MhsmRegionsRestOperations.cs deleted file mode 100644 index 1d4b5fb20c9c..000000000000 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/MhsmRegionsRestOperations.cs +++ /dev/null @@ -1,217 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.KeyVault.Models; - -namespace Azure.ResourceManager.KeyVault -{ - internal partial class MhsmRegionsRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of MhsmRegionsRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public MhsmRegionsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-05-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListByResourceRequestUri(string subscriptionId, string resourceGroupName, string name) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/managedHSMs/", false); - uri.AppendPath(name, true); - uri.AppendPath("/regions", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListByResourceRequest(string subscriptionId, string resourceGroupName, string name) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/managedHSMs/", false); - uri.AppendPath(name, true); - uri.AppendPath("/regions", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// The List operation gets information about the regions associated with the managed HSM Pool. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the managed HSM Pool. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceAsync(string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateListByResourceRequest(subscriptionId, resourceGroupName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ManagedHsmRegionsListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ManagedHsmRegionsListResult.DeserializeManagedHsmRegionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// The List operation gets information about the regions associated with the managed HSM Pool. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the managed HSM Pool. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListByResource(string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateListByResourceRequest(subscriptionId, resourceGroupName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ManagedHsmRegionsListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ManagedHsmRegionsListResult.DeserializeManagedHsmRegionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByResourceNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string name) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListByResourceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string name) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// The List operation gets information about the regions associated with the managed HSM Pool. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the managed HSM Pool. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateListByResourceNextPageRequest(nextLink, subscriptionId, resourceGroupName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ManagedHsmRegionsListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ManagedHsmRegionsListResult.DeserializeManagedHsmRegionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// The List operation gets information about the regions associated with the managed HSM Pool. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the managed HSM Pool. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListByResourceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateListByResourceNextPageRequest(nextLink, subscriptionId, resourceGroupName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ManagedHsmRegionsListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ManagedHsmRegionsListResult.DeserializeManagedHsmRegionsListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs index ee4c7eadba1b..220597038040 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs @@ -6,155 +6,47 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.KeyVault.Models; namespace Azure.ResourceManager.KeyVault { - internal partial class PrivateEndpointConnectionsRestOperations + internal partial class PrivateEndpointConnections { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of PrivateEndpointConnectionsRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public PrivateEndpointConnectionsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of PrivateEndpointConnections for mocking. + protected PrivateEndpointConnections() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-05-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListByResourceRequestUri(string subscriptionId, string resourceGroupName, string vaultName) + /// Initializes a new instance of PrivateEndpointConnections. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal PrivateEndpointConnections(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); - uri.AppendPath(vaultName, true); - uri.AppendPath("/privateEndpointConnections", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - internal HttpMessage CreateListByResourceRequest(string subscriptionId, string resourceGroupName, string vaultName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); - uri.AppendPath(vaultName, true); - uri.AppendPath("/privateEndpointConnections", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// The List operation gets information about the private endpoint connections associated with the vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the vault. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceAsync(string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - using var message = CreateListByResourceRequest(subscriptionId, resourceGroupName, vaultName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - KeyVaultPrivateEndpointConnectionListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = KeyVaultPrivateEndpointConnectionListResult.DeserializeKeyVaultPrivateEndpointConnectionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } - /// The List operation gets information about the private endpoint connections associated with the vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the vault. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListByResource(string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string vaultName, string privateEndpointConnectionName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - using var message = CreateListByResourceRequest(subscriptionId, resourceGroupName, vaultName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - KeyVaultPrivateEndpointConnectionListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = KeyVaultPrivateEndpointConnectionListResult.DeserializeKeyVaultPrivateEndpointConnectionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string vaultName, string privateEndpointConnectionName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); - uri.AppendPath(vaultName, true); - uri.AppendPath("/privateEndpointConnections/", false); - uri.AppendPath(privateEndpointConnectionName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string vaultName, string privateEndpointConnectionName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); @@ -162,105 +54,20 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath("/privateEndpointConnections/", false); uri.AppendPath(privateEndpointConnectionName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Gets the specified private endpoint connection associated with the key vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the vault. - /// Name of the private endpoint connection associated with the key vault. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string vaultName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + internal HttpMessage CreatePutRequest(Guid subscriptionId, string resourceGroupName, string vaultName, string privateEndpointConnectionName, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, vaultName, privateEndpointConnectionName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - KeyVaultPrivateEndpointConnectionData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = KeyVaultPrivateEndpointConnectionData.DeserializeKeyVaultPrivateEndpointConnectionData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 204: - case 404: - return Response.FromValue((KeyVaultPrivateEndpointConnectionData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets the specified private endpoint connection associated with the key vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the vault. - /// Name of the private endpoint connection associated with the key vault. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string vaultName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, vaultName, privateEndpointConnectionName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - KeyVaultPrivateEndpointConnectionData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = KeyVaultPrivateEndpointConnectionData.DeserializeKeyVaultPrivateEndpointConnectionData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 204: - case 404: - return Response.FromValue((KeyVaultPrivateEndpointConnectionData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreatePutRequestUri(string subscriptionId, string resourceGroupName, string vaultName, string privateEndpointConnectionName, KeyVaultPrivateEndpointConnectionData data) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); - uri.AppendPath(vaultName, true); - uri.AppendPath("/privateEndpointConnections/", false); - uri.AppendPath(privateEndpointConnectionName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreatePutRequest(string subscriptionId, string resourceGroupName, string vaultName, string privateEndpointConnectionName, KeyVaultPrivateEndpointConnectionData data) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); @@ -268,88 +75,22 @@ internal HttpMessage CreatePutRequest(string subscriptionId, string resourceGrou uri.AppendPath("/privateEndpointConnections/", false); uri.AppendPath(privateEndpointConnectionName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Updates the specified private endpoint connection associated with the key vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the vault. - /// Name of the private endpoint connection associated with the key vault. - /// The intended state of private endpoint connection. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> PutAsync(string subscriptionId, string resourceGroupName, string vaultName, string privateEndpointConnectionName, KeyVaultPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) + internal HttpMessage CreateDeleteRequest(Guid subscriptionId, string resourceGroupName, string vaultName, string privateEndpointConnectionName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreatePutRequest(subscriptionId, resourceGroupName, vaultName, privateEndpointConnectionName, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - KeyVaultPrivateEndpointConnectionData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = KeyVaultPrivateEndpointConnectionData.DeserializeKeyVaultPrivateEndpointConnectionData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Updates the specified private endpoint connection associated with the key vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the vault. - /// Name of the private endpoint connection associated with the key vault. - /// The intended state of private endpoint connection. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Put(string subscriptionId, string resourceGroupName, string vaultName, string privateEndpointConnectionName, KeyVaultPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreatePutRequest(subscriptionId, resourceGroupName, vaultName, privateEndpointConnectionName, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - KeyVaultPrivateEndpointConnectionData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = KeyVaultPrivateEndpointConnectionData.DeserializeKeyVaultPrivateEndpointConnectionData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string vaultName, string privateEndpointConnectionName) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); @@ -357,169 +98,44 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath("/privateEndpointConnections/", false); uri.AppendPath(privateEndpointConnectionName, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string vaultName, string privateEndpointConnectionName) + internal HttpMessage CreateGetByResourceRequest(Guid subscriptionId, string resourceGroupName, string vaultName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); uri.AppendPath(vaultName, true); - uri.AppendPath("/privateEndpointConnections/", false); - uri.AppendPath(privateEndpointConnectionName, true); + uri.AppendPath("/privateEndpointConnections", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Deletes the specified private endpoint connection associated with the key vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the vault. - /// Name of the private endpoint connection associated with the key vault. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string vaultName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, vaultName, privateEndpointConnectionName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Deletes the specified private endpoint connection associated with the key vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the vault. - /// Name of the private endpoint connection associated with the key vault. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string vaultName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, vaultName, privateEndpointConnectionName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByResourceNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string vaultName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListByResourceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string vaultName) + internal HttpMessage CreateNextGetByResourceRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, string vaultName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - - /// The List operation gets information about the private endpoint connections associated with the vault. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the vault. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - using var message = CreateListByResourceNextPageRequest(nextLink, subscriptionId, resourceGroupName, vaultName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - KeyVaultPrivateEndpointConnectionListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = KeyVaultPrivateEndpointConnectionListResult.DeserializeKeyVaultPrivateEndpointConnectionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// The List operation gets information about the private endpoint connections associated with the vault. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the vault. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListByResourceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - using var message = CreateListByResourceNextPageRequest(nextLink, subscriptionId, resourceGroupName, vaultName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - KeyVaultPrivateEndpointConnectionListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = KeyVaultPrivateEndpointConnectionListResult.DeserializeKeyVaultPrivateEndpointConnectionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs deleted file mode 100644 index ee615086d290..000000000000 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.KeyVault.Models; - -namespace Azure.ResourceManager.KeyVault -{ - internal partial class PrivateLinkResourcesRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of PrivateLinkResourcesRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public PrivateLinkResourcesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-05-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListByVaultRequestUri(string subscriptionId, string resourceGroupName, string vaultName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); - uri.AppendPath(vaultName, true); - uri.AppendPath("/privateLinkResources", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListByVaultRequest(string subscriptionId, string resourceGroupName, string vaultName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); - uri.AppendPath(vaultName, true); - uri.AppendPath("/privateLinkResources", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Gets the private link resources supported for the key vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the vault. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByVaultAsync(string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - using var message = CreateListByVaultRequest(subscriptionId, resourceGroupName, vaultName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - KeyVaultPrivateLinkResourceListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = KeyVaultPrivateLinkResourceListResult.DeserializeKeyVaultPrivateLinkResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets the private link resources supported for the key vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the vault. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListByVault(string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - using var message = CreateListByVaultRequest(subscriptionId, resourceGroupName, vaultName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - KeyVaultPrivateLinkResourceListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = KeyVaultPrivateLinkResourceListResult.DeserializeKeyVaultPrivateLinkResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/SecretsRestOperations.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/SecretsRestOperations.cs index c4f5b9787aa2..851a5234cc46 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/SecretsRestOperations.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/SecretsRestOperations.cs @@ -6,165 +6,47 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.KeyVault.Models; namespace Azure.ResourceManager.KeyVault { - internal partial class SecretsRestOperations + internal partial class Secrets { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of SecretsRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public SecretsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of Secrets for mocking. + protected Secrets() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-05-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string vaultName, int? top) + /// Initializes a new instance of Secrets. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal Secrets(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); - uri.AppendPath(vaultName, true); - uri.AppendPath("/secrets", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - return uri; + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string vaultName, int? top) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); - uri.AppendPath(vaultName, true); - uri.AppendPath("/secrets", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the vault. - /// Maximum number of results to return. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string vaultName, int? top = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - using var message = CreateListRequest(subscriptionId, resourceGroupName, vaultName, top); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - SecretListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = SecretListResult.DeserializeSecretListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } - /// The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the vault. - /// Maximum number of results to return. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string vaultName, int? top = null, CancellationToken cancellationToken = default) + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string vaultName, string secretName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, vaultName, top); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - SecretListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = SecretListResult.DeserializeSecretListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string vaultName, string secretName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); - uri.AppendPath(vaultName, true); - uri.AppendPath("/secrets/", false); - uri.AppendPath(secretName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string vaultName, string secretName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); @@ -172,103 +54,20 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath("/secrets/", false); uri.AppendPath(secretName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the vault. - /// The name of the secret. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string vaultName, string secretName, CancellationToken cancellationToken = default) + internal HttpMessage CreateCreateOrUpdateRequest(Guid subscriptionId, string resourceGroupName, string vaultName, string secretName, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - Argument.AssertNotNullOrEmpty(secretName, nameof(secretName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, vaultName, secretName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - KeyVaultSecretData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = KeyVaultSecretData.DeserializeKeyVaultSecretData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((KeyVaultSecretData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the vault. - /// The name of the secret. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string vaultName, string secretName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - Argument.AssertNotNullOrEmpty(secretName, nameof(secretName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, vaultName, secretName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - KeyVaultSecretData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = KeyVaultSecretData.DeserializeKeyVaultSecretData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((KeyVaultSecretData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string vaultName, string secretName, KeyVaultSecretCreateOrUpdateContent content) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); - uri.AppendPath(vaultName, true); - uri.AppendPath("/secrets/", false); - uri.AppendPath(secretName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string vaultName, string secretName, KeyVaultSecretCreateOrUpdateContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); @@ -276,90 +75,22 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendPath("/secrets/", false); uri.AppendPath(secretName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; return message; } - /// Create or update a secret in a key vault in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the vault. - /// The name of the secret. - /// Parameters to create or update the secret. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string vaultName, string secretName, KeyVaultSecretCreateOrUpdateContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - Argument.AssertNotNullOrEmpty(secretName, nameof(secretName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, vaultName, secretName, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - { - KeyVaultSecretData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = KeyVaultSecretData.DeserializeKeyVaultSecretData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create or update a secret in a key vault in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the vault. - /// The name of the secret. - /// Parameters to create or update the secret. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string vaultName, string secretName, KeyVaultSecretCreateOrUpdateContent content, CancellationToken cancellationToken = default) + internal HttpMessage CreateUpdateRequest(Guid subscriptionId, string resourceGroupName, string vaultName, string secretName, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - Argument.AssertNotNullOrEmpty(secretName, nameof(secretName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, vaultName, secretName, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - { - KeyVaultSecretData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = KeyVaultSecretData.DeserializeKeyVaultSecretData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string vaultName, string secretName, KeyVaultSecretPatch patch) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); @@ -367,187 +98,50 @@ internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string uri.AppendPath("/secrets/", false); uri.AppendPath(secretName, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string vaultName, string secretName, KeyVaultSecretPatch patch) + internal HttpMessage CreateGetAllRequest(Guid subscriptionId, string resourceGroupName, string vaultName, int? top, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); uri.AppendPath(vaultName, true); - uri.AppendPath("/secrets/", false); - uri.AppendPath(secretName, true); + uri.AppendPath("/secrets", false); uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Update a secret in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the vault. - /// The name of the secret. - /// Parameters to patch the secret. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string vaultName, string secretName, KeyVaultSecretPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - Argument.AssertNotNullOrEmpty(secretName, nameof(secretName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, vaultName, secretName, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - { - KeyVaultSecretData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = KeyVaultSecretData.DeserializeKeyVaultSecretData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Update a secret in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the vault. - /// The name of the secret. - /// Parameters to patch the secret. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string vaultName, string secretName, KeyVaultSecretPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - Argument.AssertNotNullOrEmpty(secretName, nameof(secretName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, vaultName, secretName, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + if (top != null) { - case 200: - case 201: - { - KeyVaultSecretData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = KeyVaultSecretData.DeserializeKeyVaultSecretData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$top", TypeFormatters.ConvertToString(top), true); } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string vaultName, int? top) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string vaultName, int? top) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the vault. - /// Maximum number of results to return. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string vaultName, int? top = null, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetAllRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, string vaultName, int? top, RequestContext context) { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, vaultName, top); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - SecretListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = SecretListResult.DeserializeSecretListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the vault. - /// Maximum number of results to return. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string vaultName, int? top = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, vaultName, top); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - SecretListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = SecretListResult.DeserializeSecretListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/VaultsOperationGroupRestOperations.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/VaultsOperationGroupRestOperations.cs new file mode 100644 index 000000000000..843e396a102e --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/VaultsOperationGroupRestOperations.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.KeyVault +{ + internal partial class VaultsOperationGroup + { + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of VaultsOperationGroup for mocking. + protected VaultsOperationGroup() + { + } + + /// Initializes a new instance of VaultsOperationGroup. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal VaultsOperationGroup(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) + { + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; + } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + internal HttpMessage CreateGetDeletedKeyVaultsRequest(Guid subscriptionId, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/providers/Microsoft.KeyVault/deletedVaults", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateNextGetDeletedKeyVaultsRequest(Uri nextPage, Guid subscriptionId, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCheckKeyVaultNameAvailabilityRequest(Guid subscriptionId, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/providers/Microsoft.KeyVault/checkNameAvailability", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/VaultsRestOperations.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/VaultsRestOperations.cs index 528774d4fc8d..c089a792db2a 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/VaultsRestOperations.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/VaultsRestOperations.cs @@ -6,1278 +6,227 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.KeyVault.Models; namespace Azure.ResourceManager.KeyVault { - internal partial class VaultsRestOperations + internal partial class Vaults { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of VaultsRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public VaultsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-05-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateCheckNameAvailabilityRequestUri(string subscriptionId, KeyVaultNameAvailabilityContent content) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.KeyVault/checkNameAvailability", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCheckNameAvailabilityRequest(string subscriptionId, KeyVaultNameAvailabilityContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.KeyVault/checkNameAvailability", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); - return message; - } - - /// Checks that the vault name is valid and is not already in use. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the vault. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> CheckNameAvailabilityAsync(string subscriptionId, KeyVaultNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateCheckNameAvailabilityRequest(subscriptionId, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - KeyVaultNameAvailabilityResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = KeyVaultNameAvailabilityResult.DeserializeKeyVaultNameAvailabilityResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Checks that the vault name is valid and is not already in use. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the vault. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response CheckNameAvailability(string subscriptionId, KeyVaultNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateCheckNameAvailabilityRequest(subscriptionId, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - KeyVaultNameAvailabilityResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = KeyVaultNameAvailabilityResult.DeserializeKeyVaultNameAvailabilityResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListDeletedRequestUri(string subscriptionId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.KeyVault/deletedVaults", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListDeletedRequest(string subscriptionId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.KeyVault/deletedVaults", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Gets information about the deleted vaults in a subscription. - /// The ID of the target subscription. The value must be an UUID. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListDeletedAsync(string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListDeletedRequest(subscriptionId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DeletedVaultListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DeletedVaultListResult.DeserializeDeletedVaultListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets information about the deleted vaults in a subscription. - /// The ID of the target subscription. The value must be an UUID. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response ListDeleted(string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListDeletedRequest(subscriptionId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DeletedVaultListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DeletedVaultListResult.DeserializeDeletedVaultListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetDeletedRequestUri(string subscriptionId, AzureLocation location, string vaultName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.KeyVault/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/deletedVaults/", false); - uri.AppendPath(vaultName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetDeletedRequest(string subscriptionId, AzureLocation location, string vaultName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.KeyVault/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/deletedVaults/", false); - uri.AppendPath(vaultName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Gets the deleted Azure key vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The name of the vault. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> GetDeletedAsync(string subscriptionId, AzureLocation location, string vaultName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - using var message = CreateGetDeletedRequest(subscriptionId, location, vaultName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DeletedKeyVaultData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DeletedKeyVaultData.DeserializeDeletedKeyVaultData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DeletedKeyVaultData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets the deleted Azure key vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The name of the vault. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response GetDeleted(string subscriptionId, AzureLocation location, string vaultName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - using var message = CreateGetDeletedRequest(subscriptionId, location, vaultName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DeletedKeyVaultData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DeletedKeyVaultData.DeserializeDeletedKeyVaultData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DeletedKeyVaultData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreatePurgeDeletedRequestUri(string subscriptionId, AzureLocation location, string vaultName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.KeyVault/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/deletedVaults/", false); - uri.AppendPath(vaultName, true); - uri.AppendPath("/purge", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreatePurgeDeletedRequest(string subscriptionId, AzureLocation location, string vaultName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.KeyVault/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/deletedVaults/", false); - uri.AppendPath(vaultName, true); - uri.AppendPath("/purge", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Permanently deletes the specified vault. aka Purges the deleted Azure key vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The name of the vault. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task PurgeDeletedAsync(string subscriptionId, AzureLocation location, string vaultName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - using var message = CreatePurgeDeletedRequest(subscriptionId, location, vaultName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Permanently deletes the specified vault. aka Purges the deleted Azure key vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The name of the vault. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response PurgeDeleted(string subscriptionId, AzureLocation location, string vaultName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - using var message = CreatePurgeDeletedRequest(subscriptionId, location, vaultName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId, int? top) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.KeyVault/vaults", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - return uri; - } - - internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, int? top) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.KeyVault/vaults", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// The List operation gets information about the vaults associated with the subscription. - /// The ID of the target subscription. The value must be an UUID. - /// Maximum number of results to return. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListBySubscriptionAsync(string subscriptionId, int? top = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionRequest(subscriptionId, top); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - VaultListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = VaultListResult.DeserializeVaultListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// The List operation gets information about the vaults associated with the subscription. - /// The ID of the target subscription. The value must be an UUID. - /// Maximum number of results to return. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response ListBySubscription(string subscriptionId, int? top = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionRequest(subscriptionId, top); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - VaultListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = VaultListResult.DeserializeVaultListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName, int? top) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/vaults", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - return uri; - } - - internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName, int? top) + /// Initializes a new instance of Vaults for mocking. + protected Vaults() { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/vaults", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; } - /// The List operation gets information about the vaults associated with the subscription and within the specified resource group. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Maximum number of results to return. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, int? top = null, CancellationToken cancellationToken = default) + /// Initializes a new instance of Vaults. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal Vaults(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, top); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - VaultListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = VaultListResult.DeserializeVaultListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - /// The List operation gets information about the vaults associated with the subscription and within the specified resource group. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Maximum number of results to return. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, int? top = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, top); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - VaultListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = VaultListResult.DeserializeVaultListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string vaultName) + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string vaultName, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); - uri.AppendPath(vaultName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string vaultName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); uri.AppendPath(vaultName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Gets the specified Azure key vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the vault. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) + internal HttpMessage CreateCreateOrUpdateRequest(Guid subscriptionId, string resourceGroupName, string vaultName, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, vaultName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - KeyVaultData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = KeyVaultData.DeserializeKeyVaultData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((KeyVaultData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets the specified Azure key vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the vault. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, vaultName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - KeyVaultData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = KeyVaultData.DeserializeKeyVaultData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((KeyVaultData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string vaultName, KeyVaultCreateOrUpdateContent content) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); uri.AppendPath(vaultName, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string vaultName, KeyVaultCreateOrUpdateContent content) + internal HttpMessage CreateUpdateRequest(Guid subscriptionId, string resourceGroupName, string vaultName, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); uri.AppendPath(vaultName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); + request.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; return message; } - /// Create or update a key vault in the specified subscription. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the vault. - /// Parameters to create or update the vault. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string vaultName, KeyVaultCreateOrUpdateContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, vaultName, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create or update a key vault in the specified subscription. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the vault. - /// Parameters to create or update the vault. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string vaultName, KeyVaultCreateOrUpdateContent content, CancellationToken cancellationToken = default) + internal HttpMessage CreateDeleteRequest(Guid subscriptionId, string resourceGroupName, string vaultName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, vaultName, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string vaultName, KeyVaultPatch patch) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); uri.AppendPath(vaultName, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string vaultName, KeyVaultPatch patch) + internal HttpMessage CreateGetByResourceGroupRequest(Guid subscriptionId, string resourceGroupName, int? top, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); - uri.AppendPath(vaultName, true); + uri.AppendPath("/providers/Microsoft.KeyVault/vaults", false); uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Update a key vault in the specified subscription. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the vault. - /// Parameters to patch the vault. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string vaultName, KeyVaultPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, vaultName, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - { - KeyVaultData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = KeyVaultData.DeserializeKeyVaultData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Update a key vault in the specified subscription. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the vault. - /// Parameters to patch the vault. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string vaultName, KeyVaultPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, vaultName, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + if (top != null) { - case 200: - case 201: - { - KeyVaultData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = KeyVaultData.DeserializeKeyVaultData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$top", TypeFormatters.ConvertToString(top), true); } + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string vaultName) + internal HttpMessage CreateNextGetByResourceGroupRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, int? top, RequestContext context) { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); - uri.AppendPath(vaultName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string vaultName) + internal HttpMessage CreateGetBySubscriptionRequest(Guid subscriptionId, int? top, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); - uri.AppendPath(vaultName, true); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/providers/Microsoft.KeyVault/vaults", false); uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Deletes the specified Azure key vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the vault. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, vaultName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + if (top != null) { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$top", TypeFormatters.ConvertToString(top), true); } + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - /// Deletes the specified Azure key vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the vault. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetBySubscriptionRequest(Uri nextPage, Guid subscriptionId, int? top, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, vaultName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal RequestUriBuilder CreateUpdateAccessPolicyRequestUri(string subscriptionId, string resourceGroupName, string vaultName, AccessPolicyUpdateKind operationKind, KeyVaultAccessPolicyParameters keyVaultAccessPolicyParameters) + internal HttpMessage CreateUpdateAccessPolicyRequest(Guid subscriptionId, string resourceGroupName, string vaultName, string operationKind, RequestContent content, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); uri.AppendPath(vaultName, true); uri.AppendPath("/accessPolicies/", false); - uri.AppendPath(operationKind.ToSerialString(), true); + uri.AppendPath(operationKind, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; } - internal HttpMessage CreateUpdateAccessPolicyRequest(string subscriptionId, string resourceGroupName, string vaultName, AccessPolicyUpdateKind operationKind, KeyVaultAccessPolicyParameters keyVaultAccessPolicyParameters) + internal HttpMessage CreateGetPrivateLinkResourcesRequest(Guid subscriptionId, string resourceGroupName, string vaultName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); uri.AppendPath(vaultName, true); - uri.AppendPath("/accessPolicies/", false); - uri.AppendPath(operationKind.ToSerialString(), true); + uri.AppendPath("/privateLinkResources", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(keyVaultAccessPolicyParameters, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Update access policies in a key vault in the specified subscription. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the vault. - /// Name of the operation. - /// Access policy to merge into the vault. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> UpdateAccessPolicyAsync(string subscriptionId, string resourceGroupName, string vaultName, AccessPolicyUpdateKind operationKind, KeyVaultAccessPolicyParameters keyVaultAccessPolicyParameters, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - Argument.AssertNotNull(keyVaultAccessPolicyParameters, nameof(keyVaultAccessPolicyParameters)); - - using var message = CreateUpdateAccessPolicyRequest(subscriptionId, resourceGroupName, vaultName, operationKind, keyVaultAccessPolicyParameters); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - { - KeyVaultAccessPolicyParameters value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = KeyVaultAccessPolicyParameters.DeserializeKeyVaultAccessPolicyParameters(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Update access policies in a key vault in the specified subscription. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the vault. - /// Name of the operation. - /// Access policy to merge into the vault. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response UpdateAccessPolicy(string subscriptionId, string resourceGroupName, string vaultName, AccessPolicyUpdateKind operationKind, KeyVaultAccessPolicyParameters keyVaultAccessPolicyParameters, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - Argument.AssertNotNull(keyVaultAccessPolicyParameters, nameof(keyVaultAccessPolicyParameters)); - - using var message = CreateUpdateAccessPolicyRequest(subscriptionId, resourceGroupName, vaultName, operationKind, keyVaultAccessPolicyParameters); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - { - KeyVaultAccessPolicyParameters value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = KeyVaultAccessPolicyParameters.DeserializeKeyVaultAccessPolicyParameters(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListDeletedNextPageRequestUri(string nextLink, string subscriptionId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListDeletedNextPageRequest(string nextLink, string subscriptionId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Headers.SetValue("Accept", "application/json"); return message; } - - /// Gets information about the deleted vaults in a subscription. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListDeletedNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListDeletedNextPageRequest(nextLink, subscriptionId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DeletedVaultListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DeletedVaultListResult.DeserializeDeletedVaultListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets information about the deleted vaults in a subscription. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response ListDeletedNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListDeletedNextPageRequest(nextLink, subscriptionId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DeletedVaultListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DeletedVaultListResult.DeserializeDeletedVaultListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId, int? top) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId, int? top) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// The List operation gets information about the vaults associated with the subscription. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// Maximum number of results to return. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, int? top = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, top); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - VaultListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = VaultListResult.DeserializeVaultListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// The List operation gets information about the vaults associated with the subscription. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// Maximum number of results to return. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, int? top = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, top); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - VaultListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = VaultListResult.DeserializeVaultListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, int? top) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, int? top) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// The List operation gets information about the vaults associated with the subscription and within the specified resource group. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Maximum number of results to return. - /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, int? top = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, top); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - VaultListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = VaultListResult.DeserializeVaultListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// The List operation gets information about the vaults associated with the subscription and within the specified resource group. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Maximum number of results to return. - /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, int? top = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, top); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - VaultListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = VaultListResult.DeserializeVaultListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/SecretsGetAllAsyncCollectionResultOfT.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/SecretsGetAllAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..eae1238a3ce9 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/SecretsGetAllAsyncCollectionResultOfT.cs @@ -0,0 +1,92 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.KeyVault.Models; + +namespace Azure.ResourceManager.KeyVault +{ + internal partial class SecretsGetAllAsyncCollectionResultOfT : AsyncPageable + { + private readonly Secrets _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _vaultName; + private readonly int? _top; + private readonly RequestContext _context; + + /// Initializes a new instance of SecretsGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Secrets client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the vault. + /// Maximum number of results to return. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public SecretsGetAllAsyncCollectionResultOfT(Secrets client, Guid subscriptionId, string resourceGroupName, string vaultName, int? top, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _vaultName = vaultName; + _top = top; + _context = context; + } + + /// Gets the pages of SecretsGetAllAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of SecretsGetAllAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + SecretListResult result = SecretListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _vaultName, _top, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _vaultName, _top, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("KeyVaultSecretCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/SecretsGetAllCollectionResultOfT.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/SecretsGetAllCollectionResultOfT.cs new file mode 100644 index 000000000000..41430cd9ebed --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/SecretsGetAllCollectionResultOfT.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.KeyVault.Models; + +namespace Azure.ResourceManager.KeyVault +{ + internal partial class SecretsGetAllCollectionResultOfT : Pageable + { + private readonly Secrets _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _vaultName; + private readonly int? _top; + private readonly RequestContext _context; + + /// Initializes a new instance of SecretsGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Secrets client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the vault. + /// Maximum number of results to return. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public SecretsGetAllCollectionResultOfT(Secrets client, Guid subscriptionId, string resourceGroupName, string vaultName, int? top, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _vaultName = vaultName; + _top = top; + _context = context; + } + + /// Gets the pages of SecretsGetAllCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of SecretsGetAllCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + SecretListResult result = SecretListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _vaultName, _top, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _vaultName, _top, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("KeyVaultSecretCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/VaultsGetByResourceGroupAsyncCollectionResultOfT.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/VaultsGetByResourceGroupAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..be266ae6919c --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/VaultsGetByResourceGroupAsyncCollectionResultOfT.cs @@ -0,0 +1,88 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.KeyVault.Models; + +namespace Azure.ResourceManager.KeyVault +{ + internal partial class VaultsGetByResourceGroupAsyncCollectionResultOfT : AsyncPageable + { + private readonly Vaults _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly int? _top; + private readonly RequestContext _context; + + /// Initializes a new instance of VaultsGetByResourceGroupAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Vaults client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Maximum number of results to return. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + public VaultsGetByResourceGroupAsyncCollectionResultOfT(Vaults client, Guid subscriptionId, string resourceGroupName, int? top, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _top = top; + _context = context; + } + + /// Gets the pages of VaultsGetByResourceGroupAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of VaultsGetByResourceGroupAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + VaultListResult result = VaultListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByResourceGroupRequest(nextLink, _subscriptionId, _resourceGroupName, _top, _context) : _client.CreateGetByResourceGroupRequest(_subscriptionId, _resourceGroupName, _top, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("KeyVaultCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/VaultsGetByResourceGroupCollectionResultOfT.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/VaultsGetByResourceGroupCollectionResultOfT.cs new file mode 100644 index 000000000000..1a5103fd0d10 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/VaultsGetByResourceGroupCollectionResultOfT.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.KeyVault.Models; + +namespace Azure.ResourceManager.KeyVault +{ + internal partial class VaultsGetByResourceGroupCollectionResultOfT : Pageable + { + private readonly Vaults _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly int? _top; + private readonly RequestContext _context; + + /// Initializes a new instance of VaultsGetByResourceGroupCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Vaults client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Maximum number of results to return. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + public VaultsGetByResourceGroupCollectionResultOfT(Vaults client, Guid subscriptionId, string resourceGroupName, int? top, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _top = top; + _context = context; + } + + /// Gets the pages of VaultsGetByResourceGroupCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of VaultsGetByResourceGroupCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + VaultListResult result = VaultListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByResourceGroupRequest(nextLink, _subscriptionId, _resourceGroupName, _top, _context) : _client.CreateGetByResourceGroupRequest(_subscriptionId, _resourceGroupName, _top, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("KeyVaultCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/VaultsGetBySubscriptionAsyncCollectionResultOfT.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/VaultsGetBySubscriptionAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..951f1e63c7ea --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/VaultsGetBySubscriptionAsyncCollectionResultOfT.cs @@ -0,0 +1,81 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.KeyVault.Models; + +namespace Azure.ResourceManager.KeyVault +{ + internal partial class VaultsGetBySubscriptionAsyncCollectionResultOfT : AsyncPageable + { + private readonly Vaults _client; + private readonly Guid _subscriptionId; + private readonly int? _top; + private readonly RequestContext _context; + + /// Initializes a new instance of VaultsGetBySubscriptionAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Vaults client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// Maximum number of results to return. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public VaultsGetBySubscriptionAsyncCollectionResultOfT(Vaults client, Guid subscriptionId, int? top, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _top = top; + _context = context; + } + + /// Gets the pages of VaultsGetBySubscriptionAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of VaultsGetBySubscriptionAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + VaultListResult result = VaultListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetBySubscriptionRequest(nextLink, _subscriptionId, _top, _context) : _client.CreateGetBySubscriptionRequest(_subscriptionId, _top, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableKeyVaultSubscriptionResource.GetKeyVaults"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/VaultsGetBySubscriptionCollectionResultOfT.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/VaultsGetBySubscriptionCollectionResultOfT.cs new file mode 100644 index 000000000000..b2878478cdff --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/VaultsGetBySubscriptionCollectionResultOfT.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.KeyVault.Models; + +namespace Azure.ResourceManager.KeyVault +{ + internal partial class VaultsGetBySubscriptionCollectionResultOfT : Pageable + { + private readonly Vaults _client; + private readonly Guid _subscriptionId; + private readonly int? _top; + private readonly RequestContext _context; + + /// Initializes a new instance of VaultsGetBySubscriptionCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Vaults client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// Maximum number of results to return. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public VaultsGetBySubscriptionCollectionResultOfT(Vaults client, Guid subscriptionId, int? top, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _top = top; + _context = context; + } + + /// Gets the pages of VaultsGetBySubscriptionCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of VaultsGetBySubscriptionCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + VaultListResult result = VaultListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetBySubscriptionRequest(nextLink, _subscriptionId, _top, _context) : _client.CreateGetBySubscriptionRequest(_subscriptionId, _top, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableKeyVaultSubscriptionResource.GetKeyVaults"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/VaultsOperationGroupGetDeletedKeyVaultsAsyncCollectionResultOfT.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/VaultsOperationGroupGetDeletedKeyVaultsAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..13a587b415d3 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/VaultsOperationGroupGetDeletedKeyVaultsAsyncCollectionResultOfT.cs @@ -0,0 +1,78 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.KeyVault.Models; + +namespace Azure.ResourceManager.KeyVault +{ + internal partial class VaultsOperationGroupGetDeletedKeyVaultsAsyncCollectionResultOfT : AsyncPageable + { + private readonly VaultsOperationGroup _client; + private readonly Guid _subscriptionId; + private readonly RequestContext _context; + + /// Initializes a new instance of VaultsOperationGroupGetDeletedKeyVaultsAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The VaultsOperationGroup client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public VaultsOperationGroupGetDeletedKeyVaultsAsyncCollectionResultOfT(VaultsOperationGroup client, Guid subscriptionId, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _context = context; + } + + /// Gets the pages of VaultsOperationGroupGetDeletedKeyVaultsAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of VaultsOperationGroupGetDeletedKeyVaultsAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + DeletedVaultListResult result = DeletedVaultListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetDeletedKeyVaultsRequest(nextLink, _subscriptionId, _context) : _client.CreateGetDeletedKeyVaultsRequest(_subscriptionId, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableKeyVaultSubscriptionResource.GetDeletedKeyVaults"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/VaultsOperationGroupGetDeletedKeyVaultsCollectionResultOfT.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/VaultsOperationGroupGetDeletedKeyVaultsCollectionResultOfT.cs new file mode 100644 index 000000000000..850316831970 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/VaultsOperationGroupGetDeletedKeyVaultsCollectionResultOfT.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.KeyVault.Models; + +namespace Azure.ResourceManager.KeyVault +{ + internal partial class VaultsOperationGroupGetDeletedKeyVaultsCollectionResultOfT : Pageable + { + private readonly VaultsOperationGroup _client; + private readonly Guid _subscriptionId; + private readonly RequestContext _context; + + /// Initializes a new instance of VaultsOperationGroupGetDeletedKeyVaultsCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The VaultsOperationGroup client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public VaultsOperationGroupGetDeletedKeyVaultsCollectionResultOfT(VaultsOperationGroup client, Guid subscriptionId, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _context = context; + } + + /// Gets the pages of VaultsOperationGroupGetDeletedKeyVaultsCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of VaultsOperationGroupGetDeletedKeyVaultsCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + DeletedVaultListResult result = DeletedVaultListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetDeletedKeyVaultsRequest(nextLink, _subscriptionId, _context) : _client.CreateGetDeletedKeyVaultsRequest(_subscriptionId, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableKeyVaultSubscriptionResource.GetDeletedKeyVaults"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/autorest.md b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/autorest.md deleted file mode 100644 index d06fa6c5beb5..000000000000 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/autorest.md +++ /dev/null @@ -1,414 +0,0 @@ -# Generated code configuration - -Run `dotnet build /t:GenerateCode` to generate code. - -``` yaml -azure-arm: true -csharp: true -library-name: KeyVault -namespace: Azure.ResourceManager.KeyVault -require: https://github.com/Azure/azure-rest-api-specs/blob/ec840ab32b39f029da1021637090cfc24b7429a8/specification/keyvault/resource-manager/readme.md -#tag: package-2025-05 -output-folder: $(this-folder)/Generated -clear-output-folder: true -sample-gen: - output-folder: $(this-folder)/../tests/Generated - clear-output-folder: true -skip-csproj: true -modelerfour: - flatten-payloads: false -use-model-reader-writer: true -enable-bicep-serialization: true - -#mgmt-debug: -# show-serialized-names: true - -override-operation-name: - Vaults_CheckNameAvailability: CheckKeyVaultNameAvailability - MHSMPrivateLinkResources_ListByMhsmResource: GetManagedHsmPrivateLinkResources - ManagedHsms_CheckManagedHsmNameAvailability: CheckManagedHsmNameAvailability -list-exception: -- /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName} -- /subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name} - -format-by-name-rules: - 'tenantId': 'uuid' - 'ETag': 'etag' - 'location': 'azure-location' - '*Uri': 'Uri' - '*Uris': 'Uri' - -no-property-type-replacement: -- ManagedHsmVirtualNetworkRule - -acronym-mapping: - CPU: Cpu - CPUs: Cpus - Os: OS - Ip: IP - Ips: IPs|ips - ID: Id - IDs: Ids - VM: Vm - VMs: Vms - Vmos: VmOS - VMScaleSet: VmScaleSet - DNS: Dns - VPN: Vpn - NAT: Nat - WAN: Wan - Ipv4: IPv4|ipv4 - Ipv6: IPv6|ipv6 - Ipsec: IPsec|ipsec - SSO: Sso - URI: Uri - Etag: ETag|etag - Managecontacts: ManageContacts - Getissuers: GetIssuers - Listissuers: ListIssuers - Setissuers: SetIssuers - Deleteissuers: DeleteIssuers - Manageissuers: ManageIssuers - Regeneratekey: RegenerateKey - Deletesas: DeleteSas - Getsas: GetSas - Listsas: ListSas - Setsas: SetSas - Mhsm: ManagedHsm - -rename-mapping: - CheckMhsmNameAvailabilityResult: ManagedHsmNameAvailabilityResult - CheckMhsmNameAvailabilityResult.nameAvailable : IsNameAvailable - CheckMhsmNameAvailabilityParameters: MhsmNameAvailabilityParameters - ActivationStatus: ManagedHSMSecurityDomainActivationStatus - Attributes: SecretBaseAttributes - GeoReplicationRegionProvisioningState: ManagedHsmGeoReplicatedRegionProvisioningState - ManagedHsmPrivateEndpointConnectionItemData.id: -|arm-id - Secret: KeyVaultSecret - MhsmPrivateEndpointConnectionItem: ManagedHsmPrivateEndpointConnectionItemData - MhsmPrivateEndpointConnectionItem.id: -|arm-id - MhsmPrivateLinkResource: ManagedHsmPrivateLinkResourceData - MhsmVirtualNetworkRule.id: SubnetId|arm-id - PublicNetworkAccess: ManagedHsmPublicNetworkAccess - ManagedHsmProperties.networkAcls: NetworkRuleSet - MhsmipRule: ManagedHsmIPRule - DeletedManagedHsmProperties.mhsmId: -|arm-id - DeletedVaultProperties: DeletedKeyVaultProperties - DeletedVault: DeletedKeyVault - MhsmipRule.value: AddressRange - PrivateLinkResource: KeyVaultPrivateLinkResourceData - AccessPolicyEntry: KeyVaultAccessPolicy - NetworkRuleSet: KeyVaultNetworkRuleSet - VaultCheckNameAvailabilityParameters: KeyVaultNameAvailabilityContent - VaultAccessPolicyProperties: KeyVaultAccessPolicyProperties - PrivateEndpointConnectionItem: KeyVaultPrivateEndpointConnectionItemData - VaultCheckNameAvailabilityParameters.type: -|resource-type - VaultPatchProperties: KeyVaultPatchProperties - VaultAccessPolicyParameters: KeyVaultAccessPolicyParameters - VaultPatchProperties.networkAcls: NetworkRuleSet - VaultProperties: KeyVaultProperties - VaultProperties.networkAcls: NetworkRuleSet - Vault: KeyVault - VirtualNetworkRule: KeyVaultVirtualNetworkRule - DeletedVaultProperties.vaultId: -|arm-id - Permissions: IdentityAccessPermissions - IPRule: KeyVaultIPRule - KeyPermissions: IdentityAccessKeyPermission - SecretPermissions: IdentityAccessSecretPermission - StoragePermissions: IdentityAccessStoragePermission - CertificatePermissions: IdentityAccessCertificatePermission - IPRule.value: AddressRange - CheckNameAvailabilityResult: KeyVaultNameAvailabilityResult - Trigger: KeyRotationTrigger - Action: KeyRotationAction - Key: KeyVaultKey - Key.properties.kty: keyType - KeyAttributes.enabled: isEnabled - KeyAttributes.exportable: canExported - KeyProperties.kty: keyType - ManagedHsmKeyAttributes.enabled: isEnabled - ManagedHsmKeyAttributes.exportable: canExported - ManagedHsmKeyProperties.kty: keyType - VaultProvisioningState: KeyVaultProvisioningState - ProvisioningState: ManagedHsmProvisioningState - CreateMode: KeyVaultCreateMode - PrivateEndpointServiceConnectionStatus: KeyVaultPrivateEndpointServiceConnectionStatus - NetworkRuleBypassOptions: KeyVaultNetworkRuleBypassOption - ActionsRequired: KeyVaultActionsRequiredMessage - NetworkRuleAction: KeyVaultNetworkRuleAction - Reason: KeyVaultNameUnavailableReason - -prompted-enum-values: Default - -directive: - - from: swagger-document - where: $.paths - transform: delete $['/subscriptions/{subscriptionId}/resources'] - - from: swagger-document - where: $.definitions.Sku.properties.family - transform: delete $['x-ms-client-default'] - - from: swagger-document - where: $.definitions.ManagedHsmSku.properties.family - transform: delete $['x-ms-client-default'] - - from: managedHsm.json - where: $.definitions - transform: > # these directives are here on purpose because we do not want them to merge with others otherwise we get breaking changes - $.MHSMPrivateEndpointConnectionProvisioningState['x-ms-enum']['name'] = 'ManagedHsmPrivateEndpointConnectionProvisioningState'; - $.MHSMPrivateEndpointServiceConnectionStatus['x-ms-enum']['name'] = 'ManagedHsmPrivateEndpointServiceConnectionStatus'; - $.ManagedHsmProperties.properties.provisioningState['x-ms-enum']['name'] = 'ManagedHsmProvisioningState'; - - from: keyvault.json - where: $.definitions - transform: > - $.VaultCheckNameAvailabilityParameters.properties.type['x-ms-constant'] = true; - $.NetworkRuleSet.properties.bypass['x-ms-enum']['name'] = 'KeyVaultNetworkRuleBypassOption'; - $.NetworkRuleSet.properties.defaultAction['x-ms-enum']['name'] = 'KeyVaultNetworkRuleAction'; - $.PrivateLinkServiceConnectionState.properties.actionsRequired['x-ms-enum']['name'] = 'KeyVaultActionsRequiredMessage'; - $.VaultPatchProperties.properties.createMode['x-ms-enum']['name'] = 'KeyVaultPatchMode'; - $.VaultProperties.properties.createMode['x-ms-enum']['name'] = 'KeyVaultCreateMode'; - $.VaultProperties.properties.provisioningState['x-ms-enum']['name'] = 'KeyVaultProvisioningState'; - $.Vault['x-csharp-usage'] = 'model,input,output'; - $.CheckNameAvailabilityResult.properties.reason['x-ms-enum']['name'] = 'KeyVaultNameUnavailableReason'; - # Remove keysManagedHsm.json and keys.json since these 2 are part of data plane - - from: keysManagedHsm.json - where: $.paths - transform: > - for (var path in $) - { - delete $[path]; - } - - from: keys.json - where: $.paths - transform: > - for (var path in $) - { - delete $[path]; - } - # Delete according to the paths deleted in the keysManagedHsm.json and keys.json files above. - - from: openapi.json - where: $.paths - transform: > - var pathsToDelete = [ - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys', - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}', - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}/versions/{keyVersion}', - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}/versions', - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}', - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys', - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions/{keyVersion}', - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions' - ]; - for (var i = 0; i < pathsToDelete.length; i++) { - delete $[pathsToDelete[i]]; - } - # The following content was originally in the managedHsm.json file, - # but is not present in the new file, and the references have also changed. - - from: openapi.json - where: $.definitions - transform: > - $.MHSMPrivateEndpointConnectionProvisioningState = { - "type": "string", - "readOnly": true, - "description": "The current provisioning state.", - "enum": [ - "Succeeded", - "Creating", - "Updating", - "Deleting", - "Failed", - "Disconnected" - ], - "x-ms-enum": { - "name": "ManagedHsmPrivateEndpointConnectionProvisioningState", - "modelAsString": true, - "values": [ - { - "name": "Succeeded", - "value": "Succeeded" - }, - { - "name": "Creating", - "value": "Creating" - }, - { - "name": "Updating", - "value": "Updating" - }, - { - "name": "Deleting", - "value": "Deleting" - }, - { - "name": "Failed", - "value": "Failed" - }, - { - "name": "Disconnected", - "value": "Disconnected" - } - ] - } - }; - $.MHSMPrivateEndpointConnectionProperties.properties.provisioningState['$ref'] = '#/definitions/MHSMPrivateEndpointConnectionProvisioningState'; - # The directive processing in the above managedHsm.json and keyvault.json files is similar. - - from: openapi.json - where: $.definitions.VaultCheckNameAvailabilityParameters.properties - transform: > - $.type['x-ms-constant'] = true; - # The following are all merged from multiple JSON files into one JSON file, - # where multiple nodes in the definitions reference the same node (with different original names, but currently the same). - - from: openapi.json - where: $.definitions - transform: > - $.PatchMode = { - "type": "string", - "description": "The vault's create mode to indicate whether the vault need to be recovered or not.", - "enum": [ - "recover", - "default" - ], - "x-ms-enum": { - "name": "KeyVaultPatchMode", - "modelAsString": false - } - }; - $.VaultPatchProperties.properties.createMode['$ref'] = '#/definitions/PatchMode'; - $.MHSMCreateMode = { - "type": "string", - "description": "The create mode to indicate whether the resource is being created or is being recovered from a deleted resource.", - "enum": [ - "recover", - "default" - ], - "x-ms-enum": { - "name": "ManagedHsmCreateMode", - "modelAsString": false, - "values": [ - { - "value": "recover", - "description": "Recover the managed HSM pool from a soft-deleted resource." - }, - { - "value": "default", - "description": "Create a new managed HSM pool. This is the default option." - } - ] - }, - "x-ms-mutability": [ - "create", - "update" - ] - }; - $.ManagedHsmProperties.properties.createMode['$ref'] = '#/definitions/MHSMCreateMode'; - - from: openapi.json - where: $.definitions - transform: > - $.MHSMPrivateEndpointServiceConnectionStatus = { - "type": "string", - "description": "The private endpoint connection status.", - "enum": [ - "Pending", - "Approved", - "Rejected", - "Disconnected" - ], - "x-ms-enum": { - "name": "ManagedHsmPrivateEndpointServiceConnectionStatus", - "modelAsString": true - } - }; - $.MHSMPrivateLinkServiceConnectionState.properties.status['$ref'] = '#/definitions/MHSMPrivateEndpointServiceConnectionStatus'; - - from: openapi.json - where: $.definitions - transform: > - $.MHSMReason = { - "readOnly": true, - "type": "string", - "description": "The reason that a managed hsm name could not be used. The reason element is only returned if NameAvailable is false.", - "enum": [ - "AccountNameInvalid", - "AlreadyExists" - ], - "x-ms-enum": { - "name": "ManagedHsmNameUnavailableReason", - "modelAsString": true - } - }; - $.CheckMhsmNameAvailabilityResult.properties.reason['$ref'] = '#/definitions/MHSMReason'; - $.Reason['x-ms-enum']['modelAsString'] = false; - - from: openapi.json - where: $.definitions - transform: > - $.MHSMNetworkRuleBypassOptions = { - "type": "string", - "description": "Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'.", - "enum": [ - "AzureServices", - "None" - ], - "x-ms-enum": { - "name": "ManagedHsmNetworkRuleBypassOption", - "modelAsString": true - } - }; - $.MHSMNetworkRuleSet.properties.bypass['$ref'] = '#/definitions/MHSMNetworkRuleBypassOptions'; - $.MHSMNetworkRuleAction = { - "type": "string", - "description": "The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated.", - "enum": [ - "Allow", - "Deny" - ], - "x-ms-enum": { - "name": "ManagedHsmNetworkRuleAction", - "modelAsString": true - } - }; - $.MHSMNetworkRuleSet.properties.defaultAction['$ref'] = '#/definitions/MHSMNetworkRuleAction'; - - from: openapi.json - where: $.definitions - transform: > - $.MHSMActionsRequired = { - "type": "string", - "description": "A message indicating if changes on the service provider require any updates on the consumer.", - "enum": [ - "None" - ], - "x-ms-enum": { - "name": "ManagedHsmActionsRequiredMessage", - "modelAsString": true - } - }; - $.MHSMPrivateLinkServiceConnectionState.properties.actionsRequired['$ref'] = '#/definitions/MHSMActionsRequired'; - # this directive is here to workaround a usage issue. Now all the resources in this swagger shares the same base type, and in swagger generator the usage of base type is not properly propagated to the derived types. - # therefore a `input` usage in one of the derived types will polute the other output only derived types with `input` usage, which is not correct. - # so here is a workaround that we made up a new base type that is only used as output, and let all the output only resources to derive from it. - # this would not affect the generated code because we recognize the base type from the shape - any model with the 3 properties of id, name and type as read-only is a resource. - - from: openapi.json - where: $.definitions - transform: > - $.OutputOnlyResource = { - "type": "object", - "description": "A resource model that is only used as output.", - "properties": { - "id": { - "type": "string", - "format": "arm-id", - "description": "Fully qualified resource ID for the resource. E.g. \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}\"", - "readOnly": true - }, - "name": { - "type": "string", - "description": "The name of the resource", - "readOnly": true - }, - "type": { - "type": "string", - "description": "The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\"", - "readOnly": true, - "x-ms-client-name": "resourceType" - } - } - }; - $.DeletedVault.allOf[0]['$ref'] = '#/definitions/OutputOnlyResource'; - $.DeletedManagedHsm.allOf[0]['$ref'] = '#/definitions/OutputOnlyResource'; -``` diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/tsp-location.yaml b/sdk/keyvault/Azure.ResourceManager.KeyVault/tsp-location.yaml new file mode 100644 index 000000000000..4ad1b1ecc9b1 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/keyvault/KeyVault.Management +commit: 846b57500355d32ed66032d212d7744270658bdf +repo: Azure/azure-rest-api-specs +emitterPackageJsonPath: "eng/azure-typespec-http-client-csharp-mgmt-emitter-package.json" diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/tspCodeModel.json b/sdk/keyvault/Azure.ResourceManager.KeyVault/tspCodeModel.json new file mode 100644 index 000000000000..567ef90d8421 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/tspCodeModel.json @@ -0,0 +1,35137 @@ +{ + "name": "Azure.ResourceManager.KeyVault", + "apiVersions": [ + "2025-05-01" + ], + "enums": [ + { + "$id": "1", + "kind": "enum", + "name": "SkuFamily", + "crossLanguageDefinitionId": "Microsoft.KeyVault.SkuFamily", + "valueType": { + "$id": "2", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "3", + "kind": "enumvalue", + "name": "A", + "value": "A", + "valueType": { + "$ref": "2" + }, + "enumType": { + "$ref": "1" + }, + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "doc": "SKU family name", + "isFixed": false, + "isFlags": false, + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "decorators": [] + }, + { + "$id": "4", + "kind": "enum", + "name": "SkuName", + "crossLanguageDefinitionId": "Microsoft.KeyVault.SkuName", + "valueType": { + "$id": "5", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "6", + "kind": "enumvalue", + "name": "standard", + "value": "standard", + "valueType": { + "$ref": "5" + }, + "enumType": { + "$ref": "4" + }, + "decorators": [] + }, + { + "$id": "7", + "kind": "enumvalue", + "name": "premium", + "value": "premium", + "valueType": { + "$ref": "5" + }, + "enumType": { + "$ref": "4" + }, + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "doc": "SKU name to specify whether the key vault is a standard vault or a premium vault.", + "isFixed": true, + "isFlags": false, + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "decorators": [] + }, + { + "$id": "8", + "kind": "enum", + "name": "IdentityAccessKeyPermission", + "crossLanguageDefinitionId": "Microsoft.KeyVault.KeyPermissions", + "valueType": { + "$id": "9", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "10", + "kind": "enumvalue", + "name": "all", + "value": "all", + "valueType": { + "$ref": "9" + }, + "enumType": { + "$ref": "8" + }, + "decorators": [] + }, + { + "$id": "11", + "kind": "enumvalue", + "name": "encrypt", + "value": "encrypt", + "valueType": { + "$ref": "9" + }, + "enumType": { + "$ref": "8" + }, + "decorators": [] + }, + { + "$id": "12", + "kind": "enumvalue", + "name": "decrypt", + "value": "decrypt", + "valueType": { + "$ref": "9" + }, + "enumType": { + "$ref": "8" + }, + "decorators": [] + }, + { + "$id": "13", + "kind": "enumvalue", + "name": "wrapKey", + "value": "wrapKey", + "valueType": { + "$ref": "9" + }, + "enumType": { + "$ref": "8" + }, + "decorators": [] + }, + { + "$id": "14", + "kind": "enumvalue", + "name": "unwrapKey", + "value": "unwrapKey", + "valueType": { + "$ref": "9" + }, + "enumType": { + "$ref": "8" + }, + "decorators": [] + }, + { + "$id": "15", + "kind": "enumvalue", + "name": "sign", + "value": "sign", + "valueType": { + "$ref": "9" + }, + "enumType": { + "$ref": "8" + }, + "decorators": [] + }, + { + "$id": "16", + "kind": "enumvalue", + "name": "verify", + "value": "verify", + "valueType": { + "$ref": "9" + }, + "enumType": { + "$ref": "8" + }, + "decorators": [] + }, + { + "$id": "17", + "kind": "enumvalue", + "name": "get", + "value": "get", + "valueType": { + "$ref": "9" + }, + "enumType": { + "$ref": "8" + }, + "decorators": [] + }, + { + "$id": "18", + "kind": "enumvalue", + "name": "list", + "value": "list", + "valueType": { + "$ref": "9" + }, + "enumType": { + "$ref": "8" + }, + "decorators": [] + }, + { + "$id": "19", + "kind": "enumvalue", + "name": "create", + "value": "create", + "valueType": { + "$ref": "9" + }, + "enumType": { + "$ref": "8" + }, + "decorators": [] + }, + { + "$id": "20", + "kind": "enumvalue", + "name": "update", + "value": "update", + "valueType": { + "$ref": "9" + }, + "enumType": { + "$ref": "8" + }, + "decorators": [] + }, + { + "$id": "21", + "kind": "enumvalue", + "name": "import", + "value": "import", + "valueType": { + "$ref": "9" + }, + "enumType": { + "$ref": "8" + }, + "decorators": [] + }, + { + "$id": "22", + "kind": "enumvalue", + "name": "delete", + "value": "delete", + "valueType": { + "$ref": "9" + }, + "enumType": { + "$ref": "8" + }, + "decorators": [] + }, + { + "$id": "23", + "kind": "enumvalue", + "name": "backup", + "value": "backup", + "valueType": { + "$ref": "9" + }, + "enumType": { + "$ref": "8" + }, + "decorators": [] + }, + { + "$id": "24", + "kind": "enumvalue", + "name": "restore", + "value": "restore", + "valueType": { + "$ref": "9" + }, + "enumType": { + "$ref": "8" + }, + "decorators": [] + }, + { + "$id": "25", + "kind": "enumvalue", + "name": "recover", + "value": "recover", + "valueType": { + "$ref": "9" + }, + "enumType": { + "$ref": "8" + }, + "decorators": [] + }, + { + "$id": "26", + "kind": "enumvalue", + "name": "purge", + "value": "purge", + "valueType": { + "$ref": "9" + }, + "enumType": { + "$ref": "8" + }, + "decorators": [] + }, + { + "$id": "27", + "kind": "enumvalue", + "name": "release", + "value": "release", + "valueType": { + "$ref": "9" + }, + "enumType": { + "$ref": "8" + }, + "decorators": [] + }, + { + "$id": "28", + "kind": "enumvalue", + "name": "rotate", + "value": "rotate", + "valueType": { + "$ref": "9" + }, + "enumType": { + "$ref": "8" + }, + "decorators": [] + }, + { + "$id": "29", + "kind": "enumvalue", + "name": "getrotationpolicy", + "value": "getrotationpolicy", + "valueType": { + "$ref": "9" + }, + "enumType": { + "$ref": "8" + }, + "decorators": [] + }, + { + "$id": "30", + "kind": "enumvalue", + "name": "setrotationpolicy", + "value": "setrotationpolicy", + "valueType": { + "$ref": "9" + }, + "enumType": { + "$ref": "8" + }, + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "isFixed": false, + "isFlags": false, + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "decorators": [] + }, + { + "$id": "31", + "kind": "enum", + "name": "IdentityAccessSecretPermission", + "crossLanguageDefinitionId": "Microsoft.KeyVault.SecretPermissions", + "valueType": { + "$id": "32", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "33", + "kind": "enumvalue", + "name": "all", + "value": "all", + "valueType": { + "$ref": "32" + }, + "enumType": { + "$ref": "31" + }, + "decorators": [] + }, + { + "$id": "34", + "kind": "enumvalue", + "name": "get", + "value": "get", + "valueType": { + "$ref": "32" + }, + "enumType": { + "$ref": "31" + }, + "decorators": [] + }, + { + "$id": "35", + "kind": "enumvalue", + "name": "list", + "value": "list", + "valueType": { + "$ref": "32" + }, + "enumType": { + "$ref": "31" + }, + "decorators": [] + }, + { + "$id": "36", + "kind": "enumvalue", + "name": "set", + "value": "set", + "valueType": { + "$ref": "32" + }, + "enumType": { + "$ref": "31" + }, + "decorators": [] + }, + { + "$id": "37", + "kind": "enumvalue", + "name": "delete", + "value": "delete", + "valueType": { + "$ref": "32" + }, + "enumType": { + "$ref": "31" + }, + "decorators": [] + }, + { + "$id": "38", + "kind": "enumvalue", + "name": "backup", + "value": "backup", + "valueType": { + "$ref": "32" + }, + "enumType": { + "$ref": "31" + }, + "decorators": [] + }, + { + "$id": "39", + "kind": "enumvalue", + "name": "restore", + "value": "restore", + "valueType": { + "$ref": "32" + }, + "enumType": { + "$ref": "31" + }, + "decorators": [] + }, + { + "$id": "40", + "kind": "enumvalue", + "name": "recover", + "value": "recover", + "valueType": { + "$ref": "32" + }, + "enumType": { + "$ref": "31" + }, + "decorators": [] + }, + { + "$id": "41", + "kind": "enumvalue", + "name": "purge", + "value": "purge", + "valueType": { + "$ref": "32" + }, + "enumType": { + "$ref": "31" + }, + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "isFixed": false, + "isFlags": false, + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "decorators": [] + }, + { + "$id": "42", + "kind": "enum", + "name": "IdentityAccessCertificatePermission", + "crossLanguageDefinitionId": "Microsoft.KeyVault.CertificatePermissions", + "valueType": { + "$id": "43", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "44", + "kind": "enumvalue", + "name": "all", + "value": "all", + "valueType": { + "$ref": "43" + }, + "enumType": { + "$ref": "42" + }, + "decorators": [] + }, + { + "$id": "45", + "kind": "enumvalue", + "name": "get", + "value": "get", + "valueType": { + "$ref": "43" + }, + "enumType": { + "$ref": "42" + }, + "decorators": [] + }, + { + "$id": "46", + "kind": "enumvalue", + "name": "list", + "value": "list", + "valueType": { + "$ref": "43" + }, + "enumType": { + "$ref": "42" + }, + "decorators": [] + }, + { + "$id": "47", + "kind": "enumvalue", + "name": "delete", + "value": "delete", + "valueType": { + "$ref": "43" + }, + "enumType": { + "$ref": "42" + }, + "decorators": [] + }, + { + "$id": "48", + "kind": "enumvalue", + "name": "create", + "value": "create", + "valueType": { + "$ref": "43" + }, + "enumType": { + "$ref": "42" + }, + "decorators": [] + }, + { + "$id": "49", + "kind": "enumvalue", + "name": "import", + "value": "import", + "valueType": { + "$ref": "43" + }, + "enumType": { + "$ref": "42" + }, + "decorators": [] + }, + { + "$id": "50", + "kind": "enumvalue", + "name": "update", + "value": "update", + "valueType": { + "$ref": "43" + }, + "enumType": { + "$ref": "42" + }, + "decorators": [] + }, + { + "$id": "51", + "kind": "enumvalue", + "name": "ManageContacts", + "value": "managecontacts", + "valueType": { + "$ref": "43" + }, + "enumType": { + "$ref": "42" + }, + "decorators": [] + }, + { + "$id": "52", + "kind": "enumvalue", + "name": "GetIssuers", + "value": "getissuers", + "valueType": { + "$ref": "43" + }, + "enumType": { + "$ref": "42" + }, + "decorators": [] + }, + { + "$id": "53", + "kind": "enumvalue", + "name": "ListIssuers", + "value": "listissuers", + "valueType": { + "$ref": "43" + }, + "enumType": { + "$ref": "42" + }, + "decorators": [] + }, + { + "$id": "54", + "kind": "enumvalue", + "name": "SetIssuers", + "value": "setissuers", + "valueType": { + "$ref": "43" + }, + "enumType": { + "$ref": "42" + }, + "decorators": [] + }, + { + "$id": "55", + "kind": "enumvalue", + "name": "DeleteIssuers", + "value": "deleteissuers", + "valueType": { + "$ref": "43" + }, + "enumType": { + "$ref": "42" + }, + "decorators": [] + }, + { + "$id": "56", + "kind": "enumvalue", + "name": "ManageIssuers", + "value": "manageissuers", + "valueType": { + "$ref": "43" + }, + "enumType": { + "$ref": "42" + }, + "decorators": [] + }, + { + "$id": "57", + "kind": "enumvalue", + "name": "recover", + "value": "recover", + "valueType": { + "$ref": "43" + }, + "enumType": { + "$ref": "42" + }, + "decorators": [] + }, + { + "$id": "58", + "kind": "enumvalue", + "name": "purge", + "value": "purge", + "valueType": { + "$ref": "43" + }, + "enumType": { + "$ref": "42" + }, + "decorators": [] + }, + { + "$id": "59", + "kind": "enumvalue", + "name": "backup", + "value": "backup", + "valueType": { + "$ref": "43" + }, + "enumType": { + "$ref": "42" + }, + "decorators": [] + }, + { + "$id": "60", + "kind": "enumvalue", + "name": "restore", + "value": "restore", + "valueType": { + "$ref": "43" + }, + "enumType": { + "$ref": "42" + }, + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "isFixed": false, + "isFlags": false, + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "decorators": [] + }, + { + "$id": "61", + "kind": "enum", + "name": "IdentityAccessStoragePermission", + "crossLanguageDefinitionId": "Microsoft.KeyVault.StoragePermissions", + "valueType": { + "$id": "62", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "63", + "kind": "enumvalue", + "name": "all", + "value": "all", + "valueType": { + "$ref": "62" + }, + "enumType": { + "$ref": "61" + }, + "decorators": [] + }, + { + "$id": "64", + "kind": "enumvalue", + "name": "get", + "value": "get", + "valueType": { + "$ref": "62" + }, + "enumType": { + "$ref": "61" + }, + "decorators": [] + }, + { + "$id": "65", + "kind": "enumvalue", + "name": "list", + "value": "list", + "valueType": { + "$ref": "62" + }, + "enumType": { + "$ref": "61" + }, + "decorators": [] + }, + { + "$id": "66", + "kind": "enumvalue", + "name": "delete", + "value": "delete", + "valueType": { + "$ref": "62" + }, + "enumType": { + "$ref": "61" + }, + "decorators": [] + }, + { + "$id": "67", + "kind": "enumvalue", + "name": "set", + "value": "set", + "valueType": { + "$ref": "62" + }, + "enumType": { + "$ref": "61" + }, + "decorators": [] + }, + { + "$id": "68", + "kind": "enumvalue", + "name": "update", + "value": "update", + "valueType": { + "$ref": "62" + }, + "enumType": { + "$ref": "61" + }, + "decorators": [] + }, + { + "$id": "69", + "kind": "enumvalue", + "name": "RegenerateKey", + "value": "regeneratekey", + "valueType": { + "$ref": "62" + }, + "enumType": { + "$ref": "61" + }, + "decorators": [] + }, + { + "$id": "70", + "kind": "enumvalue", + "name": "recover", + "value": "recover", + "valueType": { + "$ref": "62" + }, + "enumType": { + "$ref": "61" + }, + "decorators": [] + }, + { + "$id": "71", + "kind": "enumvalue", + "name": "purge", + "value": "purge", + "valueType": { + "$ref": "62" + }, + "enumType": { + "$ref": "61" + }, + "decorators": [] + }, + { + "$id": "72", + "kind": "enumvalue", + "name": "backup", + "value": "backup", + "valueType": { + "$ref": "62" + }, + "enumType": { + "$ref": "61" + }, + "decorators": [] + }, + { + "$id": "73", + "kind": "enumvalue", + "name": "restore", + "value": "restore", + "valueType": { + "$ref": "62" + }, + "enumType": { + "$ref": "61" + }, + "decorators": [] + }, + { + "$id": "74", + "kind": "enumvalue", + "name": "SetSas", + "value": "setsas", + "valueType": { + "$ref": "62" + }, + "enumType": { + "$ref": "61" + }, + "decorators": [] + }, + { + "$id": "75", + "kind": "enumvalue", + "name": "ListSas", + "value": "listsas", + "valueType": { + "$ref": "62" + }, + "enumType": { + "$ref": "61" + }, + "decorators": [] + }, + { + "$id": "76", + "kind": "enumvalue", + "name": "GetSas", + "value": "getsas", + "valueType": { + "$ref": "62" + }, + "enumType": { + "$ref": "61" + }, + "decorators": [] + }, + { + "$id": "77", + "kind": "enumvalue", + "name": "DeleteSas", + "value": "deletesas", + "valueType": { + "$ref": "62" + }, + "enumType": { + "$ref": "61" + }, + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "isFixed": false, + "isFlags": false, + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "decorators": [] + }, + { + "$id": "78", + "kind": "enum", + "name": "KeyVaultCreateMode", + "crossLanguageDefinitionId": "Microsoft.KeyVault.KeyVaultCreateMode", + "valueType": { + "$id": "79", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "80", + "kind": "enumvalue", + "name": "default", + "value": "default", + "valueType": { + "$ref": "79" + }, + "enumType": { + "$ref": "78" + }, + "decorators": [] + }, + { + "$id": "81", + "kind": "enumvalue", + "name": "recover", + "value": "recover", + "valueType": { + "$ref": "79" + }, + "enumType": { + "$ref": "78" + }, + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "doc": "The vault's create mode to indicate whether the vault need to be recovered or not.", + "isFixed": true, + "isFlags": false, + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "decorators": [] + }, + { + "$id": "82", + "kind": "enum", + "name": "KeyVaultNetworkRuleBypassOption", + "crossLanguageDefinitionId": "Microsoft.KeyVault.KeyVaultNetworkRuleBypassOption", + "valueType": { + "$id": "83", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "84", + "kind": "enumvalue", + "name": "AzureServices", + "value": "AzureServices", + "valueType": { + "$ref": "83" + }, + "enumType": { + "$ref": "82" + }, + "decorators": [] + }, + { + "$id": "85", + "kind": "enumvalue", + "name": "None", + "value": "None", + "valueType": { + "$ref": "83" + }, + "enumType": { + "$ref": "82" + }, + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "doc": "Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'.", + "isFixed": false, + "isFlags": false, + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "decorators": [] + }, + { + "$id": "86", + "kind": "enum", + "name": "KeyVaultNetworkRuleAction", + "crossLanguageDefinitionId": "Microsoft.KeyVault.KeyVaultNetworkRuleAction", + "valueType": { + "$id": "87", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "88", + "kind": "enumvalue", + "name": "Allow", + "value": "Allow", + "valueType": { + "$ref": "87" + }, + "enumType": { + "$ref": "86" + }, + "decorators": [] + }, + { + "$id": "89", + "kind": "enumvalue", + "name": "Deny", + "value": "Deny", + "valueType": { + "$ref": "87" + }, + "enumType": { + "$ref": "86" + }, + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "doc": "The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated.", + "isFixed": false, + "isFlags": false, + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "decorators": [] + }, + { + "$id": "90", + "kind": "enum", + "name": "KeyVaultProvisioningState", + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultProvisioningState", + "valueType": { + "$id": "91", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "92", + "kind": "enumvalue", + "name": "Succeeded", + "value": "Succeeded", + "valueType": { + "$ref": "91" + }, + "enumType": { + "$ref": "90" + }, + "decorators": [] + }, + { + "$id": "93", + "kind": "enumvalue", + "name": "RegisteringDns", + "value": "RegisteringDns", + "valueType": { + "$ref": "91" + }, + "enumType": { + "$ref": "90" + }, + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "doc": "Provisioning state of the vault.", + "isFixed": false, + "isFlags": false, + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "decorators": [] + }, + { + "$id": "94", + "kind": "enum", + "name": "PrivateEndpointServiceConnectionStatus", + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointServiceConnectionStatus", + "valueType": { + "$id": "95", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "96", + "kind": "enumvalue", + "name": "Pending", + "value": "Pending", + "valueType": { + "$ref": "95" + }, + "enumType": { + "$ref": "94" + }, + "decorators": [] + }, + { + "$id": "97", + "kind": "enumvalue", + "name": "Approved", + "value": "Approved", + "valueType": { + "$ref": "95" + }, + "enumType": { + "$ref": "94" + }, + "decorators": [] + }, + { + "$id": "98", + "kind": "enumvalue", + "name": "Rejected", + "value": "Rejected", + "valueType": { + "$ref": "95" + }, + "enumType": { + "$ref": "94" + }, + "decorators": [] + }, + { + "$id": "99", + "kind": "enumvalue", + "name": "Disconnected", + "value": "Disconnected", + "valueType": { + "$ref": "95" + }, + "enumType": { + "$ref": "94" + }, + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "doc": "The private endpoint connection status.", + "isFixed": false, + "isFlags": false, + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "decorators": [] + }, + { + "$id": "100", + "kind": "enum", + "name": "KeyVaultActionsRequiredMessage", + "crossLanguageDefinitionId": "Microsoft.KeyVault.KeyVaultActionsRequiredMessage", + "valueType": { + "$id": "101", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "102", + "kind": "enumvalue", + "name": "None", + "value": "None", + "valueType": { + "$ref": "101" + }, + "enumType": { + "$ref": "100" + }, + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "doc": "A message indicating if changes on the service provider require any updates on the consumer.", + "isFixed": false, + "isFlags": false, + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "decorators": [] + }, + { + "$id": "103", + "kind": "enum", + "name": "PrivateEndpointConnectionProvisioningState", + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnectionProvisioningState", + "valueType": { + "$id": "104", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "105", + "kind": "enumvalue", + "name": "Succeeded", + "value": "Succeeded", + "valueType": { + "$ref": "104" + }, + "enumType": { + "$ref": "103" + }, + "decorators": [] + }, + { + "$id": "106", + "kind": "enumvalue", + "name": "Creating", + "value": "Creating", + "valueType": { + "$ref": "104" + }, + "enumType": { + "$ref": "103" + }, + "decorators": [] + }, + { + "$id": "107", + "kind": "enumvalue", + "name": "Updating", + "value": "Updating", + "valueType": { + "$ref": "104" + }, + "enumType": { + "$ref": "103" + }, + "decorators": [] + }, + { + "$id": "108", + "kind": "enumvalue", + "name": "Deleting", + "value": "Deleting", + "valueType": { + "$ref": "104" + }, + "enumType": { + "$ref": "103" + }, + "decorators": [] + }, + { + "$id": "109", + "kind": "enumvalue", + "name": "Failed", + "value": "Failed", + "valueType": { + "$ref": "104" + }, + "enumType": { + "$ref": "103" + }, + "decorators": [] + }, + { + "$id": "110", + "kind": "enumvalue", + "name": "Disconnected", + "value": "Disconnected", + "valueType": { + "$ref": "104" + }, + "enumType": { + "$ref": "103" + }, + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "doc": "The current provisioning state.", + "isFixed": false, + "isFlags": false, + "usage": "Output,Json,LroInitial,LroFinalEnvelope", + "decorators": [] + }, + { + "$id": "111", + "kind": "enum", + "name": "createdByType", + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.createdByType", + "valueType": { + "$id": "112", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "113", + "kind": "enumvalue", + "name": "User", + "value": "User", + "valueType": { + "$ref": "112" + }, + "enumType": { + "$ref": "111" + }, + "doc": "The entity was created by a user.", + "decorators": [] + }, + { + "$id": "114", + "kind": "enumvalue", + "name": "Application", + "value": "Application", + "valueType": { + "$ref": "112" + }, + "enumType": { + "$ref": "111" + }, + "doc": "The entity was created by an application.", + "decorators": [] + }, + { + "$id": "115", + "kind": "enumvalue", + "name": "ManagedIdentity", + "value": "ManagedIdentity", + "valueType": { + "$ref": "112" + }, + "enumType": { + "$ref": "111" + }, + "doc": "The entity was created by a managed identity.", + "decorators": [] + }, + { + "$id": "116", + "kind": "enumvalue", + "name": "Key", + "value": "Key", + "valueType": { + "$ref": "112" + }, + "enumType": { + "$ref": "111" + }, + "doc": "The entity was created by a key.", + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "doc": "The kind of entity that created the resource.", + "isFixed": false, + "isFlags": false, + "usage": "Output,Json,LroInitial,LroFinalEnvelope", + "decorators": [] + }, + { + "$id": "117", + "kind": "enum", + "name": "ResourceProvisioningState", + "crossLanguageDefinitionId": "Azure.ResourceManager.ResourceProvisioningState", + "valueType": { + "$id": "118", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "119", + "kind": "enumvalue", + "name": "Succeeded", + "value": "Succeeded", + "valueType": { + "$ref": "118" + }, + "enumType": { + "$ref": "117" + }, + "doc": "Resource has been created.", + "decorators": [] + }, + { + "$id": "120", + "kind": "enumvalue", + "name": "Failed", + "value": "Failed", + "valueType": { + "$ref": "118" + }, + "enumType": { + "$ref": "117" + }, + "doc": "Resource creation failed.", + "decorators": [] + }, + { + "$id": "121", + "kind": "enumvalue", + "name": "Canceled", + "value": "Canceled", + "valueType": { + "$ref": "118" + }, + "enumType": { + "$ref": "117" + }, + "doc": "Resource creation was canceled.", + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "doc": "The provisioning state of a resource type.", + "isFixed": false, + "isFlags": false, + "usage": "LroPolling", + "decorators": [] + }, + { + "$id": "122", + "kind": "enum", + "name": "KeyVaultPatchMode", + "crossLanguageDefinitionId": "Microsoft.KeyVault.KeyVaultPatchMode", + "valueType": { + "$id": "123", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "124", + "kind": "enumvalue", + "name": "default", + "value": "default", + "valueType": { + "$ref": "123" + }, + "enumType": { + "$ref": "122" + }, + "decorators": [] + }, + { + "$id": "125", + "kind": "enumvalue", + "name": "recover", + "value": "recover", + "valueType": { + "$ref": "123" + }, + "enumType": { + "$ref": "122" + }, + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "doc": "The vault's create mode to indicate whether the vault need to be recovered or not.", + "isFixed": true, + "isFlags": false, + "usage": "Input,Json", + "decorators": [] + }, + { + "$id": "126", + "kind": "enum", + "name": "ManagedHsmCreateMode", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmCreateMode", + "valueType": { + "$id": "127", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "128", + "kind": "enumvalue", + "name": "default", + "value": "default", + "valueType": { + "$ref": "127" + }, + "enumType": { + "$ref": "126" + }, + "decorators": [] + }, + { + "$id": "129", + "kind": "enumvalue", + "name": "recover", + "value": "recover", + "valueType": { + "$ref": "127" + }, + "enumType": { + "$ref": "126" + }, + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "doc": "The create mode to indicate whether the resource is being created or is being recovered from a deleted resource.", + "isFixed": true, + "isFlags": false, + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "decorators": [] + }, + { + "$id": "130", + "kind": "enum", + "name": "ManagedHsmProvisioningState", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ProvisioningState", + "valueType": { + "$id": "131", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "132", + "kind": "enumvalue", + "name": "Succeeded", + "value": "Succeeded", + "valueType": { + "$ref": "131" + }, + "enumType": { + "$ref": "130" + }, + "doc": "The managed HSM Pool has been full provisioned.", + "decorators": [] + }, + { + "$id": "133", + "kind": "enumvalue", + "name": "Provisioning", + "value": "Provisioning", + "valueType": { + "$ref": "131" + }, + "enumType": { + "$ref": "130" + }, + "doc": "The managed HSM Pool is currently being provisioned.", + "decorators": [] + }, + { + "$id": "134", + "kind": "enumvalue", + "name": "Failed", + "value": "Failed", + "valueType": { + "$ref": "131" + }, + "enumType": { + "$ref": "130" + }, + "doc": "Provisioning of the managed HSM Pool has failed.", + "decorators": [] + }, + { + "$id": "135", + "kind": "enumvalue", + "name": "Updating", + "value": "Updating", + "valueType": { + "$ref": "131" + }, + "enumType": { + "$ref": "130" + }, + "doc": "The managed HSM Pool is currently being updated.", + "decorators": [] + }, + { + "$id": "136", + "kind": "enumvalue", + "name": "Deleting", + "value": "Deleting", + "valueType": { + "$ref": "131" + }, + "enumType": { + "$ref": "130" + }, + "doc": "The managed HSM Pool is currently being deleted.", + "decorators": [] + }, + { + "$id": "137", + "kind": "enumvalue", + "name": "Activated", + "value": "Activated", + "valueType": { + "$ref": "131" + }, + "enumType": { + "$ref": "130" + }, + "doc": "The managed HSM pool is ready for normal use.", + "decorators": [] + }, + { + "$id": "138", + "kind": "enumvalue", + "name": "SecurityDomainRestore", + "value": "SecurityDomainRestore", + "valueType": { + "$ref": "131" + }, + "enumType": { + "$ref": "130" + }, + "doc": "The managed HSM pool is waiting for a security domain restore action.", + "decorators": [] + }, + { + "$id": "139", + "kind": "enumvalue", + "name": "Restoring", + "value": "Restoring", + "valueType": { + "$ref": "131" + }, + "enumType": { + "$ref": "130" + }, + "doc": "The managed HSM pool is being restored from full HSM backup.", + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "doc": "Provisioning state.", + "isFixed": false, + "isFlags": false, + "usage": "Output,Json,LroInitial,LroFinalEnvelope", + "decorators": [] + }, + { + "$id": "140", + "kind": "enum", + "name": "ManagedHsmNetworkRuleBypassOption", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmNetworkRuleBypassOption", + "valueType": { + "$id": "141", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "142", + "kind": "enumvalue", + "name": "AzureServices", + "value": "AzureServices", + "valueType": { + "$ref": "141" + }, + "enumType": { + "$ref": "140" + }, + "decorators": [] + }, + { + "$id": "143", + "kind": "enumvalue", + "name": "None", + "value": "None", + "valueType": { + "$ref": "141" + }, + "enumType": { + "$ref": "140" + }, + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "doc": "Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'.", + "isFixed": false, + "isFlags": false, + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "decorators": [] + }, + { + "$id": "144", + "kind": "enum", + "name": "ManagedHsmNetworkRuleAction", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmNetworkRuleAction", + "valueType": { + "$id": "145", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "146", + "kind": "enumvalue", + "name": "Allow", + "value": "Allow", + "valueType": { + "$ref": "145" + }, + "enumType": { + "$ref": "144" + }, + "decorators": [] + }, + { + "$id": "147", + "kind": "enumvalue", + "name": "Deny", + "value": "Deny", + "valueType": { + "$ref": "145" + }, + "enumType": { + "$ref": "144" + }, + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "doc": "The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated.", + "isFixed": false, + "isFlags": false, + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "decorators": [] + }, + { + "$id": "148", + "kind": "enum", + "name": "ManagedHsmGeoReplicatedRegionProvisioningState", + "crossLanguageDefinitionId": "Microsoft.KeyVault.GeoReplicationRegionProvisioningState", + "valueType": { + "$id": "149", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "150", + "kind": "enumvalue", + "name": "Preprovisioning", + "value": "Preprovisioning", + "valueType": { + "$ref": "149" + }, + "enumType": { + "$ref": "148" + }, + "decorators": [] + }, + { + "$id": "151", + "kind": "enumvalue", + "name": "Provisioning", + "value": "Provisioning", + "valueType": { + "$ref": "149" + }, + "enumType": { + "$ref": "148" + }, + "decorators": [] + }, + { + "$id": "152", + "kind": "enumvalue", + "name": "Succeeded", + "value": "Succeeded", + "valueType": { + "$ref": "149" + }, + "enumType": { + "$ref": "148" + }, + "decorators": [] + }, + { + "$id": "153", + "kind": "enumvalue", + "name": "Failed", + "value": "Failed", + "valueType": { + "$ref": "149" + }, + "enumType": { + "$ref": "148" + }, + "decorators": [] + }, + { + "$id": "154", + "kind": "enumvalue", + "name": "Deleting", + "value": "Deleting", + "valueType": { + "$ref": "149" + }, + "enumType": { + "$ref": "148" + }, + "decorators": [] + }, + { + "$id": "155", + "kind": "enumvalue", + "name": "Cleanup", + "value": "Cleanup", + "valueType": { + "$ref": "149" + }, + "enumType": { + "$ref": "148" + }, + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "doc": "The current provisioning state.", + "isFixed": false, + "isFlags": false, + "usage": "Output,Json,LroInitial,LroFinalEnvelope", + "decorators": [] + }, + { + "$id": "156", + "kind": "enum", + "name": "ManagedHsmPrivateEndpointServiceConnectionStatus", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmPrivateEndpointServiceConnectionStatus", + "valueType": { + "$id": "157", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "158", + "kind": "enumvalue", + "name": "Pending", + "value": "Pending", + "valueType": { + "$ref": "157" + }, + "enumType": { + "$ref": "156" + }, + "decorators": [] + }, + { + "$id": "159", + "kind": "enumvalue", + "name": "Approved", + "value": "Approved", + "valueType": { + "$ref": "157" + }, + "enumType": { + "$ref": "156" + }, + "decorators": [] + }, + { + "$id": "160", + "kind": "enumvalue", + "name": "Rejected", + "value": "Rejected", + "valueType": { + "$ref": "157" + }, + "enumType": { + "$ref": "156" + }, + "decorators": [] + }, + { + "$id": "161", + "kind": "enumvalue", + "name": "Disconnected", + "value": "Disconnected", + "valueType": { + "$ref": "157" + }, + "enumType": { + "$ref": "156" + }, + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "doc": "The private endpoint connection status.", + "isFixed": false, + "isFlags": false, + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "decorators": [] + }, + { + "$id": "162", + "kind": "enum", + "name": "ManagedHsmActionsRequiredMessage", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmActionsRequiredMessage", + "valueType": { + "$id": "163", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "164", + "kind": "enumvalue", + "name": "None", + "value": "None", + "valueType": { + "$ref": "163" + }, + "enumType": { + "$ref": "162" + }, + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "doc": "A message indicating if changes on the service provider require any updates on the consumer.", + "isFixed": false, + "isFlags": false, + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "decorators": [] + }, + { + "$id": "165", + "kind": "enum", + "name": "ManagedHsmPrivateEndpointConnectionProvisioningState", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmPrivateEndpointConnectionProvisioningState", + "valueType": { + "$id": "166", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "167", + "kind": "enumvalue", + "name": "Succeeded", + "value": "Succeeded", + "valueType": { + "$ref": "166" + }, + "enumType": { + "$ref": "165" + }, + "decorators": [] + }, + { + "$id": "168", + "kind": "enumvalue", + "name": "Creating", + "value": "Creating", + "valueType": { + "$ref": "166" + }, + "enumType": { + "$ref": "165" + }, + "decorators": [] + }, + { + "$id": "169", + "kind": "enumvalue", + "name": "Updating", + "value": "Updating", + "valueType": { + "$ref": "166" + }, + "enumType": { + "$ref": "165" + }, + "decorators": [] + }, + { + "$id": "170", + "kind": "enumvalue", + "name": "Deleting", + "value": "Deleting", + "valueType": { + "$ref": "166" + }, + "enumType": { + "$ref": "165" + }, + "decorators": [] + }, + { + "$id": "171", + "kind": "enumvalue", + "name": "Failed", + "value": "Failed", + "valueType": { + "$ref": "166" + }, + "enumType": { + "$ref": "165" + }, + "decorators": [] + }, + { + "$id": "172", + "kind": "enumvalue", + "name": "Disconnected", + "value": "Disconnected", + "valueType": { + "$ref": "166" + }, + "enumType": { + "$ref": "165" + }, + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "doc": "The current provisioning state.", + "isFixed": false, + "isFlags": false, + "usage": "Output,Json,LroInitial,LroFinalEnvelope", + "decorators": [] + }, + { + "$id": "173", + "kind": "enum", + "name": "ManagedHsmPublicNetworkAccess", + "crossLanguageDefinitionId": "Microsoft.KeyVault.PublicNetworkAccess", + "valueType": { + "$id": "174", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "175", + "kind": "enumvalue", + "name": "Enabled", + "value": "Enabled", + "valueType": { + "$ref": "174" + }, + "enumType": { + "$ref": "173" + }, + "decorators": [] + }, + { + "$id": "176", + "kind": "enumvalue", + "name": "Disabled", + "value": "Disabled", + "valueType": { + "$ref": "174" + }, + "enumType": { + "$ref": "173" + }, + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "doc": "Control permission to the managed HSM from public networks.", + "isFixed": false, + "isFlags": false, + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "decorators": [] + }, + { + "$id": "177", + "kind": "enum", + "name": "ManagedHSMSecurityDomainActivationStatus", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ActivationStatus", + "valueType": { + "$id": "178", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "179", + "kind": "enumvalue", + "name": "Active", + "value": "Active", + "valueType": { + "$ref": "178" + }, + "enumType": { + "$ref": "177" + }, + "doc": "The managed HSM Pool is active.", + "decorators": [] + }, + { + "$id": "180", + "kind": "enumvalue", + "name": "NotActivated", + "value": "NotActivated", + "valueType": { + "$ref": "178" + }, + "enumType": { + "$ref": "177" + }, + "doc": "The managed HSM Pool is not yet activated.", + "decorators": [] + }, + { + "$id": "181", + "kind": "enumvalue", + "name": "Unknown", + "value": "Unknown", + "valueType": { + "$ref": "178" + }, + "enumType": { + "$ref": "177" + }, + "doc": "An unknown error occurred while activating managed hsm.", + "decorators": [] + }, + { + "$id": "182", + "kind": "enumvalue", + "name": "Failed", + "value": "Failed", + "valueType": { + "$ref": "178" + }, + "enumType": { + "$ref": "177" + }, + "doc": "Failed to activate managed hsm.", + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "doc": "Activation Status", + "isFixed": false, + "isFlags": false, + "usage": "Output,Json,LroInitial,LroFinalEnvelope", + "decorators": [] + }, + { + "$id": "183", + "kind": "enum", + "name": "ManagedHsmSkuFamily", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmSkuFamily", + "valueType": { + "$id": "184", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "185", + "kind": "enumvalue", + "name": "B", + "value": "B", + "valueType": { + "$ref": "184" + }, + "enumType": { + "$ref": "183" + }, + "decorators": [] + }, + { + "$id": "186", + "kind": "enumvalue", + "name": "C", + "value": "C", + "valueType": { + "$ref": "184" + }, + "enumType": { + "$ref": "183" + }, + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "doc": "SKU Family of the managed HSM Pool", + "isFixed": false, + "isFlags": false, + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "decorators": [] + }, + { + "$id": "187", + "kind": "enum", + "name": "ManagedHsmSkuName", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmSkuName", + "valueType": { + "$id": "188", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "189", + "kind": "enumvalue", + "name": "Standard_B1", + "value": "Standard_B1", + "valueType": { + "$ref": "188" + }, + "enumType": { + "$ref": "187" + }, + "decorators": [] + }, + { + "$id": "190", + "kind": "enumvalue", + "name": "Custom_B32", + "value": "Custom_B32", + "valueType": { + "$ref": "188" + }, + "enumType": { + "$ref": "187" + }, + "decorators": [] + }, + { + "$id": "191", + "kind": "enumvalue", + "name": "Custom_B6", + "value": "Custom_B6", + "valueType": { + "$ref": "188" + }, + "enumType": { + "$ref": "187" + }, + "decorators": [] + }, + { + "$id": "192", + "kind": "enumvalue", + "name": "Custom_C42", + "value": "Custom_C42", + "valueType": { + "$ref": "188" + }, + "enumType": { + "$ref": "187" + }, + "decorators": [] + }, + { + "$id": "193", + "kind": "enumvalue", + "name": "Custom_C10", + "value": "Custom_C10", + "valueType": { + "$ref": "188" + }, + "enumType": { + "$ref": "187" + }, + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "doc": "SKU of the managed HSM Pool", + "isFixed": true, + "isFlags": false, + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "decorators": [] + }, + { + "$id": "194", + "kind": "enum", + "name": "ManagedServiceIdentityType", + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType", + "valueType": { + "$id": "195", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "196", + "kind": "enumvalue", + "name": "None", + "value": "None", + "valueType": { + "$ref": "195" + }, + "enumType": { + "$ref": "194" + }, + "doc": "No managed identity.", + "decorators": [] + }, + { + "$id": "197", + "kind": "enumvalue", + "name": "SystemAssigned", + "value": "SystemAssigned", + "valueType": { + "$ref": "195" + }, + "enumType": { + "$ref": "194" + }, + "doc": "System assigned managed identity.", + "decorators": [] + }, + { + "$id": "198", + "kind": "enumvalue", + "name": "UserAssigned", + "value": "UserAssigned", + "valueType": { + "$ref": "195" + }, + "enumType": { + "$ref": "194" + }, + "doc": "User assigned managed identity.", + "decorators": [] + }, + { + "$id": "199", + "kind": "enumvalue", + "name": "SystemAssigned,UserAssigned", + "value": "SystemAssigned,UserAssigned", + "valueType": { + "$ref": "195" + }, + "enumType": { + "$ref": "194" + }, + "doc": "System and user assigned managed identity.", + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "doc": "Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).", + "isFixed": false, + "isFlags": false, + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "decorators": [] + }, + { + "$id": "200", + "kind": "enum", + "name": "KeyVaultNameUnavailableReason", + "crossLanguageDefinitionId": "Microsoft.KeyVault.KeyVaultNameUnavailableReason", + "valueType": { + "$id": "201", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "202", + "kind": "enumvalue", + "name": "AccountNameInvalid", + "value": "AccountNameInvalid", + "valueType": { + "$ref": "201" + }, + "enumType": { + "$ref": "200" + }, + "decorators": [] + }, + { + "$id": "203", + "kind": "enumvalue", + "name": "AlreadyExists", + "value": "AlreadyExists", + "valueType": { + "$ref": "201" + }, + "enumType": { + "$ref": "200" + }, + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "doc": "The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false.", + "isFixed": true, + "isFlags": false, + "usage": "Output,Json", + "decorators": [] + }, + { + "$id": "204", + "kind": "enum", + "name": "ManagedHsmNameUnavailableReason", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmNameUnavailableReason", + "valueType": { + "$id": "205", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "206", + "kind": "enumvalue", + "name": "AccountNameInvalid", + "value": "AccountNameInvalid", + "valueType": { + "$ref": "205" + }, + "enumType": { + "$ref": "204" + }, + "decorators": [] + }, + { + "$id": "207", + "kind": "enumvalue", + "name": "AlreadyExists", + "value": "AlreadyExists", + "valueType": { + "$ref": "205" + }, + "enumType": { + "$ref": "204" + }, + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "doc": "The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false.", + "isFixed": false, + "isFlags": false, + "usage": "Output,Json", + "decorators": [] + }, + { + "$id": "208", + "kind": "enum", + "name": "AccessPolicyUpdateKind", + "crossLanguageDefinitionId": "Microsoft.KeyVault.AccessPolicyUpdateKind", + "valueType": { + "$id": "209", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "210", + "kind": "enumvalue", + "name": "add", + "value": "add", + "valueType": { + "$ref": "209" + }, + "enumType": { + "$ref": "208" + }, + "decorators": [] + }, + { + "$id": "211", + "kind": "enumvalue", + "name": "replace", + "value": "replace", + "valueType": { + "$ref": "209" + }, + "enumType": { + "$ref": "208" + }, + "decorators": [] + }, + { + "$id": "212", + "kind": "enumvalue", + "name": "remove", + "value": "remove", + "valueType": { + "$ref": "209" + }, + "enumType": { + "$ref": "208" + }, + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "isFixed": true, + "isFlags": false, + "usage": "Input", + "decorators": [] + }, + { + "$id": "213", + "kind": "enum", + "name": "Versions", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Versions", + "valueType": { + "$id": "214", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "215", + "kind": "enumvalue", + "name": "v2025_05_01", + "value": "2025-05-01", + "valueType": { + "$ref": "214" + }, + "enumType": { + "$ref": "213" + }, + "doc": "The 2025-05-01 API version.", + "decorators": [] + } + ], + "namespace": "Azure.ResourceManager.KeyVault", + "doc": "The available API versions.", + "isFixed": true, + "isFlags": false, + "usage": "ApiVersionEnum", + "decorators": [] + } + ], + "constants": [ + { + "$id": "216", + "kind": "constant", + "name": "getContentType", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "217", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "218", + "kind": "constant", + "name": "createOrUpdateContentType", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "219", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "220", + "kind": "constant", + "name": "createOrUpdateContentType1", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "221", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "222", + "kind": "constant", + "name": "createOrUpdateContentType2", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "223", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "224", + "kind": "constant", + "name": "createOrUpdateContentType3", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "225", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "226", + "kind": "constant", + "name": "updateContentType", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "227", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "228", + "kind": "constant", + "name": "updateContentType1", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "229", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "230", + "kind": "constant", + "name": "listByResourceGroupContentType", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "231", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "232", + "kind": "constant", + "name": "listBySubscriptionContentType", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "233", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "234", + "kind": "constant", + "name": "updateAccessPolicyContentType", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "235", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "236", + "kind": "constant", + "name": "updateAccessPolicyContentType1", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "237", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "238", + "kind": "constant", + "name": "listByVaultContentType", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "239", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "240", + "kind": "constant", + "name": "getDeletedContentType", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "241", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "242", + "kind": "constant", + "name": "getContentType1", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "243", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "244", + "kind": "constant", + "name": "putContentType", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "245", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "246", + "kind": "constant", + "name": "putContentType1", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "247", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "248", + "kind": "constant", + "name": "deleteContentType", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "249", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "250", + "kind": "constant", + "name": "deleteContentType1", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "251", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "252", + "kind": "constant", + "name": "listByResourceContentType", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "253", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "254", + "kind": "constant", + "name": "getContentType2", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "255", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "256", + "kind": "constant", + "name": "createOrUpdateContentType4", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "257", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "258", + "kind": "constant", + "name": "createOrUpdateContentType5", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "259", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "260", + "kind": "constant", + "name": "createOrUpdateContentType6", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "261", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "262", + "kind": "constant", + "name": "createOrUpdateContentType7", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "263", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "264", + "kind": "constant", + "name": "updateContentType2", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "265", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "266", + "kind": "constant", + "name": "updateContentType3", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "267", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "268", + "kind": "constant", + "name": "updateContentType4", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "269", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "270", + "kind": "constant", + "name": "updateContentType5", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "271", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "272", + "kind": "constant", + "name": "listByResourceGroupContentType1", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "273", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "274", + "kind": "constant", + "name": "listBySubscriptionContentType1", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "275", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "276", + "kind": "constant", + "name": "listByMHSMResourceContentType", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "277", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "278", + "kind": "constant", + "name": "listByResourceContentType1", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "279", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "280", + "kind": "constant", + "name": "getDeletedContentType1", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "281", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "282", + "kind": "constant", + "name": "getContentType3", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "283", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "284", + "kind": "constant", + "name": "putContentType2", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "285", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "286", + "kind": "constant", + "name": "putContentType3", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "287", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "288", + "kind": "constant", + "name": "deleteContentType2", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "289", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "290", + "kind": "constant", + "name": "deleteContentType3", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "291", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "292", + "kind": "constant", + "name": "listByResourceContentType2", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "293", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "294", + "kind": "constant", + "name": "getContentType4", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "295", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "296", + "kind": "constant", + "name": "createOrUpdateContentType8", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "297", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "298", + "kind": "constant", + "name": "createOrUpdateContentType9", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "299", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "300", + "kind": "constant", + "name": "updateContentType6", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "301", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "302", + "kind": "constant", + "name": "updateContentType7", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "303", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "304", + "kind": "constant", + "name": "listContentType", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "305", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "306", + "kind": "constant", + "name": "listDeletedContentType", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "307", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "308", + "kind": "constant", + "name": "checkNameAvailabilityContentType", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "309", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "310", + "kind": "constant", + "name": "checkNameAvailabilityContentType1", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "311", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "312", + "kind": "constant", + "name": "listDeletedContentType1", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "313", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "314", + "kind": "constant", + "name": "checkMhsmNameAvailabilityContentType", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "315", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "316", + "kind": "constant", + "name": "checkMhsmNameAvailabilityContentType1", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "317", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + } + ], + "models": [ + { + "$id": "318", + "kind": "model", + "name": "KeyVault", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vault", + "usage": "Output,Json,LroInitial,LroFinalEnvelope", + "doc": "Resource information with extended details.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + }, + { + "name": "Azure.ResourceManager.Private.@armResourceInternal", + "arguments": {} + }, + { + "name": "Azure.ClientGenerator.Core.@resourceSchema", + "arguments": { + "resourceIdPattern": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}", + "resourceType": "Microsoft.KeyVault/vaults", + "methods": [ + { + "$id": "319", + "methodId": "Microsoft.KeyVault.Vaults.get", + "kind": "Get", + "operationPath": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}", + "operationScope": "ResourceGroup", + "resourceScope": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}" + }, + { + "$id": "320", + "methodId": "Microsoft.KeyVault.Vaults.createOrUpdate", + "kind": "Create", + "operationPath": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}", + "operationScope": "ResourceGroup", + "resourceScope": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}" + }, + { + "$id": "321", + "methodId": "Microsoft.KeyVault.Vaults.update", + "kind": "Update", + "operationPath": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}", + "operationScope": "ResourceGroup", + "resourceScope": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}" + }, + { + "$id": "322", + "methodId": "Microsoft.KeyVault.Vaults.delete", + "kind": "Delete", + "operationPath": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}", + "operationScope": "ResourceGroup", + "resourceScope": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}" + }, + { + "$id": "323", + "methodId": "Microsoft.KeyVault.Vaults.listByResourceGroup", + "kind": "List", + "operationPath": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults", + "operationScope": "ResourceGroup" + }, + { + "$id": "324", + "methodId": "Microsoft.KeyVault.Vaults.listBySubscription", + "kind": "List", + "operationPath": "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults", + "operationScope": "Subscription" + }, + { + "$id": "325", + "methodId": "Microsoft.KeyVault.Vaults.listByVault", + "kind": "Action", + "operationPath": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources", + "operationScope": "ResourceGroup", + "resourceScope": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}" + } + ], + "resourceScope": "ResourceGroup", + "resourceName": "KeyVault" + } + } + ], + "baseModel": { + "$id": "326", + "kind": "model", + "name": "Resource", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.Resource", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "Common fields that are returned in the response for all Azure Resource Manager resources", + "summary": "Resource", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "327", + "kind": "property", + "name": "id", + "serializedName": "id", + "doc": "Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}", + "type": { + "$id": "328", + "kind": "string", + "name": "armResourceIdentifier", + "crossLanguageDefinitionId": "Azure.Core.armResourceIdentifier", + "baseType": { + "$id": "329", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.Resource.id", + "serializationOptions": { + "json": { + "name": "id" + } + }, + "isHttpMetadata": false + }, + { + "$id": "330", + "kind": "property", + "name": "name", + "serializedName": "name", + "doc": "The name of the resource", + "type": { + "$id": "331", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.Resource.name", + "serializationOptions": { + "json": { + "name": "name" + } + }, + "isHttpMetadata": false + }, + { + "$id": "332", + "kind": "property", + "name": "type", + "serializedName": "type", + "doc": "The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\"", + "type": { + "$id": "333", + "kind": "string", + "name": "armResourceType", + "crossLanguageDefinitionId": "Azure.Core.armResourceType", + "baseType": { + "$id": "334", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.Resource.type", + "serializationOptions": { + "json": { + "name": "type" + } + }, + "isHttpMetadata": false + }, + { + "$id": "335", + "kind": "property", + "name": "systemData", + "serializedName": "systemData", + "doc": "Azure Resource Manager metadata containing createdBy and modifiedBy information.", + "type": { + "$id": "336", + "kind": "model", + "name": "SystemData", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.SystemData", + "usage": "Output,Json,LroInitial,LroFinalEnvelope", + "doc": "Metadata pertaining to creation and last modification of the resource.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "337", + "kind": "property", + "name": "createdBy", + "serializedName": "createdBy", + "doc": "The identity that created the resource.", + "type": { + "$id": "338", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.SystemData.createdBy", + "serializationOptions": { + "json": { + "name": "createdBy" + } + }, + "isHttpMetadata": false + }, + { + "$id": "339", + "kind": "property", + "name": "createdByType", + "serializedName": "createdByType", + "doc": "The type of identity that created the resource.", + "type": { + "$ref": "111" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.SystemData.createdByType", + "serializationOptions": { + "json": { + "name": "createdByType" + } + }, + "isHttpMetadata": false + }, + { + "$id": "340", + "kind": "property", + "name": "createdAt", + "serializedName": "createdAt", + "doc": "The timestamp of resource creation (UTC).", + "type": { + "$id": "341", + "kind": "utcDateTime", + "name": "utcDateTime", + "encode": "rfc3339", + "wireType": { + "$id": "342", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.utcDateTime", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.SystemData.createdAt", + "serializationOptions": { + "json": { + "name": "createdAt" + } + }, + "isHttpMetadata": false + }, + { + "$id": "343", + "kind": "property", + "name": "lastModifiedBy", + "serializedName": "lastModifiedBy", + "doc": "The identity that last modified the resource.", + "type": { + "$id": "344", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.SystemData.lastModifiedBy", + "serializationOptions": { + "json": { + "name": "lastModifiedBy" + } + }, + "isHttpMetadata": false + }, + { + "$id": "345", + "kind": "property", + "name": "lastModifiedByType", + "serializedName": "lastModifiedByType", + "doc": "The type of identity that last modified the resource.", + "type": { + "$ref": "111" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.SystemData.lastModifiedByType", + "serializationOptions": { + "json": { + "name": "lastModifiedByType" + } + }, + "isHttpMetadata": false + }, + { + "$id": "346", + "kind": "property", + "name": "lastModifiedAt", + "serializedName": "lastModifiedAt", + "doc": "The timestamp of resource last modification (UTC)", + "type": { + "$id": "347", + "kind": "utcDateTime", + "name": "utcDateTime", + "encode": "rfc3339", + "wireType": { + "$id": "348", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.utcDateTime", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.SystemData.lastModifiedAt", + "serializationOptions": { + "json": { + "name": "lastModifiedAt" + } + }, + "isHttpMetadata": false + } + ] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.Resource.systemData", + "serializationOptions": { + "json": { + "name": "systemData" + } + }, + "isHttpMetadata": false + } + ] + }, + "properties": [ + { + "$id": "349", + "kind": "property", + "name": "properties", + "serializedName": "properties", + "doc": "Properties of the vault", + "type": { + "$id": "350", + "kind": "model", + "name": "KeyVaultProperties", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultProperties", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "Properties of the vault", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "351", + "kind": "property", + "name": "tenantId", + "serializedName": "tenantId", + "doc": "The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault.", + "type": { + "$id": "352", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "353", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultProperties.tenantId", + "serializationOptions": { + "json": { + "name": "tenantId" + } + }, + "isHttpMetadata": false + }, + { + "$id": "354", + "kind": "property", + "name": "sku", + "serializedName": "sku", + "doc": "SKU details", + "type": { + "$id": "355", + "kind": "model", + "name": "Sku", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Sku", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "SKU details", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "356", + "kind": "property", + "name": "family", + "serializedName": "family", + "doc": "SKU family name", + "type": { + "$ref": "1" + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Sku.family", + "serializationOptions": { + "json": { + "name": "family" + } + }, + "isHttpMetadata": false + }, + { + "$id": "357", + "kind": "property", + "name": "name", + "serializedName": "name", + "doc": "SKU name to specify whether the key vault is a standard vault or a premium vault.", + "type": { + "$ref": "4" + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Sku.name", + "serializationOptions": { + "json": { + "name": "name" + } + }, + "isHttpMetadata": false + } + ] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultProperties.sku", + "serializationOptions": { + "json": { + "name": "sku" + } + }, + "isHttpMetadata": false + }, + { + "$id": "358", + "kind": "property", + "name": "accessPolicies", + "serializedName": "accessPolicies", + "doc": "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.", + "type": { + "$id": "359", + "kind": "array", + "name": "ArrayAccessPolicyEntry", + "valueType": { + "$id": "360", + "kind": "model", + "name": "KeyVaultAccessPolicy", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.AccessPolicyEntry", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "An identity that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "361", + "kind": "property", + "name": "tenantId", + "serializedName": "tenantId", + "doc": "The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault.", + "type": { + "$id": "362", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "363", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.AccessPolicyEntry.tenantId", + "serializationOptions": { + "json": { + "name": "tenantId" + } + }, + "isHttpMetadata": false + }, + { + "$id": "364", + "kind": "property", + "name": "objectId", + "serializedName": "objectId", + "doc": "The object ID of a user, service principal or security group in the Azure Active Directory tenant for the vault. The object ID must be unique for the list of access policies.", + "type": { + "$id": "365", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.AccessPolicyEntry.objectId", + "serializationOptions": { + "json": { + "name": "objectId" + } + }, + "isHttpMetadata": false + }, + { + "$id": "366", + "kind": "property", + "name": "applicationId", + "serializedName": "applicationId", + "doc": "Application ID of the client making request on behalf of a principal", + "type": { + "$id": "367", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "368", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.AccessPolicyEntry.applicationId", + "serializationOptions": { + "json": { + "name": "applicationId" + } + }, + "isHttpMetadata": false + }, + { + "$id": "369", + "kind": "property", + "name": "permissions", + "serializedName": "permissions", + "doc": "Permissions the identity has for keys, secrets and certificates.", + "type": { + "$id": "370", + "kind": "model", + "name": "IdentityAccessPermissions", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Permissions", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "Permissions the identity has for keys, secrets, certificates and storage.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "371", + "kind": "property", + "name": "keys", + "serializedName": "keys", + "doc": "Permissions to keys", + "type": { + "$id": "372", + "kind": "array", + "name": "ArrayKeyPermissions", + "valueType": { + "$ref": "8" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Permissions.keys", + "serializationOptions": { + "json": { + "name": "keys" + } + }, + "isHttpMetadata": false + }, + { + "$id": "373", + "kind": "property", + "name": "secrets", + "serializedName": "secrets", + "doc": "Permissions to secrets", + "type": { + "$id": "374", + "kind": "array", + "name": "ArraySecretPermissions", + "valueType": { + "$ref": "31" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Permissions.secrets", + "serializationOptions": { + "json": { + "name": "secrets" + } + }, + "isHttpMetadata": false + }, + { + "$id": "375", + "kind": "property", + "name": "certificates", + "serializedName": "certificates", + "doc": "Permissions to certificates", + "type": { + "$id": "376", + "kind": "array", + "name": "ArrayCertificatePermissions", + "valueType": { + "$ref": "42" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Permissions.certificates", + "serializationOptions": { + "json": { + "name": "certificates" + } + }, + "isHttpMetadata": false + }, + { + "$id": "377", + "kind": "property", + "name": "storage", + "serializedName": "storage", + "doc": "Permissions to storage accounts", + "type": { + "$id": "378", + "kind": "array", + "name": "ArrayStoragePermissions", + "valueType": { + "$ref": "61" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Permissions.storage", + "serializationOptions": { + "json": { + "name": "storage" + } + }, + "isHttpMetadata": false + } + ] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.AccessPolicyEntry.permissions", + "serializationOptions": { + "json": { + "name": "permissions" + } + }, + "isHttpMetadata": false + } + ] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultProperties.accessPolicies", + "serializationOptions": { + "json": { + "name": "accessPolicies" + } + }, + "isHttpMetadata": false + }, + { + "$id": "379", + "kind": "property", + "name": "vaultUri", + "serializedName": "vaultUri", + "doc": "The URI of the vault for performing operations on keys and secrets.", + "type": { + "$id": "380", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultProperties.vaultUri", + "serializationOptions": { + "json": { + "name": "vaultUri" + } + }, + "isHttpMetadata": false + }, + { + "$id": "381", + "kind": "property", + "name": "hsmPoolResourceId", + "serializedName": "hsmPoolResourceId", + "doc": "The resource id of HSM Pool.", + "type": { + "$id": "382", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultProperties.hsmPoolResourceId", + "serializationOptions": { + "json": { + "name": "hsmPoolResourceId" + } + }, + "isHttpMetadata": false + }, + { + "$id": "383", + "kind": "property", + "name": "enabledForDeployment", + "serializedName": "enabledForDeployment", + "doc": "Property to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from the key vault.", + "type": { + "$id": "384", + "kind": "boolean", + "name": "boolean", + "crossLanguageDefinitionId": "TypeSpec.boolean", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultProperties.enabledForDeployment", + "serializationOptions": { + "json": { + "name": "enabledForDeployment" + } + }, + "isHttpMetadata": false + }, + { + "$id": "385", + "kind": "property", + "name": "enabledForDiskEncryption", + "serializedName": "enabledForDiskEncryption", + "doc": "Property to specify whether Azure Disk Encryption is permitted to retrieve secrets from the vault and unwrap keys.", + "type": { + "$id": "386", + "kind": "boolean", + "name": "boolean", + "crossLanguageDefinitionId": "TypeSpec.boolean", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultProperties.enabledForDiskEncryption", + "serializationOptions": { + "json": { + "name": "enabledForDiskEncryption" + } + }, + "isHttpMetadata": false + }, + { + "$id": "387", + "kind": "property", + "name": "enabledForTemplateDeployment", + "serializedName": "enabledForTemplateDeployment", + "doc": "Property to specify whether Azure Resource Manager is permitted to retrieve secrets from the key vault.", + "type": { + "$id": "388", + "kind": "boolean", + "name": "boolean", + "crossLanguageDefinitionId": "TypeSpec.boolean", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultProperties.enabledForTemplateDeployment", + "serializationOptions": { + "json": { + "name": "enabledForTemplateDeployment" + } + }, + "isHttpMetadata": false + }, + { + "$id": "389", + "kind": "property", + "name": "enableSoftDelete", + "serializedName": "enableSoftDelete", + "doc": "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.", + "type": { + "$id": "390", + "kind": "boolean", + "name": "boolean", + "crossLanguageDefinitionId": "TypeSpec.boolean", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultProperties.enableSoftDelete", + "serializationOptions": { + "json": { + "name": "enableSoftDelete" + } + }, + "isHttpMetadata": false + }, + { + "$id": "391", + "kind": "property", + "name": "softDeleteRetentionInDays", + "serializedName": "softDeleteRetentionInDays", + "doc": "softDelete data retention days. It accepts >=7 and <=90.", + "type": { + "$id": "392", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultProperties.softDeleteRetentionInDays", + "serializationOptions": { + "json": { + "name": "softDeleteRetentionInDays" + } + }, + "isHttpMetadata": false + }, + { + "$id": "393", + "kind": "property", + "name": "enableRbacAuthorization", + "serializedName": "enableRbacAuthorization", + "doc": "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.", + "type": { + "$id": "394", + "kind": "boolean", + "name": "boolean", + "crossLanguageDefinitionId": "TypeSpec.boolean", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultProperties.enableRbacAuthorization", + "serializationOptions": { + "json": { + "name": "enableRbacAuthorization" + } + }, + "isHttpMetadata": false + }, + { + "$id": "395", + "kind": "property", + "name": "createMode", + "serializedName": "createMode", + "doc": "The vault's create mode to indicate whether the vault need to be recovered or not.", + "type": { + "$ref": "78" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultProperties.createMode", + "serializationOptions": { + "json": { + "name": "createMode" + } + }, + "isHttpMetadata": false + }, + { + "$id": "396", + "kind": "property", + "name": "enablePurgeProtection", + "serializedName": "enablePurgeProtection", + "doc": "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.", + "type": { + "$id": "397", + "kind": "boolean", + "name": "boolean", + "crossLanguageDefinitionId": "TypeSpec.boolean", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultProperties.enablePurgeProtection", + "serializationOptions": { + "json": { + "name": "enablePurgeProtection" + } + }, + "isHttpMetadata": false + }, + { + "$id": "398", + "kind": "property", + "name": "NetworkRuleSet", + "serializedName": "networkAcls", + "doc": "Rules governing the accessibility of the key vault from specific network locations.", + "type": { + "$id": "399", + "kind": "model", + "name": "KeyVaultNetworkRuleSet", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.NetworkRuleSet", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "A set of rules governing the network accessibility of a vault.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "400", + "kind": "property", + "name": "bypass", + "serializedName": "bypass", + "doc": "Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'.", + "type": { + "$ref": "82" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.NetworkRuleSet.bypass", + "serializationOptions": { + "json": { + "name": "bypass" + } + }, + "isHttpMetadata": false + }, + { + "$id": "401", + "kind": "property", + "name": "defaultAction", + "serializedName": "defaultAction", + "doc": "The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated.", + "type": { + "$ref": "86" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.NetworkRuleSet.defaultAction", + "serializationOptions": { + "json": { + "name": "defaultAction" + } + }, + "isHttpMetadata": false + }, + { + "$id": "402", + "kind": "property", + "name": "ipRules", + "serializedName": "ipRules", + "doc": "The list of IP address rules.", + "type": { + "$id": "403", + "kind": "array", + "name": "ArrayIpRule", + "valueType": { + "$id": "404", + "kind": "model", + "name": "KeyVaultIPRule", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.IPRule", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "A rule governing the accessibility of a vault from a specific ip address or ip range.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "405", + "kind": "property", + "name": "AddressRange", + "serializedName": "value", + "doc": "An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78).", + "type": { + "$id": "406", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.IPRule.value", + "serializationOptions": { + "json": { + "name": "value" + } + }, + "isHttpMetadata": false + } + ] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.NetworkRuleSet.ipRules", + "serializationOptions": { + "json": { + "name": "ipRules" + } + }, + "isHttpMetadata": false + }, + { + "$id": "407", + "kind": "property", + "name": "virtualNetworkRules", + "serializedName": "virtualNetworkRules", + "doc": "The list of virtual network rules.", + "type": { + "$id": "408", + "kind": "array", + "name": "ArrayVirtualNetworkRule", + "valueType": { + "$id": "409", + "kind": "model", + "name": "KeyVaultVirtualNetworkRule", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.VirtualNetworkRule", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "A rule governing the accessibility of a vault from a specific virtual network.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "410", + "kind": "property", + "name": "id", + "serializedName": "id", + "doc": "Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'.", + "type": { + "$id": "411", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VirtualNetworkRule.id", + "serializationOptions": { + "json": { + "name": "id" + } + }, + "isHttpMetadata": false + }, + { + "$id": "412", + "kind": "property", + "name": "ignoreMissingVnetServiceEndpoint", + "serializedName": "ignoreMissingVnetServiceEndpoint", + "doc": "Property to specify whether NRP will ignore the check if parent subnet has serviceEndpoints configured.", + "type": { + "$id": "413", + "kind": "boolean", + "name": "boolean", + "crossLanguageDefinitionId": "TypeSpec.boolean", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VirtualNetworkRule.ignoreMissingVnetServiceEndpoint", + "serializationOptions": { + "json": { + "name": "ignoreMissingVnetServiceEndpoint" + } + }, + "isHttpMetadata": false + } + ] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.NetworkRuleSet.virtualNetworkRules", + "serializationOptions": { + "json": { + "name": "virtualNetworkRules" + } + }, + "isHttpMetadata": false + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultProperties.networkAcls", + "serializationOptions": { + "json": { + "name": "networkAcls" + } + }, + "isHttpMetadata": false + }, + { + "$id": "414", + "kind": "property", + "name": "provisioningState", + "serializedName": "provisioningState", + "doc": "Provisioning state of the vault.", + "type": { + "$ref": "90" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultProperties.provisioningState", + "serializationOptions": { + "json": { + "name": "provisioningState" + } + }, + "isHttpMetadata": false + }, + { + "$id": "415", + "kind": "property", + "name": "privateEndpointConnections", + "serializedName": "privateEndpointConnections", + "doc": "List of private endpoint connections associated with the key vault.", + "type": { + "$id": "416", + "kind": "array", + "name": "ArrayPrivateEndpointConnectionItem", + "valueType": { + "$id": "417", + "kind": "model", + "name": "KeyVaultPrivateEndpointConnectionItemData", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnectionItem", + "usage": "Output,Json,LroInitial,LroFinalEnvelope", + "doc": "Private endpoint connection item.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "418", + "kind": "property", + "name": "id", + "serializedName": "id", + "doc": "Id of private endpoint connection.", + "type": { + "$id": "419", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnectionItem.id", + "serializationOptions": { + "json": { + "name": "id" + } + }, + "isHttpMetadata": false + }, + { + "$id": "420", + "kind": "property", + "name": "etag", + "serializedName": "etag", + "doc": "Modified whenever there is a change in the state of private endpoint connection.", + "type": { + "$id": "421", + "kind": "string", + "name": "eTag", + "crossLanguageDefinitionId": "Azure.Core.eTag", + "baseType": { + "$id": "422", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnectionItem.etag", + "serializationOptions": { + "json": { + "name": "etag" + } + }, + "isHttpMetadata": false + }, + { + "$id": "423", + "kind": "property", + "name": "properties", + "serializedName": "properties", + "doc": "Private endpoint connection properties.", + "type": { + "$id": "424", + "kind": "model", + "name": "PrivateEndpointConnectionProperties", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnectionProperties", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "Properties of the private endpoint connection resource.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "425", + "kind": "property", + "name": "privateEndpoint", + "serializedName": "privateEndpoint", + "doc": "Properties of the private endpoint object.", + "type": { + "$id": "426", + "kind": "model", + "name": "PrivateEndpoint", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpoint", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "Private endpoint object properties.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "427", + "kind": "property", + "name": "id", + "serializedName": "id", + "doc": "Full identifier of the private endpoint resource.", + "type": { + "$id": "428", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpoint.id", + "serializationOptions": { + "json": { + "name": "id" + } + }, + "isHttpMetadata": false + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnectionProperties.privateEndpoint", + "serializationOptions": { + "json": { + "name": "privateEndpoint" + } + }, + "isHttpMetadata": false + }, + { + "$id": "429", + "kind": "property", + "name": "ConnectionState", + "serializedName": "privateLinkServiceConnectionState", + "doc": "Approval state of the private link connection.", + "type": { + "$id": "430", + "kind": "model", + "name": "PrivateLinkServiceConnectionState", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateLinkServiceConnectionState", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "An object that represents the approval state of the private link connection.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "431", + "kind": "property", + "name": "status", + "serializedName": "status", + "doc": "Indicates whether the connection has been approved, rejected or removed by the key vault owner.", + "type": { + "$ref": "94" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateLinkServiceConnectionState.status", + "serializationOptions": { + "json": { + "name": "status" + } + }, + "isHttpMetadata": false + }, + { + "$id": "432", + "kind": "property", + "name": "description", + "serializedName": "description", + "doc": "The reason for approval or rejection.", + "type": { + "$id": "433", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateLinkServiceConnectionState.description", + "serializationOptions": { + "json": { + "name": "description" + } + }, + "isHttpMetadata": false + }, + { + "$id": "434", + "kind": "property", + "name": "actionsRequired", + "serializedName": "actionsRequired", + "doc": "A message indicating if changes on the service provider require any updates on the consumer.", + "type": { + "$ref": "100" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateLinkServiceConnectionState.actionsRequired", + "serializationOptions": { + "json": { + "name": "actionsRequired" + } + }, + "isHttpMetadata": false + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnectionProperties.privateLinkServiceConnectionState", + "serializationOptions": { + "json": { + "name": "privateLinkServiceConnectionState" + } + }, + "isHttpMetadata": false + }, + { + "$id": "435", + "kind": "property", + "name": "provisioningState", + "serializedName": "provisioningState", + "doc": "Provisioning state of the private endpoint connection.", + "type": { + "$ref": "103" + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnectionProperties.provisioningState", + "serializationOptions": { + "json": { + "name": "provisioningState" + } + }, + "isHttpMetadata": false + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": true, + "decorators": [ + { + "name": "Azure.ResourceManager.@flattenProperty", + "arguments": {} + } + ], + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnectionItem.properties", + "serializationOptions": { + "json": { + "name": "properties" + } + }, + "isHttpMetadata": false + } + ] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultProperties.privateEndpointConnections", + "serializationOptions": { + "json": { + "name": "privateEndpointConnections" + } + }, + "isHttpMetadata": false + }, + { + "$id": "436", + "kind": "property", + "name": "publicNetworkAccess", + "serializedName": "publicNetworkAccess", + "doc": "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.", + "type": { + "$id": "437", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultProperties.publicNetworkAccess", + "serializationOptions": { + "json": { + "name": "publicNetworkAccess" + } + }, + "isHttpMetadata": false + } + ] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vault.properties", + "serializationOptions": { + "json": { + "name": "properties" + } + }, + "isHttpMetadata": false + }, + { + "$id": "438", + "kind": "property", + "name": "tags", + "serializedName": "tags", + "doc": "Resource tags.", + "type": { + "$id": "439", + "kind": "dict", + "keyType": { + "$id": "440", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "valueType": { + "$id": "441", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vault.tags", + "serializationOptions": { + "json": { + "name": "tags" + } + }, + "isHttpMetadata": false + }, + { + "$id": "442", + "kind": "property", + "name": "location", + "serializedName": "location", + "doc": "The geo-location where the resource lives", + "type": { + "$id": "443", + "kind": "string", + "name": "azureLocation", + "crossLanguageDefinitionId": "Azure.Core.azureLocation", + "baseType": { + "$id": "444", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vault.location", + "serializationOptions": { + "json": { + "name": "location" + } + }, + "isHttpMetadata": false + }, + { + "$id": "445", + "kind": "property", + "name": "name", + "serializedName": "name", + "doc": "The name of the vault.", + "type": { + "$id": "446", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vault.name", + "serializationOptions": { + "json": { + "name": "name" + } + }, + "isHttpMetadata": true + } + ] + }, + { + "$ref": "350" + }, + { + "$ref": "355" + }, + { + "$ref": "360" + }, + { + "$ref": "370" + }, + { + "$ref": "399" + }, + { + "$ref": "404" + }, + { + "$ref": "409" + }, + { + "$ref": "417" + }, + { + "$ref": "424" + }, + { + "$ref": "426" + }, + { + "$ref": "430" + }, + { + "$ref": "326" + }, + { + "$ref": "336" + }, + { + "$id": "447", + "kind": "model", + "name": "CloudError", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.CloudError", + "usage": "Json,Exception", + "doc": "An error response from Key Vault resource provider", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "448", + "kind": "property", + "name": "error", + "serializedName": "error", + "doc": "An error response from Key Vault resource provider", + "type": { + "$id": "449", + "kind": "model", + "name": "CloudErrorBody", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.CloudErrorBody", + "usage": "Json,Exception", + "doc": "An error response from Key Vault resource provider", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "450", + "kind": "property", + "name": "code", + "serializedName": "code", + "doc": "Error code. This is a mnemonic that can be consumed programmatically.", + "type": { + "$id": "451", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.CloudErrorBody.code", + "serializationOptions": { + "json": { + "name": "code" + } + }, + "isHttpMetadata": false + }, + { + "$id": "452", + "kind": "property", + "name": "message", + "serializedName": "message", + "doc": "User friendly error message. The message is typically localized and may vary with service version.", + "type": { + "$id": "453", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.CloudErrorBody.message", + "serializationOptions": { + "json": { + "name": "message" + } + }, + "isHttpMetadata": false + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.CloudError.error", + "serializationOptions": { + "json": { + "name": "error" + } + }, + "isHttpMetadata": false + } + ] + }, + { + "$ref": "449" + }, + { + "$id": "454", + "kind": "model", + "name": "VaultCreateOrUpdateParameters", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultCreateOrUpdateParameters", + "usage": "Input,Json", + "doc": "Parameters for creating or updating a vault", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "455", + "kind": "property", + "name": "location", + "serializedName": "location", + "doc": "The supported Azure location where the key vault should be created.", + "type": { + "$id": "456", + "kind": "string", + "name": "azureLocation", + "crossLanguageDefinitionId": "Azure.Core.azureLocation", + "baseType": { + "$id": "457", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultCreateOrUpdateParameters.location", + "serializationOptions": { + "json": { + "name": "location" + } + }, + "isHttpMetadata": false + }, + { + "$id": "458", + "kind": "property", + "name": "tags", + "serializedName": "tags", + "doc": "The tags that will be assigned to the key vault.", + "type": { + "$ref": "439" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultCreateOrUpdateParameters.tags", + "serializationOptions": { + "json": { + "name": "tags" + } + }, + "isHttpMetadata": false + }, + { + "$id": "459", + "kind": "property", + "name": "properties", + "serializedName": "properties", + "doc": "Properties of the vault", + "type": { + "$ref": "350" + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultCreateOrUpdateParameters.properties", + "serializationOptions": { + "json": { + "name": "properties" + } + }, + "isHttpMetadata": false + } + ] + }, + { + "$id": "460", + "kind": "model", + "name": "ArmOperationStatusResourceProvisioningState", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Azure.ResourceManager.ArmOperationStatus", + "usage": "LroPolling", + "doc": "Standard Azure Resource Manager operation status response", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "461", + "kind": "property", + "name": "status", + "serializedName": "status", + "doc": "The operation status", + "type": { + "$ref": "117" + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ArmOperationStatus.status", + "serializationOptions": { + "json": { + "name": "status" + } + }, + "isHttpMetadata": false + }, + { + "$id": "462", + "kind": "property", + "name": "id", + "serializedName": "id", + "doc": "The unique identifier for the operationStatus resource", + "type": { + "$id": "463", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ArmOperationStatus.id", + "serializationOptions": { + "json": { + "name": "id" + } + }, + "isHttpMetadata": true + }, + { + "$id": "464", + "kind": "property", + "name": "name", + "serializedName": "name", + "doc": "The name of the operationStatus resource", + "type": { + "$id": "465", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ArmOperationStatus.name", + "serializationOptions": { + "json": { + "name": "name" + } + }, + "isHttpMetadata": false + }, + { + "$id": "466", + "kind": "property", + "name": "startTime", + "serializedName": "startTime", + "doc": "Operation start time", + "type": { + "$id": "467", + "kind": "utcDateTime", + "name": "utcDateTime", + "encode": "rfc3339", + "wireType": { + "$id": "468", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.utcDateTime", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ArmOperationStatus.startTime", + "serializationOptions": { + "json": { + "name": "startTime" + } + }, + "isHttpMetadata": false + }, + { + "$id": "469", + "kind": "property", + "name": "endTime", + "serializedName": "endTime", + "doc": "Operation complete time", + "type": { + "$id": "470", + "kind": "utcDateTime", + "name": "utcDateTime", + "encode": "rfc3339", + "wireType": { + "$id": "471", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.utcDateTime", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ArmOperationStatus.endTime", + "serializationOptions": { + "json": { + "name": "endTime" + } + }, + "isHttpMetadata": false + }, + { + "$id": "472", + "kind": "property", + "name": "percentComplete", + "serializedName": "percentComplete", + "doc": "The progress made toward completing the operation", + "type": { + "$id": "473", + "kind": "float64", + "name": "float64", + "crossLanguageDefinitionId": "TypeSpec.float64", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ArmOperationStatus.percentComplete", + "serializationOptions": { + "json": { + "name": "percentComplete" + } + }, + "isHttpMetadata": false + }, + { + "$id": "474", + "kind": "property", + "name": "error", + "serializedName": "error", + "doc": "Errors that occurred if the operation ended with Canceled or Failed status", + "type": { + "$id": "475", + "kind": "model", + "name": "ErrorDetail", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "usage": "LroPolling", + "doc": "The error detail.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "476", + "kind": "property", + "name": "code", + "serializedName": "code", + "doc": "The error code.", + "type": { + "$id": "477", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.ErrorDetail.code", + "serializationOptions": { + "json": { + "name": "code" + } + }, + "isHttpMetadata": false + }, + { + "$id": "478", + "kind": "property", + "name": "message", + "serializedName": "message", + "doc": "The error message.", + "type": { + "$id": "479", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.ErrorDetail.message", + "serializationOptions": { + "json": { + "name": "message" + } + }, + "isHttpMetadata": false + }, + { + "$id": "480", + "kind": "property", + "name": "target", + "serializedName": "target", + "doc": "The error target.", + "type": { + "$id": "481", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.ErrorDetail.target", + "serializationOptions": { + "json": { + "name": "target" + } + }, + "isHttpMetadata": false + }, + { + "$id": "482", + "kind": "property", + "name": "details", + "serializedName": "details", + "doc": "The error details.", + "type": { + "$id": "483", + "kind": "array", + "name": "ArrayErrorDetail", + "valueType": { + "$ref": "475" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.ErrorDetail.details", + "serializationOptions": { + "json": { + "name": "details" + } + }, + "isHttpMetadata": false + }, + { + "$id": "484", + "kind": "property", + "name": "additionalInfo", + "serializedName": "additionalInfo", + "doc": "The error additional info.", + "type": { + "$id": "485", + "kind": "array", + "name": "ArrayErrorAdditionalInfo", + "valueType": { + "$id": "486", + "kind": "model", + "name": "ErrorAdditionalInfo", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "usage": "LroPolling", + "doc": "The resource management error additional info.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "487", + "kind": "property", + "name": "type", + "serializedName": "type", + "doc": "The additional info type.", + "type": { + "$id": "488", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo.type", + "serializationOptions": { + "json": { + "name": "type" + } + }, + "isHttpMetadata": false + }, + { + "$id": "489", + "kind": "property", + "name": "info", + "serializedName": "info", + "doc": "The additional info.", + "type": { + "$id": "490", + "kind": "unknown", + "name": "unknown", + "crossLanguageDefinitionId": "", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo.info", + "serializationOptions": { + "json": { + "name": "info" + } + }, + "isHttpMetadata": false + } + ] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.ErrorDetail.additionalInfo", + "serializationOptions": { + "json": { + "name": "additionalInfo" + } + }, + "isHttpMetadata": false + } + ] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ArmOperationStatus.error", + "serializationOptions": { + "json": { + "name": "error" + } + }, + "isHttpMetadata": false + } + ] + }, + { + "$ref": "475" + }, + { + "$ref": "486" + }, + { + "$id": "491", + "kind": "model", + "name": "VaultPatchParameters", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultPatchParameters", + "usage": "Input,Json", + "doc": "Parameters for creating or updating a vault", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "492", + "kind": "property", + "name": "tags", + "serializedName": "tags", + "doc": "The tags that will be assigned to the key vault.", + "type": { + "$ref": "439" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultPatchParameters.tags", + "serializationOptions": { + "json": { + "name": "tags" + } + }, + "isHttpMetadata": false + }, + { + "$id": "493", + "kind": "property", + "name": "properties", + "serializedName": "properties", + "doc": "Properties of the vault", + "type": { + "$id": "494", + "kind": "model", + "name": "KeyVaultPatchProperties", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultPatchProperties", + "usage": "Input,Json", + "doc": "Properties of the vault", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "495", + "kind": "property", + "name": "tenantId", + "serializedName": "tenantId", + "doc": "The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault.", + "type": { + "$id": "496", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "497", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultPatchProperties.tenantId", + "serializationOptions": { + "json": { + "name": "tenantId" + } + }, + "isHttpMetadata": false + }, + { + "$id": "498", + "kind": "property", + "name": "sku", + "serializedName": "sku", + "doc": "SKU details", + "type": { + "$ref": "355" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultPatchProperties.sku", + "serializationOptions": { + "json": { + "name": "sku" + } + }, + "isHttpMetadata": false + }, + { + "$id": "499", + "kind": "property", + "name": "accessPolicies", + "serializedName": "accessPolicies", + "doc": "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.", + "type": { + "$ref": "359" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultPatchProperties.accessPolicies", + "serializationOptions": { + "json": { + "name": "accessPolicies" + } + }, + "isHttpMetadata": false + }, + { + "$id": "500", + "kind": "property", + "name": "enabledForDeployment", + "serializedName": "enabledForDeployment", + "doc": "Property to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from the key vault.", + "type": { + "$id": "501", + "kind": "boolean", + "name": "boolean", + "crossLanguageDefinitionId": "TypeSpec.boolean", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultPatchProperties.enabledForDeployment", + "serializationOptions": { + "json": { + "name": "enabledForDeployment" + } + }, + "isHttpMetadata": false + }, + { + "$id": "502", + "kind": "property", + "name": "enabledForDiskEncryption", + "serializedName": "enabledForDiskEncryption", + "doc": "Property to specify whether Azure Disk Encryption is permitted to retrieve secrets from the vault and unwrap keys.", + "type": { + "$id": "503", + "kind": "boolean", + "name": "boolean", + "crossLanguageDefinitionId": "TypeSpec.boolean", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultPatchProperties.enabledForDiskEncryption", + "serializationOptions": { + "json": { + "name": "enabledForDiskEncryption" + } + }, + "isHttpMetadata": false + }, + { + "$id": "504", + "kind": "property", + "name": "enabledForTemplateDeployment", + "serializedName": "enabledForTemplateDeployment", + "doc": "Property to specify whether Azure Resource Manager is permitted to retrieve secrets from the key vault.", + "type": { + "$id": "505", + "kind": "boolean", + "name": "boolean", + "crossLanguageDefinitionId": "TypeSpec.boolean", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultPatchProperties.enabledForTemplateDeployment", + "serializationOptions": { + "json": { + "name": "enabledForTemplateDeployment" + } + }, + "isHttpMetadata": false + }, + { + "$id": "506", + "kind": "property", + "name": "enableSoftDelete", + "serializedName": "enableSoftDelete", + "doc": "Property to specify whether the 'soft delete' functionality is enabled for this key vault. Once set to true, it cannot be reverted to false.", + "type": { + "$id": "507", + "kind": "boolean", + "name": "boolean", + "crossLanguageDefinitionId": "TypeSpec.boolean", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultPatchProperties.enableSoftDelete", + "serializationOptions": { + "json": { + "name": "enableSoftDelete" + } + }, + "isHttpMetadata": false + }, + { + "$id": "508", + "kind": "property", + "name": "enableRbacAuthorization", + "serializedName": "enableRbacAuthorization", + "doc": "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.", + "type": { + "$id": "509", + "kind": "boolean", + "name": "boolean", + "crossLanguageDefinitionId": "TypeSpec.boolean", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultPatchProperties.enableRbacAuthorization", + "serializationOptions": { + "json": { + "name": "enableRbacAuthorization" + } + }, + "isHttpMetadata": false + }, + { + "$id": "510", + "kind": "property", + "name": "softDeleteRetentionInDays", + "serializedName": "softDeleteRetentionInDays", + "doc": "softDelete data retention days. It accepts >=7 and <=90.", + "type": { + "$id": "511", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultPatchProperties.softDeleteRetentionInDays", + "serializationOptions": { + "json": { + "name": "softDeleteRetentionInDays" + } + }, + "isHttpMetadata": false + }, + { + "$id": "512", + "kind": "property", + "name": "createMode", + "serializedName": "createMode", + "doc": "The vault's create mode to indicate whether the vault need to be recovered or not.", + "type": { + "$ref": "122" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultPatchProperties.createMode", + "serializationOptions": { + "json": { + "name": "createMode" + } + }, + "isHttpMetadata": false + }, + { + "$id": "513", + "kind": "property", + "name": "enablePurgeProtection", + "serializedName": "enablePurgeProtection", + "doc": "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.", + "type": { + "$id": "514", + "kind": "boolean", + "name": "boolean", + "crossLanguageDefinitionId": "TypeSpec.boolean", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultPatchProperties.enablePurgeProtection", + "serializationOptions": { + "json": { + "name": "enablePurgeProtection" + } + }, + "isHttpMetadata": false + }, + { + "$id": "515", + "kind": "property", + "name": "NetworkRuleSet", + "serializedName": "networkAcls", + "doc": "A collection of rules governing the accessibility of the vault from specific network locations.", + "type": { + "$ref": "399" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultPatchProperties.networkAcls", + "serializationOptions": { + "json": { + "name": "networkAcls" + } + }, + "isHttpMetadata": false + }, + { + "$id": "516", + "kind": "property", + "name": "publicNetworkAccess", + "serializedName": "publicNetworkAccess", + "doc": "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.", + "type": { + "$id": "517", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultPatchProperties.publicNetworkAccess", + "serializationOptions": { + "json": { + "name": "publicNetworkAccess" + } + }, + "isHttpMetadata": false + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultPatchParameters.properties", + "serializationOptions": { + "json": { + "name": "properties" + } + }, + "isHttpMetadata": false + } + ] + }, + { + "$ref": "494" + }, + { + "$id": "518", + "kind": "model", + "name": "VaultListResult", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Azure.ResourceManager.ResourceListResult", + "usage": "Output,Json", + "doc": "The response of a Vault list operation.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "519", + "kind": "property", + "name": "value", + "serializedName": "value", + "doc": "The Vault items on this page", + "type": { + "$id": "520", + "kind": "array", + "name": "ArrayVault", + "valueType": { + "$ref": "318" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ResourceListResult.value", + "serializationOptions": { + "json": { + "name": "value" + } + }, + "isHttpMetadata": false + }, + { + "$id": "521", + "kind": "property", + "name": "nextLink", + "serializedName": "nextLink", + "doc": "The link to the next page of items", + "type": { + "$id": "522", + "kind": "url", + "name": "ResourceLocation", + "crossLanguageDefinitionId": "TypeSpec.Rest.ResourceLocation", + "baseType": { + "$id": "523", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ResourceListResult.nextLink", + "serializationOptions": { + "json": { + "name": "nextLink" + } + }, + "isHttpMetadata": false + } + ] + }, + { + "$id": "524", + "kind": "model", + "name": "KeyVaultAccessPolicyParameters", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultAccessPolicyParameters", + "usage": "Input,Output,Json", + "doc": "Parameters for updating the access policy in a vault", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "525", + "kind": "property", + "name": "id", + "serializedName": "id", + "doc": "The resource id of the access policy.", + "type": { + "$id": "526", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultAccessPolicyParameters.id", + "serializationOptions": { + "json": { + "name": "id" + } + }, + "isHttpMetadata": false + }, + { + "$id": "527", + "kind": "property", + "name": "name", + "serializedName": "name", + "doc": "The resource name of the access policy.", + "type": { + "$id": "528", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultAccessPolicyParameters.name", + "serializationOptions": { + "json": { + "name": "name" + } + }, + "isHttpMetadata": false + }, + { + "$id": "529", + "kind": "property", + "name": "type", + "serializedName": "type", + "doc": "The resource name of the access policy.", + "type": { + "$id": "530", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultAccessPolicyParameters.type", + "serializationOptions": { + "json": { + "name": "type" + } + }, + "isHttpMetadata": false + }, + { + "$id": "531", + "kind": "property", + "name": "location", + "serializedName": "location", + "doc": "The resource type of the access policy.", + "type": { + "$id": "532", + "kind": "string", + "name": "azureLocation", + "crossLanguageDefinitionId": "Azure.Core.azureLocation", + "baseType": { + "$id": "533", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultAccessPolicyParameters.location", + "serializationOptions": { + "json": { + "name": "location" + } + }, + "isHttpMetadata": false + }, + { + "$id": "534", + "kind": "property", + "name": "properties", + "serializedName": "properties", + "doc": "Properties of the access policy", + "type": { + "$id": "535", + "kind": "model", + "name": "KeyVaultAccessPolicyProperties", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultAccessPolicyProperties", + "usage": "Input,Output,Json", + "doc": "Properties of the vault access policy", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "536", + "kind": "property", + "name": "accessPolicies", + "serializedName": "accessPolicies", + "doc": "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.", + "type": { + "$ref": "359" + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultAccessPolicyProperties.accessPolicies", + "serializationOptions": { + "json": { + "name": "accessPolicies" + } + }, + "isHttpMetadata": false + } + ] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultAccessPolicyParameters.properties", + "serializationOptions": { + "json": { + "name": "properties" + } + }, + "isHttpMetadata": false + } + ] + }, + { + "$ref": "535" + }, + { + "$id": "537", + "kind": "model", + "name": "PrivateLinkResourceListResult", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateLinkResourceListResult", + "usage": "Output,Json", + "doc": "A list of private link resources", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "538", + "kind": "property", + "name": "value", + "serializedName": "value", + "doc": "Array of private link resources", + "type": { + "$id": "539", + "kind": "array", + "name": "ArrayPrivateLinkResource", + "valueType": { + "$id": "540", + "kind": "model", + "name": "KeyVaultPrivateLinkResourceData", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateLinkResource", + "usage": "Output,Json", + "doc": "A private link resource", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "baseModel": { + "$id": "541", + "kind": "model", + "name": "ProxyResource", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.ProxyResource", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location", + "summary": "Proxy Resource", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "baseModel": { + "$ref": "326" + }, + "properties": [] + }, + "properties": [ + { + "$id": "542", + "kind": "property", + "name": "properties", + "serializedName": "properties", + "doc": "Resource properties.", + "type": { + "$id": "543", + "kind": "model", + "name": "PrivateLinkResourceProperties", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateLinkResourceProperties", + "usage": "Output,Json", + "doc": "Properties of a private link resource.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "544", + "kind": "property", + "name": "groupId", + "serializedName": "groupId", + "doc": "Group identifier of private link resource.", + "type": { + "$id": "545", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateLinkResourceProperties.groupId", + "serializationOptions": { + "json": { + "name": "groupId" + } + }, + "isHttpMetadata": false + }, + { + "$id": "546", + "kind": "property", + "name": "requiredMembers", + "serializedName": "requiredMembers", + "doc": "Required member names of private link resource.", + "type": { + "$id": "547", + "kind": "array", + "name": "Array", + "valueType": { + "$id": "548", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateLinkResourceProperties.requiredMembers", + "serializationOptions": { + "json": { + "name": "requiredMembers" + } + }, + "isHttpMetadata": false + }, + { + "$id": "549", + "kind": "property", + "name": "requiredZoneNames", + "serializedName": "requiredZoneNames", + "doc": "Required DNS zone names of the the private link resource.", + "type": { + "$ref": "547" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateLinkResourceProperties.requiredZoneNames", + "serializationOptions": { + "json": { + "name": "requiredZoneNames" + } + }, + "isHttpMetadata": false + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": true, + "decorators": [ + { + "name": "Azure.ResourceManager.@flattenProperty", + "arguments": {} + } + ], + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateLinkResource.properties", + "serializationOptions": { + "json": { + "name": "properties" + } + }, + "isHttpMetadata": false + }, + { + "$id": "550", + "kind": "property", + "name": "location", + "serializedName": "location", + "doc": "Azure location of the key vault resource.", + "type": { + "$id": "551", + "kind": "string", + "name": "azureLocation", + "crossLanguageDefinitionId": "Azure.Core.azureLocation", + "baseType": { + "$id": "552", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateLinkResource.location", + "serializationOptions": { + "json": { + "name": "location" + } + }, + "isHttpMetadata": false + }, + { + "$id": "553", + "kind": "property", + "name": "tags", + "serializedName": "tags", + "doc": "Tags assigned to the key vault resource.", + "type": { + "$ref": "439" + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateLinkResource.tags", + "serializationOptions": { + "json": { + "name": "tags" + } + }, + "isHttpMetadata": false + } + ] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateLinkResourceListResult.value", + "serializationOptions": { + "json": { + "name": "value" + } + }, + "isHttpMetadata": false + } + ] + }, + { + "$ref": "540" + }, + { + "$ref": "543" + }, + { + "$ref": "541" + }, + { + "$id": "554", + "kind": "model", + "name": "DeletedKeyVault", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedVault", + "usage": "Output,Json", + "doc": "Deleted vault information with extended details.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + }, + { + "name": "Azure.ResourceManager.Private.@armResourceInternal", + "arguments": {} + }, + { + "name": "TypeSpec.Rest.@parentResource", + "arguments": {} + }, + { + "name": "Azure.ResourceManager.@subscriptionResource", + "arguments": {} + }, + { + "name": "Azure.ClientGenerator.Core.@resourceSchema", + "arguments": { + "resourceIdPattern": "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}", + "resourceType": "Microsoft.KeyVault/locations/deletedVaults", + "methods": [ + { + "$id": "555", + "methodId": "Microsoft.KeyVault.DeletedVaults.getDeleted", + "kind": "Get", + "operationPath": "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}", + "operationScope": "Subscription", + "resourceScope": "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}" + }, + { + "$id": "556", + "methodId": "Microsoft.KeyVault.DeletedVaults.purgeDeleted", + "kind": "Action", + "operationPath": "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge", + "operationScope": "Subscription", + "resourceScope": "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}" + } + ], + "resourceScope": "Subscription", + "resourceName": "DeletedKeyVault" + } + } + ], + "baseModel": { + "$ref": "541" + }, + "properties": [ + { + "$id": "557", + "kind": "property", + "name": "properties", + "serializedName": "properties", + "doc": "Properties of the vault", + "type": { + "$id": "558", + "kind": "model", + "name": "DeletedKeyVaultProperties", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedVaultProperties", + "usage": "Output,Json", + "doc": "Properties of the deleted vault.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "559", + "kind": "property", + "name": "vaultId", + "serializedName": "vaultId", + "doc": "The resource id of the original vault.", + "type": { + "$id": "560", + "kind": "string", + "name": "armResourceIdentifier", + "crossLanguageDefinitionId": "Azure.Core.armResourceIdentifier", + "baseType": { + "$id": "561", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedVaultProperties.vaultId", + "serializationOptions": { + "json": { + "name": "vaultId" + } + }, + "isHttpMetadata": false + }, + { + "$id": "562", + "kind": "property", + "name": "location", + "serializedName": "location", + "doc": "The location of the original vault.", + "type": { + "$id": "563", + "kind": "string", + "name": "azureLocation", + "crossLanguageDefinitionId": "Azure.Core.azureLocation", + "baseType": { + "$id": "564", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedVaultProperties.location", + "serializationOptions": { + "json": { + "name": "location" + } + }, + "isHttpMetadata": false + }, + { + "$id": "565", + "kind": "property", + "name": "deletionDate", + "serializedName": "deletionDate", + "doc": "The deleted date.", + "type": { + "$id": "566", + "kind": "utcDateTime", + "name": "utcDateTime", + "encode": "rfc3339", + "wireType": { + "$id": "567", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.utcDateTime", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedVaultProperties.deletionDate", + "serializationOptions": { + "json": { + "name": "deletionDate" + } + }, + "isHttpMetadata": false + }, + { + "$id": "568", + "kind": "property", + "name": "scheduledPurgeDate", + "serializedName": "scheduledPurgeDate", + "doc": "The scheduled purged date.", + "type": { + "$id": "569", + "kind": "utcDateTime", + "name": "utcDateTime", + "encode": "rfc3339", + "wireType": { + "$id": "570", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.utcDateTime", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedVaultProperties.scheduledPurgeDate", + "serializationOptions": { + "json": { + "name": "scheduledPurgeDate" + } + }, + "isHttpMetadata": false + }, + { + "$id": "571", + "kind": "property", + "name": "tags", + "serializedName": "tags", + "doc": "Tags of the original vault.", + "type": { + "$ref": "439" + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedVaultProperties.tags", + "serializationOptions": { + "json": { + "name": "tags" + } + }, + "isHttpMetadata": false + }, + { + "$id": "572", + "kind": "property", + "name": "purgeProtectionEnabled", + "serializedName": "purgeProtectionEnabled", + "doc": "Purge protection status of the original vault.", + "type": { + "$id": "573", + "kind": "boolean", + "name": "boolean", + "crossLanguageDefinitionId": "TypeSpec.boolean", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedVaultProperties.purgeProtectionEnabled", + "serializationOptions": { + "json": { + "name": "purgeProtectionEnabled" + } + }, + "isHttpMetadata": false + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedVault.properties", + "serializationOptions": { + "json": { + "name": "properties" + } + }, + "isHttpMetadata": false + }, + { + "$id": "574", + "kind": "property", + "name": "name", + "serializedName": "name", + "doc": "The name of the vault.", + "type": { + "$id": "575", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedVault.name", + "serializationOptions": { + "json": { + "name": "name" + } + }, + "isHttpMetadata": true + } + ] + }, + { + "$ref": "558" + }, + { + "$id": "576", + "kind": "model", + "name": "KeyVaultPrivateEndpointConnection", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnection", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "Private endpoint connection resource.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + }, + { + "name": "Azure.ResourceManager.Private.@armResourceInternal", + "arguments": {} + }, + { + "name": "TypeSpec.Rest.@parentResource", + "arguments": {} + }, + { + "name": "Azure.ClientGenerator.Core.@resourceSchema", + "arguments": { + "resourceIdPattern": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}", + "resourceType": "Microsoft.KeyVault/vaults/privateEndpointConnections", + "methods": [ + { + "$id": "577", + "methodId": "Microsoft.KeyVault.PrivateEndpointConnections.get", + "kind": "Get", + "operationPath": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}", + "operationScope": "ResourceGroup", + "resourceScope": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}" + }, + { + "$id": "578", + "methodId": "Microsoft.KeyVault.PrivateEndpointConnections.put", + "kind": "Create", + "operationPath": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}", + "operationScope": "ResourceGroup", + "resourceScope": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}" + }, + { + "$id": "579", + "methodId": "Microsoft.KeyVault.PrivateEndpointConnections.delete", + "kind": "Delete", + "operationPath": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}", + "operationScope": "ResourceGroup", + "resourceScope": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}" + }, + { + "$id": "580", + "methodId": "Microsoft.KeyVault.PrivateEndpointConnections.listByResource", + "kind": "List", + "operationPath": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections", + "operationScope": "ResourceGroup", + "resourceScope": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}" + } + ], + "resourceScope": "ResourceGroup", + "parentResourceId": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}", + "resourceName": "KeyVaultPrivateEndpointConnection" + } + } + ], + "baseModel": { + "$ref": "541" + }, + "properties": [ + { + "$id": "581", + "kind": "property", + "name": "properties", + "serializedName": "properties", + "doc": "Resource properties.", + "type": { + "$ref": "424" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": true, + "decorators": [ + { + "name": "Azure.ResourceManager.@flattenProperty", + "arguments": {} + } + ], + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnection.properties", + "serializationOptions": { + "json": { + "name": "properties" + } + }, + "isHttpMetadata": false + }, + { + "$id": "582", + "kind": "property", + "name": "name", + "serializedName": "name", + "doc": "Name of the private endpoint connection associated with the key vault.", + "type": { + "$id": "583", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnection.name", + "serializationOptions": { + "json": { + "name": "name" + } + }, + "isHttpMetadata": true + }, + { + "$id": "584", + "kind": "property", + "name": "location", + "serializedName": "location", + "doc": "Azure location of the key vault resource.", + "type": { + "$id": "585", + "kind": "string", + "name": "azureLocation", + "crossLanguageDefinitionId": "Azure.Core.azureLocation", + "baseType": { + "$id": "586", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnection.location", + "serializationOptions": { + "json": { + "name": "location" + } + }, + "isHttpMetadata": false + }, + { + "$id": "587", + "kind": "property", + "name": "tags", + "serializedName": "tags", + "doc": "Tags assigned to the key vault resource.", + "type": { + "$ref": "439" + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnection.tags", + "serializationOptions": { + "json": { + "name": "tags" + } + }, + "isHttpMetadata": false + }, + { + "$id": "588", + "kind": "property", + "name": "etag", + "serializedName": "etag", + "doc": "Modified whenever there is a change in the state of private endpoint connection.", + "type": { + "$id": "589", + "kind": "string", + "name": "eTag", + "crossLanguageDefinitionId": "Azure.Core.eTag", + "baseType": { + "$id": "590", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnection.etag", + "serializationOptions": { + "json": { + "name": "etag" + } + }, + "isHttpMetadata": false + } + ] + }, + { + "$id": "591", + "kind": "model", + "name": "PrivateEndpointConnectionListResult", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Azure.ResourceManager.ResourceListResult", + "usage": "Output,Json", + "doc": "The response of a PrivateEndpointConnection list operation.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "592", + "kind": "property", + "name": "value", + "serializedName": "value", + "doc": "The PrivateEndpointConnection items on this page", + "type": { + "$id": "593", + "kind": "array", + "name": "ArrayPrivateEndpointConnection", + "valueType": { + "$ref": "576" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ResourceListResult.value", + "serializationOptions": { + "json": { + "name": "value" + } + }, + "isHttpMetadata": false + }, + { + "$id": "594", + "kind": "property", + "name": "nextLink", + "serializedName": "nextLink", + "doc": "The link to the next page of items", + "type": { + "$id": "595", + "kind": "url", + "name": "ResourceLocation", + "crossLanguageDefinitionId": "TypeSpec.Rest.ResourceLocation", + "baseType": { + "$id": "596", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ResourceListResult.nextLink", + "serializationOptions": { + "json": { + "name": "nextLink" + } + }, + "isHttpMetadata": false + } + ] + }, + { + "$id": "597", + "kind": "model", + "name": "ManagedHsm", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsm", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "Resource information with extended details.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + }, + { + "name": "Azure.ResourceManager.Private.@armResourceInternal", + "arguments": {} + }, + { + "name": "Azure.ClientGenerator.Core.@resourceSchema", + "arguments": { + "resourceIdPattern": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}", + "resourceType": "Microsoft.KeyVault/managedHSMs", + "methods": [ + { + "$id": "598", + "methodId": "Microsoft.KeyVault.ManagedHsms.get", + "kind": "Get", + "operationPath": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}", + "operationScope": "ResourceGroup", + "resourceScope": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}" + }, + { + "$id": "599", + "methodId": "Microsoft.KeyVault.ManagedHsms.createOrUpdate", + "kind": "Create", + "operationPath": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}", + "operationScope": "ResourceGroup", + "resourceScope": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}" + }, + { + "$id": "600", + "methodId": "Microsoft.KeyVault.ManagedHsms.update", + "kind": "Update", + "operationPath": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}", + "operationScope": "ResourceGroup", + "resourceScope": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}" + }, + { + "$id": "601", + "methodId": "Microsoft.KeyVault.ManagedHsms.delete", + "kind": "Delete", + "operationPath": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}", + "operationScope": "ResourceGroup", + "resourceScope": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}" + }, + { + "$id": "602", + "methodId": "Microsoft.KeyVault.ManagedHsms.listByResourceGroup", + "kind": "List", + "operationPath": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs", + "operationScope": "ResourceGroup" + }, + { + "$id": "603", + "methodId": "Microsoft.KeyVault.ManagedHsms.listBySubscription", + "kind": "List", + "operationPath": "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/managedHSMs", + "operationScope": "Subscription" + }, + { + "$id": "604", + "methodId": "Microsoft.KeyVault.ManagedHsms.listByMHSMResource", + "kind": "Action", + "operationPath": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateLinkResources", + "operationScope": "ResourceGroup", + "resourceScope": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}" + }, + { + "$id": "605", + "methodId": "Microsoft.KeyVault.ManagedHsms.listByResource", + "kind": "Action", + "operationPath": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/regions", + "operationScope": "ResourceGroup", + "resourceScope": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}" + } + ], + "resourceScope": "ResourceGroup", + "resourceName": "ManagedHsm" + } + } + ], + "baseModel": { + "$ref": "326" + }, + "properties": [ + { + "$id": "606", + "kind": "property", + "name": "properties", + "serializedName": "properties", + "doc": "Properties of the managed HSM", + "type": { + "$id": "607", + "kind": "model", + "name": "ManagedHsmProperties", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmProperties", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "Properties of the managed HSM Pool", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "608", + "kind": "property", + "name": "tenantId", + "serializedName": "tenantId", + "doc": "The Azure Active Directory tenant ID that should be used for authenticating requests to the managed HSM pool.", + "type": { + "$id": "609", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "610", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmProperties.tenantId", + "serializationOptions": { + "json": { + "name": "tenantId" + } + }, + "isHttpMetadata": false + }, + { + "$id": "611", + "kind": "property", + "name": "initialAdminObjectIds", + "serializedName": "initialAdminObjectIds", + "doc": "Array of initial administrators object ids for this managed hsm pool.", + "type": { + "$ref": "547" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmProperties.initialAdminObjectIds", + "serializationOptions": { + "json": { + "name": "initialAdminObjectIds" + } + }, + "isHttpMetadata": false + }, + { + "$id": "612", + "kind": "property", + "name": "hsmUri", + "serializedName": "hsmUri", + "doc": "The URI of the managed hsm pool for performing operations on keys.", + "type": { + "$id": "613", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmProperties.hsmUri", + "serializationOptions": { + "json": { + "name": "hsmUri" + } + }, + "isHttpMetadata": false + }, + { + "$id": "614", + "kind": "property", + "name": "enableSoftDelete", + "serializedName": "enableSoftDelete", + "doc": "Property to specify whether the 'soft delete' functionality is enabled for this managed HSM pool. Soft delete is enabled by default for all managed HSMs and is immutable.", + "type": { + "$id": "615", + "kind": "boolean", + "name": "boolean", + "crossLanguageDefinitionId": "TypeSpec.boolean", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmProperties.enableSoftDelete", + "serializationOptions": { + "json": { + "name": "enableSoftDelete" + } + }, + "isHttpMetadata": false + }, + { + "$id": "616", + "kind": "property", + "name": "softDeleteRetentionInDays", + "serializedName": "softDeleteRetentionInDays", + "doc": "Soft deleted data retention days. When you delete an HSM or a key, it will remain recoverable for the configured retention period or for a default period of 90 days. It accepts values between 7 and 90.", + "type": { + "$id": "617", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmProperties.softDeleteRetentionInDays", + "serializationOptions": { + "json": { + "name": "softDeleteRetentionInDays" + } + }, + "isHttpMetadata": false + }, + { + "$id": "618", + "kind": "property", + "name": "enablePurgeProtection", + "serializedName": "enablePurgeProtection", + "doc": "Property specifying whether protection against purge is enabled for this managed HSM pool. Setting this property to true activates protection against purge for this managed HSM pool and its content - only the Managed HSM service may initiate a hard, irrecoverable deletion. Enabling this functionality is irreversible.", + "type": { + "$id": "619", + "kind": "boolean", + "name": "boolean", + "crossLanguageDefinitionId": "TypeSpec.boolean", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmProperties.enablePurgeProtection", + "serializationOptions": { + "json": { + "name": "enablePurgeProtection" + } + }, + "isHttpMetadata": false + }, + { + "$id": "620", + "kind": "property", + "name": "createMode", + "serializedName": "createMode", + "doc": "The create mode to indicate whether the resource is being created or is being recovered from a deleted resource.", + "type": { + "$ref": "126" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmProperties.createMode", + "serializationOptions": { + "json": { + "name": "createMode" + } + }, + "isHttpMetadata": false + }, + { + "$id": "621", + "kind": "property", + "name": "statusMessage", + "serializedName": "statusMessage", + "doc": "Resource Status Message.", + "type": { + "$id": "622", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmProperties.statusMessage", + "serializationOptions": { + "json": { + "name": "statusMessage" + } + }, + "isHttpMetadata": false + }, + { + "$id": "623", + "kind": "property", + "name": "provisioningState", + "serializedName": "provisioningState", + "doc": "Provisioning state.", + "type": { + "$ref": "130" + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmProperties.provisioningState", + "serializationOptions": { + "json": { + "name": "provisioningState" + } + }, + "isHttpMetadata": false + }, + { + "$id": "624", + "kind": "property", + "name": "NetworkRuleSet", + "serializedName": "networkAcls", + "doc": "Rules governing the accessibility of the key vault from specific network locations.", + "type": { + "$id": "625", + "kind": "model", + "name": "ManagedHsmNetworkRuleSet", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmNetworkRuleSet", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "A set of rules governing the network accessibility of a managed hsm pool.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "626", + "kind": "property", + "name": "bypass", + "serializedName": "bypass", + "doc": "Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'.", + "type": { + "$ref": "140" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmNetworkRuleSet.bypass", + "serializationOptions": { + "json": { + "name": "bypass" + } + }, + "isHttpMetadata": false + }, + { + "$id": "627", + "kind": "property", + "name": "defaultAction", + "serializedName": "defaultAction", + "doc": "The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated.", + "type": { + "$ref": "144" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmNetworkRuleSet.defaultAction", + "serializationOptions": { + "json": { + "name": "defaultAction" + } + }, + "isHttpMetadata": false + }, + { + "$id": "628", + "kind": "property", + "name": "ipRules", + "serializedName": "ipRules", + "doc": "The list of IP address rules.", + "type": { + "$id": "629", + "kind": "array", + "name": "ArrayMhsmipRule", + "valueType": { + "$id": "630", + "kind": "model", + "name": "ManagedHsmIPRule", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmipRule", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "A rule governing the accessibility of a managed HSM pool from a specific IP address or IP range.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "631", + "kind": "property", + "name": "AddressRange", + "serializedName": "value", + "doc": "An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78).", + "type": { + "$id": "632", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmipRule.value", + "serializationOptions": { + "json": { + "name": "value" + } + }, + "isHttpMetadata": false + } + ] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmNetworkRuleSet.ipRules", + "serializationOptions": { + "json": { + "name": "ipRules" + } + }, + "isHttpMetadata": false + }, + { + "$id": "633", + "kind": "property", + "name": "serviceTags", + "serializedName": "serviceTags", + "doc": "The list of service tags.", + "type": { + "$id": "634", + "kind": "array", + "name": "ArrayMhsmServiceTagRule", + "valueType": { + "$id": "635", + "kind": "model", + "name": "ManagedHsmServiceTagRule", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmServiceTagRule", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "A rule governing the accessibility of a managed hsm pool from a specific service tags.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "636", + "kind": "property", + "name": "tag", + "serializedName": "tag", + "doc": "Name of the service tag.", + "type": { + "$id": "637", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmServiceTagRule.tag", + "serializationOptions": { + "json": { + "name": "tag" + } + }, + "isHttpMetadata": false + } + ] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmNetworkRuleSet.serviceTags", + "serializationOptions": { + "json": { + "name": "serviceTags" + } + }, + "isHttpMetadata": false + }, + { + "$id": "638", + "kind": "property", + "name": "virtualNetworkRules", + "serializedName": "virtualNetworkRules", + "doc": "The list of virtual network rules.", + "type": { + "$id": "639", + "kind": "array", + "name": "ArrayMhsmVirtualNetworkRule", + "valueType": { + "$id": "640", + "kind": "model", + "name": "ManagedHsmVirtualNetworkRule", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmVirtualNetworkRule", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "A rule governing the accessibility of a managed hsm pool from a specific virtual network.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "641", + "kind": "property", + "name": "id", + "serializedName": "id", + "doc": "Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'.", + "type": { + "$id": "642", + "kind": "string", + "name": "armResourceIdentifier", + "crossLanguageDefinitionId": "Azure.Core.armResourceIdentifier", + "baseType": { + "$id": "643", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmVirtualNetworkRule.id", + "serializationOptions": { + "json": { + "name": "id" + } + }, + "isHttpMetadata": false + } + ] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmNetworkRuleSet.virtualNetworkRules", + "serializationOptions": { + "json": { + "name": "virtualNetworkRules" + } + }, + "isHttpMetadata": false + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmProperties.networkAcls", + "serializationOptions": { + "json": { + "name": "networkAcls" + } + }, + "isHttpMetadata": false + }, + { + "$id": "644", + "kind": "property", + "name": "regions", + "serializedName": "regions", + "doc": "List of all regions associated with the managed hsm pool.", + "type": { + "$id": "645", + "kind": "array", + "name": "ArrayMhsmGeoReplicatedRegion", + "valueType": { + "$id": "646", + "kind": "model", + "name": "ManagedHsmGeoReplicatedRegion", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmGeoReplicatedRegion", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "A region that this managed HSM Pool has been extended to.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "647", + "kind": "property", + "name": "name", + "serializedName": "name", + "doc": "Name of the geo replicated region.", + "type": { + "$id": "648", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmGeoReplicatedRegion.name", + "serializationOptions": { + "json": { + "name": "name" + } + }, + "isHttpMetadata": false + }, + { + "$id": "649", + "kind": "property", + "name": "provisioningState", + "serializedName": "provisioningState", + "doc": "Provisioning state of the geo replicated region.", + "type": { + "$ref": "148" + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmGeoReplicatedRegion.provisioningState", + "serializationOptions": { + "json": { + "name": "provisioningState" + } + }, + "isHttpMetadata": false + }, + { + "$id": "650", + "kind": "property", + "name": "isPrimary", + "serializedName": "isPrimary", + "doc": "A boolean value that indicates whether the region is the primary region or a secondary region.", + "type": { + "$id": "651", + "kind": "boolean", + "name": "boolean", + "crossLanguageDefinitionId": "TypeSpec.boolean", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmGeoReplicatedRegion.isPrimary", + "serializationOptions": { + "json": { + "name": "isPrimary" + } + }, + "isHttpMetadata": false + } + ] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmProperties.regions", + "serializationOptions": { + "json": { + "name": "regions" + } + }, + "isHttpMetadata": false + }, + { + "$id": "652", + "kind": "property", + "name": "privateEndpointConnections", + "serializedName": "privateEndpointConnections", + "doc": "List of private endpoint connections associated with the managed hsm pool.", + "type": { + "$id": "653", + "kind": "array", + "name": "ArrayMhsmPrivateEndpointConnectionItem", + "valueType": { + "$id": "654", + "kind": "model", + "name": "ManagedHsmPrivateEndpointConnectionItemData", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnectionItem", + "usage": "Output,Json,LroInitial,LroFinalEnvelope", + "doc": "Private endpoint connection item.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "655", + "kind": "property", + "name": "id", + "serializedName": "id", + "doc": "Id of private endpoint connection.", + "type": { + "$id": "656", + "kind": "string", + "name": "armResourceIdentifier", + "crossLanguageDefinitionId": "Azure.Core.armResourceIdentifier", + "baseType": { + "$id": "657", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnectionItem.id", + "serializationOptions": { + "json": { + "name": "id" + } + }, + "isHttpMetadata": false + }, + { + "$id": "658", + "kind": "property", + "name": "etag", + "serializedName": "etag", + "doc": "Modified whenever there is a change in the state of private endpoint connection.", + "type": { + "$id": "659", + "kind": "string", + "name": "eTag", + "crossLanguageDefinitionId": "Azure.Core.eTag", + "baseType": { + "$id": "660", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnectionItem.etag", + "serializationOptions": { + "json": { + "name": "etag" + } + }, + "isHttpMetadata": false + }, + { + "$id": "661", + "kind": "property", + "name": "properties", + "serializedName": "properties", + "doc": "Private endpoint connection properties.", + "type": { + "$id": "662", + "kind": "model", + "name": "ManagedHsmPrivateEndpointConnectionProperties", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnectionProperties", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "Properties of the private endpoint connection resource.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "663", + "kind": "property", + "name": "privateEndpoint", + "serializedName": "privateEndpoint", + "doc": "Properties of the private endpoint object.", + "type": { + "$id": "664", + "kind": "model", + "name": "ManagedHsmPrivateEndpoint", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpoint", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "Private endpoint object properties.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "665", + "kind": "property", + "name": "id", + "serializedName": "id", + "doc": "Full identifier of the private endpoint resource.", + "type": { + "$id": "666", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpoint.id", + "serializationOptions": { + "json": { + "name": "id" + } + }, + "isHttpMetadata": false + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnectionProperties.privateEndpoint", + "serializationOptions": { + "json": { + "name": "privateEndpoint" + } + }, + "isHttpMetadata": false + }, + { + "$id": "667", + "kind": "property", + "name": "privateLinkServiceConnectionState", + "serializedName": "privateLinkServiceConnectionState", + "doc": "Approval state of the private link connection.", + "type": { + "$id": "668", + "kind": "model", + "name": "ManagedHsmPrivateLinkServiceConnectionState", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateLinkServiceConnectionState", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "An object that represents the approval state of the private link connection.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "669", + "kind": "property", + "name": "status", + "serializedName": "status", + "doc": "Indicates whether the connection has been approved, rejected or removed by the key vault owner.", + "type": { + "$ref": "156" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateLinkServiceConnectionState.status", + "serializationOptions": { + "json": { + "name": "status" + } + }, + "isHttpMetadata": false + }, + { + "$id": "670", + "kind": "property", + "name": "description", + "serializedName": "description", + "doc": "The reason for approval or rejection.", + "type": { + "$id": "671", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateLinkServiceConnectionState.description", + "serializationOptions": { + "json": { + "name": "description" + } + }, + "isHttpMetadata": false + }, + { + "$id": "672", + "kind": "property", + "name": "actionsRequired", + "serializedName": "actionsRequired", + "doc": "A message indicating if changes on the service provider require any updates on the consumer.", + "type": { + "$ref": "162" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateLinkServiceConnectionState.actionsRequired", + "serializationOptions": { + "json": { + "name": "actionsRequired" + } + }, + "isHttpMetadata": false + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnectionProperties.privateLinkServiceConnectionState", + "serializationOptions": { + "json": { + "name": "privateLinkServiceConnectionState" + } + }, + "isHttpMetadata": false + }, + { + "$id": "673", + "kind": "property", + "name": "provisioningState", + "serializedName": "provisioningState", + "doc": "Provisioning state of the private endpoint connection.", + "type": { + "$ref": "165" + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnectionProperties.provisioningState", + "serializationOptions": { + "json": { + "name": "provisioningState" + } + }, + "isHttpMetadata": false + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": true, + "decorators": [ + { + "name": "Azure.ResourceManager.@flattenProperty", + "arguments": {} + } + ], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnectionItem.properties", + "serializationOptions": { + "json": { + "name": "properties" + } + }, + "isHttpMetadata": false + } + ] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmProperties.privateEndpointConnections", + "serializationOptions": { + "json": { + "name": "privateEndpointConnections" + } + }, + "isHttpMetadata": false + }, + { + "$id": "674", + "kind": "property", + "name": "publicNetworkAccess", + "serializedName": "publicNetworkAccess", + "doc": "Control permission to the managed HSM from public networks.", + "type": { + "$ref": "173" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmProperties.publicNetworkAccess", + "serializationOptions": { + "json": { + "name": "publicNetworkAccess" + } + }, + "isHttpMetadata": false + }, + { + "$id": "675", + "kind": "property", + "name": "scheduledPurgeDate", + "serializedName": "scheduledPurgeDate", + "doc": "The scheduled purge date in UTC.", + "type": { + "$id": "676", + "kind": "utcDateTime", + "name": "utcDateTime", + "encode": "rfc3339", + "wireType": { + "$id": "677", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.utcDateTime", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmProperties.scheduledPurgeDate", + "serializationOptions": { + "json": { + "name": "scheduledPurgeDate" + } + }, + "isHttpMetadata": false + }, + { + "$id": "678", + "kind": "property", + "name": "securityDomainProperties", + "serializedName": "securityDomainProperties", + "doc": "Managed HSM security domain properties.", + "type": { + "$id": "679", + "kind": "model", + "name": "ManagedHSMSecurityDomainProperties", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHSMSecurityDomainProperties", + "usage": "Output,Json,LroInitial,LroFinalEnvelope", + "doc": "The security domain properties of the managed hsm.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "680", + "kind": "property", + "name": "activationStatus", + "serializedName": "activationStatus", + "doc": "Activation Status", + "type": { + "$ref": "177" + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHSMSecurityDomainProperties.activationStatus", + "serializationOptions": { + "json": { + "name": "activationStatus" + } + }, + "isHttpMetadata": false + }, + { + "$id": "681", + "kind": "property", + "name": "activationStatusMessage", + "serializedName": "activationStatusMessage", + "doc": "Activation Status Message.", + "type": { + "$id": "682", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHSMSecurityDomainProperties.activationStatusMessage", + "serializationOptions": { + "json": { + "name": "activationStatusMessage" + } + }, + "isHttpMetadata": false + } + ] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmProperties.securityDomainProperties", + "serializationOptions": { + "json": { + "name": "securityDomainProperties" + } + }, + "isHttpMetadata": false + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsm.properties", + "serializationOptions": { + "json": { + "name": "properties" + } + }, + "isHttpMetadata": false + }, + { + "$id": "683", + "kind": "property", + "name": "tags", + "serializedName": "tags", + "doc": "Resource tags.", + "type": { + "$ref": "439" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsm.tags", + "serializationOptions": { + "json": { + "name": "tags" + } + }, + "isHttpMetadata": false + }, + { + "$id": "684", + "kind": "property", + "name": "location", + "serializedName": "location", + "doc": "The geo-location where the resource lives", + "type": { + "$id": "685", + "kind": "string", + "name": "azureLocation", + "crossLanguageDefinitionId": "Azure.Core.azureLocation", + "baseType": { + "$id": "686", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsm.location", + "serializationOptions": { + "json": { + "name": "location" + } + }, + "isHttpMetadata": false + }, + { + "$id": "687", + "kind": "property", + "name": "name", + "serializedName": "name", + "doc": "The name of the managed HSM Pool.", + "type": { + "$id": "688", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsm.name", + "serializationOptions": { + "json": { + "name": "name" + } + }, + "isHttpMetadata": true + }, + { + "$id": "689", + "kind": "property", + "name": "sku", + "serializedName": "sku", + "doc": "SKU details", + "type": { + "$id": "690", + "kind": "model", + "name": "ManagedHsmSku", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmSku", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "SKU details", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "691", + "kind": "property", + "name": "family", + "serializedName": "family", + "doc": "SKU Family of the managed HSM Pool", + "type": { + "$ref": "183" + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmSku.family", + "serializationOptions": { + "json": { + "name": "family" + } + }, + "isHttpMetadata": false + }, + { + "$id": "692", + "kind": "property", + "name": "name", + "serializedName": "name", + "doc": "SKU of the managed HSM Pool", + "type": { + "$ref": "187" + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmSku.name", + "serializationOptions": { + "json": { + "name": "name" + } + }, + "isHttpMetadata": false + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsm.sku", + "serializationOptions": { + "json": { + "name": "sku" + } + }, + "isHttpMetadata": false + }, + { + "$id": "693", + "kind": "property", + "name": "identity", + "serializedName": "identity", + "doc": "Managed service identity", + "type": { + "$id": "694", + "kind": "model", + "name": "ManagedServiceIdentity", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentity", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "Managed service identity (system assigned and/or user assigned identities)", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "695", + "kind": "property", + "name": "principalId", + "serializedName": "principalId", + "doc": "The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity.", + "type": { + "$id": "696", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "697", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentity.principalId", + "serializationOptions": { + "json": { + "name": "principalId" + } + }, + "isHttpMetadata": false + }, + { + "$id": "698", + "kind": "property", + "name": "tenantId", + "serializedName": "tenantId", + "doc": "The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity.", + "type": { + "$id": "699", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "700", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentity.tenantId", + "serializationOptions": { + "json": { + "name": "tenantId" + } + }, + "isHttpMetadata": false + }, + { + "$id": "701", + "kind": "property", + "name": "type", + "serializedName": "type", + "doc": "The type of managed identity assigned to this resource.", + "type": { + "$ref": "194" + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentity.type", + "serializationOptions": { + "json": { + "name": "type" + } + }, + "isHttpMetadata": false + }, + { + "$id": "702", + "kind": "property", + "name": "userAssignedIdentities", + "serializedName": "userAssignedIdentities", + "doc": "The identities assigned to this resource by the user.", + "type": { + "$id": "703", + "kind": "dict", + "keyType": { + "$id": "704", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "valueType": { + "$id": "705", + "kind": "nullable", + "type": { + "$id": "706", + "kind": "model", + "name": "UserAssignedIdentity", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.UserAssignedIdentity", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "User assigned identity properties", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "707", + "kind": "property", + "name": "principalId", + "serializedName": "principalId", + "doc": "The principal ID of the assigned identity.", + "type": { + "$id": "708", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "709", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.UserAssignedIdentity.principalId", + "serializationOptions": { + "json": { + "name": "principalId" + } + }, + "isHttpMetadata": false + }, + { + "$id": "710", + "kind": "property", + "name": "clientId", + "serializedName": "clientId", + "doc": "The client ID of the assigned identity.", + "type": { + "$id": "711", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "712", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.UserAssignedIdentity.clientId", + "serializationOptions": { + "json": { + "name": "clientId" + } + }, + "isHttpMetadata": false + } + ] + }, + "namespace": "Azure.ResourceManager.KeyVault" + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentity.userAssignedIdentities", + "serializationOptions": { + "json": { + "name": "userAssignedIdentities" + } + }, + "isHttpMetadata": false + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsm.identity", + "serializationOptions": { + "json": { + "name": "identity" + } + }, + "isHttpMetadata": false + } + ] + }, + { + "$ref": "607" + }, + { + "$ref": "625" + }, + { + "$ref": "630" + }, + { + "$ref": "635" + }, + { + "$ref": "640" + }, + { + "$ref": "646" + }, + { + "$ref": "654" + }, + { + "$ref": "662" + }, + { + "$ref": "664" + }, + { + "$ref": "668" + }, + { + "$ref": "679" + }, + { + "$ref": "690" + }, + { + "$ref": "694" + }, + { + "$ref": "706" + }, + { + "$id": "713", + "kind": "model", + "name": "ManagedHsmError", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmError", + "usage": "Json,Exception", + "doc": "The error exception.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "714", + "kind": "property", + "name": "error", + "serializedName": "error", + "doc": "The server error.", + "type": { + "$id": "715", + "kind": "model", + "name": "Error", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Error", + "usage": "Json,Exception", + "doc": "The server error.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "716", + "kind": "property", + "name": "code", + "serializedName": "code", + "doc": "The error code.", + "type": { + "$id": "717", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Error.code", + "serializationOptions": { + "json": { + "name": "code" + } + }, + "isHttpMetadata": false + }, + { + "$id": "718", + "kind": "property", + "name": "message", + "serializedName": "message", + "doc": "The error message.", + "type": { + "$id": "719", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Error.message", + "serializationOptions": { + "json": { + "name": "message" + } + }, + "isHttpMetadata": false + }, + { + "$id": "720", + "kind": "property", + "name": "innerError", + "serializedName": "innererror", + "doc": "The inner error, contains a more specific error code.", + "type": { + "$ref": "715" + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Error.innererror", + "serializationOptions": { + "json": { + "name": "innererror" + } + }, + "isHttpMetadata": false + } + ] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmError.error", + "serializationOptions": { + "json": { + "name": "error" + } + }, + "isHttpMetadata": false + } + ] + }, + { + "$ref": "715" + }, + { + "$id": "721", + "kind": "model", + "name": "ManagedHsmListResult", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Azure.ResourceManager.ResourceListResult", + "usage": "Output,Json", + "doc": "The response of a ManagedHsm list operation.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "722", + "kind": "property", + "name": "value", + "serializedName": "value", + "doc": "The ManagedHsm items on this page", + "type": { + "$id": "723", + "kind": "array", + "name": "ArrayManagedHsm", + "valueType": { + "$ref": "597" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ResourceListResult.value", + "serializationOptions": { + "json": { + "name": "value" + } + }, + "isHttpMetadata": false + }, + { + "$id": "724", + "kind": "property", + "name": "nextLink", + "serializedName": "nextLink", + "doc": "The link to the next page of items", + "type": { + "$id": "725", + "kind": "url", + "name": "ResourceLocation", + "crossLanguageDefinitionId": "TypeSpec.Rest.ResourceLocation", + "baseType": { + "$id": "726", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ResourceListResult.nextLink", + "serializationOptions": { + "json": { + "name": "nextLink" + } + }, + "isHttpMetadata": false + } + ] + }, + { + "$id": "727", + "kind": "model", + "name": "ManagedHsmPrivateLinkResourceListResult", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateLinkResourceListResult", + "usage": "Output,Json", + "doc": "A list of private link resources", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "728", + "kind": "property", + "name": "value", + "serializedName": "value", + "doc": "Array of private link resources", + "type": { + "$id": "729", + "kind": "array", + "name": "ArrayMhsmPrivateLinkResource", + "valueType": { + "$id": "730", + "kind": "model", + "name": "ManagedHsmPrivateLinkResourceData", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateLinkResource", + "usage": "Output,Json", + "doc": "A private link resource", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "baseModel": { + "$id": "731", + "kind": "model", + "name": "TrackedResource", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.TrackedResource", + "usage": "Output,Json", + "doc": "The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'", + "summary": "Tracked Resource", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "baseModel": { + "$ref": "326" + }, + "properties": [ + { + "$id": "732", + "kind": "property", + "name": "tags", + "serializedName": "tags", + "doc": "Resource tags.", + "type": { + "$ref": "439" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.TrackedResource.tags", + "serializationOptions": { + "json": { + "name": "tags" + } + }, + "isHttpMetadata": false + }, + { + "$id": "733", + "kind": "property", + "name": "location", + "serializedName": "location", + "doc": "The geo-location where the resource lives", + "type": { + "$id": "734", + "kind": "string", + "name": "azureLocation", + "crossLanguageDefinitionId": "Azure.Core.azureLocation", + "baseType": { + "$id": "735", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.CommonTypes.TrackedResource.location", + "serializationOptions": { + "json": { + "name": "location" + } + }, + "isHttpMetadata": false + } + ] + }, + "properties": [ + { + "$id": "736", + "kind": "property", + "name": "properties", + "serializedName": "properties", + "doc": "Resource properties.", + "type": { + "$id": "737", + "kind": "model", + "name": "MhsmPrivateLinkResourceProperties", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateLinkResourceProperties", + "usage": "Output,Json", + "doc": "Properties of a private link resource.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "738", + "kind": "property", + "name": "provisioningState", + "serializedName": "provisioningState", + "doc": "The provisioned state of the resource", + "type": { + "$ref": "130" + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateLinkResourceProperties.provisioningState", + "serializationOptions": { + "json": { + "name": "provisioningState" + } + }, + "isHttpMetadata": false + }, + { + "$id": "739", + "kind": "property", + "name": "groupId", + "serializedName": "groupId", + "doc": "Group identifier of private link resource.", + "type": { + "$id": "740", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateLinkResourceProperties.groupId", + "serializationOptions": { + "json": { + "name": "groupId" + } + }, + "isHttpMetadata": false + }, + { + "$id": "741", + "kind": "property", + "name": "requiredMembers", + "serializedName": "requiredMembers", + "doc": "Required member names of private link resource.", + "type": { + "$ref": "547" + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateLinkResourceProperties.requiredMembers", + "serializationOptions": { + "json": { + "name": "requiredMembers" + } + }, + "isHttpMetadata": false + }, + { + "$id": "742", + "kind": "property", + "name": "requiredZoneNames", + "serializedName": "requiredZoneNames", + "doc": "Required DNS zone names of the the private link resource.", + "type": { + "$ref": "547" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateLinkResourceProperties.requiredZoneNames", + "serializationOptions": { + "json": { + "name": "requiredZoneNames" + } + }, + "isHttpMetadata": false + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": true, + "decorators": [ + { + "name": "Azure.ResourceManager.@flattenProperty", + "arguments": {} + } + ], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateLinkResource.properties", + "serializationOptions": { + "json": { + "name": "properties" + } + }, + "isHttpMetadata": false + }, + { + "$id": "743", + "kind": "property", + "name": "sku", + "serializedName": "sku", + "doc": "SKU details", + "type": { + "$ref": "690" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateLinkResource.sku", + "serializationOptions": { + "json": { + "name": "sku" + } + }, + "isHttpMetadata": false + }, + { + "$id": "744", + "kind": "property", + "name": "identity", + "serializedName": "identity", + "doc": "Managed service identity (system assigned and/or user assigned identities)", + "type": { + "$ref": "694" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateLinkResource.identity", + "serializationOptions": { + "json": { + "name": "identity" + } + }, + "isHttpMetadata": false + } + ] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateLinkResourceListResult.value", + "serializationOptions": { + "json": { + "name": "value" + } + }, + "isHttpMetadata": false + } + ] + }, + { + "$ref": "730" + }, + { + "$ref": "737" + }, + { + "$ref": "731" + }, + { + "$id": "745", + "kind": "model", + "name": "ManagedHsmRegionsListResult", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmRegionsListResult", + "usage": "Output,Json", + "doc": "List of regions associated with a managed HSM Pools", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "746", + "kind": "property", + "name": "value", + "serializedName": "value", + "doc": "The MhsmGeoReplicatedRegion items on this page", + "type": { + "$ref": "645" + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmRegionsListResult.value", + "serializationOptions": { + "json": { + "name": "value" + } + }, + "isHttpMetadata": false + }, + { + "$id": "747", + "kind": "property", + "name": "nextLink", + "serializedName": "nextLink", + "doc": "The link to the next page of items", + "type": { + "$id": "748", + "kind": "url", + "name": "ResourceLocation", + "crossLanguageDefinitionId": "TypeSpec.Rest.ResourceLocation", + "baseType": { + "$id": "749", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmRegionsListResult.nextLink", + "serializationOptions": { + "json": { + "name": "nextLink" + } + }, + "isHttpMetadata": false + } + ] + }, + { + "$id": "750", + "kind": "model", + "name": "DeletedManagedHsm", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedManagedHsm", + "usage": "Output,Json", + "doc": "Concrete proxy resource types can be created by aliasing this type using a specific property type.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + }, + { + "name": "Azure.ResourceManager.Private.@armResourceInternal", + "arguments": {} + }, + { + "name": "TypeSpec.Rest.@parentResource", + "arguments": {} + }, + { + "name": "Azure.ResourceManager.@subscriptionResource", + "arguments": {} + }, + { + "name": "Azure.ClientGenerator.Core.@resourceSchema", + "arguments": { + "resourceIdPattern": "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}", + "resourceType": "Microsoft.KeyVault/locations/deletedManagedHSMs", + "methods": [ + { + "$id": "751", + "methodId": "Microsoft.KeyVault.DeletedManagedHsms.getDeleted", + "kind": "Get", + "operationPath": "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}", + "operationScope": "Subscription", + "resourceScope": "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}" + }, + { + "$id": "752", + "methodId": "Microsoft.KeyVault.DeletedManagedHsms.purgeDeleted", + "kind": "Action", + "operationPath": "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}/purge", + "operationScope": "Subscription", + "resourceScope": "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}" + } + ], + "resourceScope": "Subscription", + "resourceName": "DeletedManagedHsm" + } + } + ], + "baseModel": { + "$ref": "541" + }, + "properties": [ + { + "$id": "753", + "kind": "property", + "name": "properties", + "serializedName": "properties", + "doc": "Properties of the deleted managed HSM", + "type": { + "$id": "754", + "kind": "model", + "name": "DeletedManagedHsmProperties", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedManagedHsmProperties", + "usage": "Output,Json", + "doc": "Properties of the deleted managed HSM.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "755", + "kind": "property", + "name": "managedHsmId", + "serializedName": "mhsmId", + "doc": "The resource id of the original managed HSM.", + "type": { + "$id": "756", + "kind": "string", + "name": "armResourceIdentifier", + "crossLanguageDefinitionId": "Azure.Core.armResourceIdentifier", + "baseType": { + "$id": "757", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedManagedHsmProperties.mhsmId", + "serializationOptions": { + "json": { + "name": "mhsmId" + } + }, + "isHttpMetadata": false + }, + { + "$id": "758", + "kind": "property", + "name": "location", + "serializedName": "location", + "doc": "The location of the original managed HSM.", + "type": { + "$id": "759", + "kind": "string", + "name": "azureLocation", + "crossLanguageDefinitionId": "Azure.Core.azureLocation", + "baseType": { + "$id": "760", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedManagedHsmProperties.location", + "serializationOptions": { + "json": { + "name": "location" + } + }, + "isHttpMetadata": false + }, + { + "$id": "761", + "kind": "property", + "name": "deletionDate", + "serializedName": "deletionDate", + "doc": "The deleted date.", + "type": { + "$id": "762", + "kind": "utcDateTime", + "name": "utcDateTime", + "encode": "rfc3339", + "wireType": { + "$id": "763", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.utcDateTime", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedManagedHsmProperties.deletionDate", + "serializationOptions": { + "json": { + "name": "deletionDate" + } + }, + "isHttpMetadata": false + }, + { + "$id": "764", + "kind": "property", + "name": "scheduledPurgeDate", + "serializedName": "scheduledPurgeDate", + "doc": "The scheduled purged date.", + "type": { + "$id": "765", + "kind": "utcDateTime", + "name": "utcDateTime", + "encode": "rfc3339", + "wireType": { + "$id": "766", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.utcDateTime", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedManagedHsmProperties.scheduledPurgeDate", + "serializationOptions": { + "json": { + "name": "scheduledPurgeDate" + } + }, + "isHttpMetadata": false + }, + { + "$id": "767", + "kind": "property", + "name": "purgeProtectionEnabled", + "serializedName": "purgeProtectionEnabled", + "doc": "Purge protection status of the original managed HSM.", + "type": { + "$id": "768", + "kind": "boolean", + "name": "boolean", + "crossLanguageDefinitionId": "TypeSpec.boolean", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedManagedHsmProperties.purgeProtectionEnabled", + "serializationOptions": { + "json": { + "name": "purgeProtectionEnabled" + } + }, + "isHttpMetadata": false + }, + { + "$id": "769", + "kind": "property", + "name": "tags", + "serializedName": "tags", + "doc": "Tags of the original managed HSM.", + "type": { + "$ref": "439" + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedManagedHsmProperties.tags", + "serializationOptions": { + "json": { + "name": "tags" + } + }, + "isHttpMetadata": false + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedManagedHsm.properties", + "serializationOptions": { + "json": { + "name": "properties" + } + }, + "isHttpMetadata": false + }, + { + "$id": "770", + "kind": "property", + "name": "name", + "serializedName": "name", + "doc": "The name of the deleted managed HSM.", + "type": { + "$id": "771", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedManagedHsm.name", + "serializationOptions": { + "json": { + "name": "name" + } + }, + "isHttpMetadata": true + } + ] + }, + { + "$ref": "754" + }, + { + "$id": "772", + "kind": "model", + "name": "ManagedHsmPrivateEndpointConnection", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnection", + "usage": "Input,Output,Json,LroInitial,LroFinalEnvelope", + "doc": "Private endpoint connection resource.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + }, + { + "name": "Azure.ResourceManager.Private.@armResourceInternal", + "arguments": {} + }, + { + "name": "TypeSpec.Rest.@parentResource", + "arguments": {} + }, + { + "name": "Azure.ClientGenerator.Core.@resourceSchema", + "arguments": { + "resourceIdPattern": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}", + "resourceType": "Microsoft.KeyVault/managedHSMs/privateEndpointConnections", + "methods": [ + { + "$id": "773", + "methodId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.get", + "kind": "Get", + "operationPath": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}", + "operationScope": "ResourceGroup", + "resourceScope": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}" + }, + { + "$id": "774", + "methodId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.put", + "kind": "Create", + "operationPath": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}", + "operationScope": "ResourceGroup", + "resourceScope": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}" + }, + { + "$id": "775", + "methodId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.delete", + "kind": "Delete", + "operationPath": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}", + "operationScope": "ResourceGroup", + "resourceScope": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}" + }, + { + "$id": "776", + "methodId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.listByResource", + "kind": "List", + "operationPath": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections", + "operationScope": "ResourceGroup", + "resourceScope": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}" + } + ], + "resourceScope": "ResourceGroup", + "parentResourceId": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}", + "resourceName": "ManagedHsmPrivateEndpointConnection" + } + } + ], + "baseModel": { + "$ref": "326" + }, + "properties": [ + { + "$id": "777", + "kind": "property", + "name": "properties", + "serializedName": "properties", + "doc": "Resource properties.", + "type": { + "$ref": "662" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": true, + "decorators": [ + { + "name": "Azure.ResourceManager.@flattenProperty", + "arguments": {} + } + ], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnection.properties", + "serializationOptions": { + "json": { + "name": "properties" + } + }, + "isHttpMetadata": false + }, + { + "$id": "778", + "kind": "property", + "name": "tags", + "serializedName": "tags", + "doc": "Resource tags.", + "type": { + "$ref": "439" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnection.tags", + "serializationOptions": { + "json": { + "name": "tags" + } + }, + "isHttpMetadata": false + }, + { + "$id": "779", + "kind": "property", + "name": "location", + "serializedName": "location", + "doc": "The geo-location where the resource lives", + "type": { + "$id": "780", + "kind": "string", + "name": "azureLocation", + "crossLanguageDefinitionId": "Azure.Core.azureLocation", + "baseType": { + "$id": "781", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnection.location", + "serializationOptions": { + "json": { + "name": "location" + } + }, + "isHttpMetadata": false + }, + { + "$id": "782", + "kind": "property", + "name": "name", + "serializedName": "name", + "doc": "Name of the private endpoint connection associated with the managed hsm pool.", + "type": { + "$id": "783", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnection.name", + "serializationOptions": { + "json": { + "name": "name" + } + }, + "isHttpMetadata": true + }, + { + "$id": "784", + "kind": "property", + "name": "sku", + "serializedName": "sku", + "doc": "SKU details", + "type": { + "$ref": "690" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnection.sku", + "serializationOptions": { + "json": { + "name": "sku" + } + }, + "isHttpMetadata": false + }, + { + "$id": "785", + "kind": "property", + "name": "identity", + "serializedName": "identity", + "doc": "Managed service identity", + "type": { + "$ref": "694" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnection.identity", + "serializationOptions": { + "json": { + "name": "identity" + } + }, + "isHttpMetadata": false + }, + { + "$id": "786", + "kind": "property", + "name": "etag", + "serializedName": "etag", + "doc": "Modified whenever there is a change in the state of private endpoint connection.", + "type": { + "$id": "787", + "kind": "string", + "name": "eTag", + "crossLanguageDefinitionId": "Azure.Core.eTag", + "baseType": { + "$id": "788", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnection.etag", + "serializationOptions": { + "json": { + "name": "etag" + } + }, + "isHttpMetadata": false + } + ] + }, + { + "$id": "789", + "kind": "model", + "name": "MHSMPrivateEndpointConnectionsListResult", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.MHSMPrivateEndpointConnectionsListResult", + "usage": "Output,Json", + "doc": "List of private endpoint connections associated with a managed HSM Pools", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "790", + "kind": "property", + "name": "value", + "serializedName": "value", + "doc": "The MhsmPrivateEndpointConnection items on this page", + "type": { + "$id": "791", + "kind": "array", + "name": "ArrayMhsmPrivateEndpointConnection", + "valueType": { + "$ref": "772" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MHSMPrivateEndpointConnectionsListResult.value", + "serializationOptions": { + "json": { + "name": "value" + } + }, + "isHttpMetadata": false + }, + { + "$id": "792", + "kind": "property", + "name": "nextLink", + "serializedName": "nextLink", + "doc": "The link to the next page of items", + "type": { + "$id": "793", + "kind": "url", + "name": "ResourceLocation", + "crossLanguageDefinitionId": "TypeSpec.Rest.ResourceLocation", + "baseType": { + "$id": "794", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MHSMPrivateEndpointConnectionsListResult.nextLink", + "serializationOptions": { + "json": { + "name": "nextLink" + } + }, + "isHttpMetadata": false + } + ] + }, + { + "$id": "795", + "kind": "model", + "name": "KeyVaultSecret", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secret", + "usage": "Output,Json", + "doc": "Resource information with extended details.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + }, + { + "name": "Azure.ResourceManager.Private.@armResourceInternal", + "arguments": {} + }, + { + "name": "TypeSpec.Rest.@parentResource", + "arguments": {} + }, + { + "name": "Azure.ClientGenerator.Core.@resourceSchema", + "arguments": { + "resourceIdPattern": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}", + "resourceType": "Microsoft.KeyVault/vaults/secrets", + "methods": [ + { + "$id": "796", + "methodId": "Microsoft.KeyVault.Secrets.get", + "kind": "Get", + "operationPath": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}", + "operationScope": "ResourceGroup", + "resourceScope": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}" + }, + { + "$id": "797", + "methodId": "Microsoft.KeyVault.Secrets.createOrUpdate", + "kind": "Create", + "operationPath": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}", + "operationScope": "ResourceGroup", + "resourceScope": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}" + }, + { + "$id": "798", + "methodId": "Microsoft.KeyVault.Secrets.update", + "kind": "Update", + "operationPath": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}", + "operationScope": "ResourceGroup", + "resourceScope": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}" + }, + { + "$id": "799", + "methodId": "Microsoft.KeyVault.Secrets.list", + "kind": "List", + "operationPath": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets", + "operationScope": "ResourceGroup", + "resourceScope": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}" + } + ], + "resourceScope": "ResourceGroup", + "parentResourceId": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}", + "resourceName": "KeyVaultSecret" + } + } + ], + "baseModel": { + "$ref": "541" + }, + "properties": [ + { + "$id": "800", + "kind": "property", + "name": "properties", + "serializedName": "properties", + "doc": "Properties of the secret", + "type": { + "$id": "801", + "kind": "model", + "name": "SecretProperties", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.SecretProperties", + "usage": "Input,Output,Json", + "doc": "Properties of the secret", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "802", + "kind": "property", + "name": "value", + "serializedName": "value", + "doc": "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.", + "type": { + "$id": "803", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.SecretProperties.value", + "serializationOptions": { + "json": { + "name": "value" + } + }, + "isHttpMetadata": false + }, + { + "$id": "804", + "kind": "property", + "name": "contentType", + "serializedName": "contentType", + "doc": "The content type of the secret.", + "type": { + "$id": "805", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.SecretProperties.contentType", + "serializationOptions": { + "json": { + "name": "contentType" + } + }, + "isHttpMetadata": false + }, + { + "$id": "806", + "kind": "property", + "name": "attributes", + "serializedName": "attributes", + "doc": "The attributes of the secret.", + "type": { + "$id": "807", + "kind": "model", + "name": "SecretAttributes", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.SecretAttributes", + "usage": "Input,Output,Json", + "doc": "The secret management attributes.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "baseModel": { + "$id": "808", + "kind": "model", + "name": "SecretBaseAttributes", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Attributes", + "usage": "Input,Output,Json", + "doc": "The object attributes managed by the KeyVault service.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "809", + "kind": "property", + "name": "enabled", + "serializedName": "enabled", + "doc": "Determines whether the object is enabled.", + "type": { + "$id": "810", + "kind": "boolean", + "name": "boolean", + "crossLanguageDefinitionId": "TypeSpec.boolean", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Attributes.enabled", + "serializationOptions": { + "json": { + "name": "enabled" + } + }, + "isHttpMetadata": false + }, + { + "$id": "811", + "kind": "property", + "name": "NotBefore", + "serializedName": "nbf", + "doc": "Not before date in seconds since 1970-01-01T00:00:00Z.", + "type": { + "$id": "812", + "kind": "utcDateTime", + "name": "utcDateTime", + "encode": "unixTimestamp", + "wireType": { + "$id": "813", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.utcDateTime", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Attributes.nbf", + "serializationOptions": { + "json": { + "name": "nbf" + } + }, + "isHttpMetadata": false + }, + { + "$id": "814", + "kind": "property", + "name": "Expires", + "serializedName": "exp", + "doc": "Expiry date in seconds since 1970-01-01T00:00:00Z.", + "type": { + "$id": "815", + "kind": "utcDateTime", + "name": "utcDateTime", + "encode": "unixTimestamp", + "wireType": { + "$id": "816", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.utcDateTime", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Attributes.exp", + "serializationOptions": { + "json": { + "name": "exp" + } + }, + "isHttpMetadata": false + }, + { + "$id": "817", + "kind": "property", + "name": "created", + "serializedName": "created", + "doc": "Creation time in seconds since 1970-01-01T00:00:00Z.", + "type": { + "$id": "818", + "kind": "utcDateTime", + "name": "utcDateTime", + "encode": "unixTimestamp", + "wireType": { + "$id": "819", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.utcDateTime", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Attributes.created", + "serializationOptions": { + "json": { + "name": "created" + } + }, + "isHttpMetadata": false + }, + { + "$id": "820", + "kind": "property", + "name": "updated", + "serializedName": "updated", + "doc": "Last updated time in seconds since 1970-01-01T00:00:00Z.", + "type": { + "$id": "821", + "kind": "utcDateTime", + "name": "utcDateTime", + "encode": "unixTimestamp", + "wireType": { + "$id": "822", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.utcDateTime", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Attributes.updated", + "serializationOptions": { + "json": { + "name": "updated" + } + }, + "isHttpMetadata": false + } + ] + }, + "properties": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.SecretProperties.attributes", + "serializationOptions": { + "json": { + "name": "attributes" + } + }, + "isHttpMetadata": false + }, + { + "$id": "823", + "kind": "property", + "name": "secretUri", + "serializedName": "secretUri", + "doc": "The URI to retrieve the current version of the secret.", + "type": { + "$id": "824", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.SecretProperties.secretUri", + "serializationOptions": { + "json": { + "name": "secretUri" + } + }, + "isHttpMetadata": false + }, + { + "$id": "825", + "kind": "property", + "name": "secretUriWithVersion", + "serializedName": "secretUriWithVersion", + "doc": "The URI to retrieve the specific version of the secret.", + "type": { + "$id": "826", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.SecretProperties.secretUriWithVersion", + "serializationOptions": { + "json": { + "name": "secretUriWithVersion" + } + }, + "isHttpMetadata": false + } + ] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secret.properties", + "serializationOptions": { + "json": { + "name": "properties" + } + }, + "isHttpMetadata": false + }, + { + "$id": "827", + "kind": "property", + "name": "name", + "serializedName": "name", + "doc": "The name of the secret.", + "type": { + "$id": "828", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secret.name", + "serializationOptions": { + "json": { + "name": "name" + } + }, + "isHttpMetadata": true + }, + { + "$id": "829", + "kind": "property", + "name": "location", + "serializedName": "location", + "doc": "Azure location of the key vault resource.", + "type": { + "$id": "830", + "kind": "string", + "name": "azureLocation", + "crossLanguageDefinitionId": "Azure.Core.azureLocation", + "baseType": { + "$id": "831", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secret.location", + "serializationOptions": { + "json": { + "name": "location" + } + }, + "isHttpMetadata": false + }, + { + "$id": "832", + "kind": "property", + "name": "tags", + "serializedName": "tags", + "doc": "Tags assigned to the key vault resource.", + "type": { + "$ref": "439" + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secret.tags", + "serializationOptions": { + "json": { + "name": "tags" + } + }, + "isHttpMetadata": false + } + ] + }, + { + "$ref": "801" + }, + { + "$ref": "807" + }, + { + "$ref": "808" + }, + { + "$id": "833", + "kind": "model", + "name": "SecretCreateOrUpdateParameters", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.SecretCreateOrUpdateParameters", + "usage": "Input,Json", + "doc": "Parameters for creating or updating a secret", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "834", + "kind": "property", + "name": "tags", + "serializedName": "tags", + "doc": "The tags that will be assigned to the secret.", + "type": { + "$ref": "439" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.SecretCreateOrUpdateParameters.tags", + "serializationOptions": { + "json": { + "name": "tags" + } + }, + "isHttpMetadata": false + }, + { + "$id": "835", + "kind": "property", + "name": "properties", + "serializedName": "properties", + "doc": "Properties of the secret", + "type": { + "$ref": "801" + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.SecretCreateOrUpdateParameters.properties", + "serializationOptions": { + "json": { + "name": "properties" + } + }, + "isHttpMetadata": false + } + ] + }, + { + "$id": "836", + "kind": "model", + "name": "SecretPatchParameters", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.SecretPatchParameters", + "usage": "Input,Json", + "doc": "Parameters for patching a secret", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "837", + "kind": "property", + "name": "tags", + "serializedName": "tags", + "doc": "The tags that will be assigned to the secret.", + "type": { + "$ref": "439" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.SecretPatchParameters.tags", + "serializationOptions": { + "json": { + "name": "tags" + } + }, + "isHttpMetadata": false + }, + { + "$id": "838", + "kind": "property", + "name": "properties", + "serializedName": "properties", + "doc": "Properties of the secret", + "type": { + "$id": "839", + "kind": "model", + "name": "SecretPatchProperties", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.SecretPatchProperties", + "usage": "Input,Json", + "doc": "Properties of the secret", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "840", + "kind": "property", + "name": "value", + "serializedName": "value", + "doc": "The value of the secret.", + "type": { + "$id": "841", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.SecretPatchProperties.value", + "serializationOptions": { + "json": { + "name": "value" + } + }, + "isHttpMetadata": false + }, + { + "$id": "842", + "kind": "property", + "name": "contentType", + "serializedName": "contentType", + "doc": "The content type of the secret.", + "type": { + "$id": "843", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.SecretPatchProperties.contentType", + "serializationOptions": { + "json": { + "name": "contentType" + } + }, + "isHttpMetadata": false + }, + { + "$id": "844", + "kind": "property", + "name": "attributes", + "serializedName": "attributes", + "doc": "The attributes of the secret.", + "type": { + "$ref": "807" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.SecretPatchProperties.attributes", + "serializationOptions": { + "json": { + "name": "attributes" + } + }, + "isHttpMetadata": false + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.SecretPatchParameters.properties", + "serializationOptions": { + "json": { + "name": "properties" + } + }, + "isHttpMetadata": false + } + ] + }, + { + "$ref": "839" + }, + { + "$id": "845", + "kind": "model", + "name": "SecretListResult", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Azure.ResourceManager.ResourceListResult", + "usage": "Output,Json", + "doc": "The response of a Secret list operation.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "846", + "kind": "property", + "name": "value", + "serializedName": "value", + "doc": "The Secret items on this page", + "type": { + "$id": "847", + "kind": "array", + "name": "ArraySecret", + "valueType": { + "$ref": "795" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ResourceListResult.value", + "serializationOptions": { + "json": { + "name": "value" + } + }, + "isHttpMetadata": false + }, + { + "$id": "848", + "kind": "property", + "name": "nextLink", + "serializedName": "nextLink", + "doc": "The link to the next page of items", + "type": { + "$id": "849", + "kind": "url", + "name": "ResourceLocation", + "crossLanguageDefinitionId": "TypeSpec.Rest.ResourceLocation", + "baseType": { + "$id": "850", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ResourceListResult.nextLink", + "serializationOptions": { + "json": { + "name": "nextLink" + } + }, + "isHttpMetadata": false + } + ] + }, + { + "$id": "851", + "kind": "model", + "name": "DeletedVaultListResult", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Azure.ResourceManager.ResourceListResult", + "usage": "Output,Json", + "doc": "The response of a DeletedVault list operation.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "852", + "kind": "property", + "name": "value", + "serializedName": "value", + "doc": "The DeletedVault items on this page", + "type": { + "$id": "853", + "kind": "array", + "name": "ArrayDeletedVault", + "valueType": { + "$ref": "554" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ResourceListResult.value", + "serializationOptions": { + "json": { + "name": "value" + } + }, + "isHttpMetadata": false + }, + { + "$id": "854", + "kind": "property", + "name": "nextLink", + "serializedName": "nextLink", + "doc": "The link to the next page of items", + "type": { + "$id": "855", + "kind": "url", + "name": "ResourceLocation", + "crossLanguageDefinitionId": "TypeSpec.Rest.ResourceLocation", + "baseType": { + "$id": "856", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ResourceListResult.nextLink", + "serializationOptions": { + "json": { + "name": "nextLink" + } + }, + "isHttpMetadata": false + } + ] + }, + { + "$id": "857", + "kind": "model", + "name": "KeyVaultNameAvailabilityContent", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultCheckNameAvailabilityParameters", + "usage": "Input,Json", + "doc": "The parameters used to check the availability of the vault name.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "858", + "kind": "property", + "name": "name", + "serializedName": "name", + "doc": "The vault name.", + "type": { + "$id": "859", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultCheckNameAvailabilityParameters.name", + "serializationOptions": { + "json": { + "name": "name" + } + }, + "isHttpMetadata": false + }, + { + "$id": "860", + "kind": "property", + "name": "ResourceType", + "serializedName": "type", + "doc": "The type of resource, Microsoft.KeyVault/vaults", + "type": { + "$id": "861", + "kind": "string", + "name": "armResourceType", + "crossLanguageDefinitionId": "Azure.Core.armResourceType", + "baseType": { + "$id": "862", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultCheckNameAvailabilityParameters.type", + "serializationOptions": { + "json": { + "name": "type" + } + }, + "isHttpMetadata": false + } + ] + }, + { + "$id": "863", + "kind": "model", + "name": "KeyVaultNameAvailabilityResult", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.CheckNameAvailabilityResult", + "usage": "Output,Json", + "doc": "The CheckNameAvailability operation response.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "864", + "kind": "property", + "name": "nameAvailable", + "serializedName": "nameAvailable", + "doc": "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.", + "type": { + "$id": "865", + "kind": "boolean", + "name": "boolean", + "crossLanguageDefinitionId": "TypeSpec.boolean", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.CheckNameAvailabilityResult.nameAvailable", + "serializationOptions": { + "json": { + "name": "nameAvailable" + } + }, + "isHttpMetadata": false + }, + { + "$id": "866", + "kind": "property", + "name": "reason", + "serializedName": "reason", + "doc": "The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false.", + "type": { + "$ref": "200" + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.CheckNameAvailabilityResult.reason", + "serializationOptions": { + "json": { + "name": "reason" + } + }, + "isHttpMetadata": false + }, + { + "$id": "867", + "kind": "property", + "name": "message", + "serializedName": "message", + "doc": "An error message explaining the Reason value in more detail.", + "type": { + "$id": "868", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.CheckNameAvailabilityResult.message", + "serializationOptions": { + "json": { + "name": "message" + } + }, + "isHttpMetadata": false + } + ] + }, + { + "$id": "869", + "kind": "model", + "name": "DeletedManagedHsmListResult", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Azure.ResourceManager.ResourceListResult", + "usage": "Output,Json", + "doc": "The response of a DeletedManagedHsm list operation.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "870", + "kind": "property", + "name": "value", + "serializedName": "value", + "doc": "The DeletedManagedHsm items on this page", + "type": { + "$id": "871", + "kind": "array", + "name": "ArrayDeletedManagedHsm", + "valueType": { + "$ref": "750" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ResourceListResult.value", + "serializationOptions": { + "json": { + "name": "value" + } + }, + "isHttpMetadata": false + }, + { + "$id": "872", + "kind": "property", + "name": "nextLink", + "serializedName": "nextLink", + "doc": "The link to the next page of items", + "type": { + "$id": "873", + "kind": "url", + "name": "ResourceLocation", + "crossLanguageDefinitionId": "TypeSpec.Rest.ResourceLocation", + "baseType": { + "$id": "874", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.ResourceManager.ResourceListResult.nextLink", + "serializationOptions": { + "json": { + "name": "nextLink" + } + }, + "isHttpMetadata": false + } + ] + }, + { + "$id": "875", + "kind": "model", + "name": "ManagedHsmNameAvailabilityParameters", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.CheckMhsmNameAvailabilityParameters", + "usage": "Input,Json", + "doc": "The parameters used to check the availability of the managed hsm name.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "876", + "kind": "property", + "name": "name", + "serializedName": "name", + "doc": "The managed hsm name.", + "type": { + "$id": "877", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.CheckMhsmNameAvailabilityParameters.name", + "serializationOptions": { + "json": { + "name": "name" + } + }, + "isHttpMetadata": false + } + ] + }, + { + "$id": "878", + "kind": "model", + "name": "ManagedHsmNameAvailabilityResult", + "namespace": "Azure.ResourceManager.KeyVault", + "crossLanguageDefinitionId": "Microsoft.KeyVault.CheckMhsmNameAvailabilityResult", + "usage": "Output,Json", + "doc": "The CheckMhsmNameAvailability operation response.", + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + } + ], + "properties": [ + { + "$id": "879", + "kind": "property", + "name": "IsNameAvailable", + "serializedName": "nameAvailable", + "doc": "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.", + "type": { + "$id": "880", + "kind": "boolean", + "name": "boolean", + "crossLanguageDefinitionId": "TypeSpec.boolean", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.CheckMhsmNameAvailabilityResult.nameAvailable", + "serializationOptions": { + "json": { + "name": "nameAvailable" + } + }, + "isHttpMetadata": false + }, + { + "$id": "881", + "kind": "property", + "name": "reason", + "serializedName": "reason", + "doc": "The reason that a managed hsm name could not be used. The reason element is only returned if NameAvailable is false.", + "type": { + "$ref": "204" + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.CheckMhsmNameAvailabilityResult.reason", + "serializationOptions": { + "json": { + "name": "reason" + } + }, + "isHttpMetadata": false + }, + { + "$id": "882", + "kind": "property", + "name": "message", + "serializedName": "message", + "doc": "An error message explaining the Reason value in more detail.", + "type": { + "$id": "883", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.CheckMhsmNameAvailabilityResult.message", + "serializationOptions": { + "json": { + "name": "message" + } + }, + "isHttpMetadata": false + } + ] + } + ], + "clients": [ + { + "$id": "884", + "kind": "client", + "name": "KeyVaultClient", + "namespace": "Azure.ResourceManager.KeyVault", + "doc": "The Azure management API provides a RESTful set of web services that interact with Azure Key Vault.", + "methods": [], + "parameters": [ + { + "$id": "885", + "kind": "endpoint", + "name": "endpoint", + "serializedName": "endpoint", + "doc": "Service host", + "type": { + "$id": "886", + "kind": "url", + "name": "endpoint", + "crossLanguageDefinitionId": "TypeSpec.url" + }, + "isApiVersion": false, + "optional": false, + "scope": "Client", + "isEndpoint": true, + "defaultValue": { + "type": { + "$id": "887", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "https://management.azure.com" + }, + "serverUrlTemplate": "{endpoint}", + "skipUrlEncoding": false, + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.endpoint" + } + ], + "decorators": [ + { + "name": "Azure.ResourceManager.@armProviderNamespace", + "arguments": {} + }, + { + "name": "Azure.ClientGenerator.Core.@nonResourceMethodSchema", + "arguments": { + "nonResourceMethods": [ + { + "methodId": "Microsoft.KeyVault.Vaults.updateAccessPolicy", + "operationPath": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}", + "operationScope": "ResourceGroup" + }, + { + "methodId": "Microsoft.KeyVault.VaultsOperationGroup.listDeleted", + "operationPath": "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults", + "operationScope": "Subscription" + }, + { + "methodId": "Microsoft.KeyVault.VaultsOperationGroup.checkNameAvailability", + "operationPath": "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability", + "operationScope": "Subscription" + }, + { + "methodId": "Microsoft.KeyVault.ManagedHsmsOperationGroup.listDeleted", + "operationPath": "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedManagedHSMs", + "operationScope": "Subscription" + }, + { + "methodId": "Microsoft.KeyVault.ManagedHsmsOperationGroup.checkMhsmNameAvailability", + "operationPath": "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkMhsmNameAvailability", + "operationScope": "Subscription" + } + ] + } + } + ], + "crossLanguageDefinitionId": "Microsoft.KeyVault", + "apiVersions": [ + "2025-05-01" + ], + "children": [ + { + "$id": "888", + "kind": "client", + "name": "Vaults", + "namespace": "Azure.ResourceManager.KeyVault", + "methods": [ + { + "$id": "889", + "kind": "basic", + "name": "get", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "Gets the specified Azure key vault.", + "operation": { + "$id": "890", + "name": "get", + "resourceName": "Vault", + "doc": "Gets the specified Azure key vault.", + "accessibility": "public", + "parameters": [ + { + "$id": "891", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "892", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "893", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.get.apiVersion", + "readOnly": false + }, + { + "$id": "894", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "895", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "896", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.get.subscriptionId" + }, + { + "$id": "897", + "kind": "path", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "898", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.get.resourceGroupName" + }, + { + "$id": "899", + "kind": "path", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "The name of the vault.", + "type": { + "$id": "900", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.get.vaultName" + }, + { + "$id": "901", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "216" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.get.accept" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "318" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.get", + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceRead", + "arguments": {} + } + ], + "examples": [ + { + "$id": "902", + "kind": "http", + "name": "Retrieve a vault", + "description": "Retrieve a vault", + "filePath": "2025-05-01/getVault.json", + "parameters": [ + { + "parameter": { + "$ref": "891" + }, + "value": { + "$id": "903", + "kind": "string", + "type": { + "$ref": "892" + }, + "value": "2025-05-01" + } + }, + { + "parameter": { + "$ref": "897" + }, + "value": { + "$id": "904", + "kind": "string", + "type": { + "$ref": "898" + }, + "value": "sample-resource-group" + } + }, + { + "parameter": { + "$ref": "894" + }, + "value": { + "$id": "905", + "kind": "string", + "type": { + "$ref": "895" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + }, + { + "parameter": { + "$ref": "899" + }, + "value": { + "$id": "906", + "kind": "string", + "type": { + "$ref": "900" + }, + "value": "sample-vault" + } + } + ], + "responses": [ + { + "response": { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "318" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + "statusCode": 200, + "bodyValue": { + "$id": "907", + "kind": "model", + "type": { + "$ref": "318" + }, + "value": { + "name": { + "$id": "908", + "kind": "string", + "type": { + "$ref": "446" + }, + "value": "sample-vault" + }, + "type": { + "$id": "909", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/vaults" + }, + "id": { + "$id": "910", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-resource-group/providers/Microsoft.KeyVault/vaults/sample-vault" + }, + "location": { + "$id": "911", + "kind": "string", + "type": { + "$ref": "443" + }, + "value": "westus" + }, + "properties": { + "$id": "912", + "kind": "model", + "type": { + "$ref": "350" + }, + "value": { + "accessPolicies": { + "$id": "913", + "kind": "array", + "type": { + "$ref": "359" + }, + "value": [ + { + "$id": "914", + "kind": "model", + "type": { + "$ref": "360" + }, + "value": { + "objectId": { + "$id": "915", + "kind": "string", + "type": { + "$ref": "365" + }, + "value": "00000000-0000-0000-0000-000000000000" + }, + "permissions": { + "$id": "916", + "kind": "model", + "type": { + "$ref": "370" + }, + "value": { + "certificates": { + "$id": "917", + "kind": "array", + "type": { + "$ref": "376" + }, + "value": [ + { + "$id": "918", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "get" + }, + { + "$id": "919", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "list" + }, + { + "$id": "920", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "delete" + }, + { + "$id": "921", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "create" + }, + { + "$id": "922", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "import" + }, + { + "$id": "923", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "update" + }, + { + "$id": "924", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "managecontacts" + }, + { + "$id": "925", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "getissuers" + }, + { + "$id": "926", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "listissuers" + }, + { + "$id": "927", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "setissuers" + }, + { + "$id": "928", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "deleteissuers" + }, + { + "$id": "929", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "manageissuers" + }, + { + "$id": "930", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "recover" + }, + { + "$id": "931", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "purge" + } + ] + }, + "keys": { + "$id": "932", + "kind": "array", + "type": { + "$ref": "372" + }, + "value": [ + { + "$id": "933", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "encrypt" + }, + { + "$id": "934", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "decrypt" + }, + { + "$id": "935", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "wrapKey" + }, + { + "$id": "936", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "unwrapKey" + }, + { + "$id": "937", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "sign" + }, + { + "$id": "938", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "verify" + }, + { + "$id": "939", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "get" + }, + { + "$id": "940", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "list" + }, + { + "$id": "941", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "create" + }, + { + "$id": "942", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "update" + }, + { + "$id": "943", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "import" + }, + { + "$id": "944", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "delete" + }, + { + "$id": "945", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "backup" + }, + { + "$id": "946", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "restore" + }, + { + "$id": "947", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "recover" + }, + { + "$id": "948", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "purge" + } + ] + }, + "secrets": { + "$id": "949", + "kind": "array", + "type": { + "$ref": "374" + }, + "value": [ + { + "$id": "950", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "get" + }, + { + "$id": "951", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "list" + }, + { + "$id": "952", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "set" + }, + { + "$id": "953", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "delete" + }, + { + "$id": "954", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "backup" + }, + { + "$id": "955", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "restore" + }, + { + "$id": "956", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "recover" + }, + { + "$id": "957", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "purge" + } + ] + } + } + }, + "tenantId": { + "$id": "958", + "kind": "string", + "type": { + "$ref": "362" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + } + ] + }, + "enabledForDeployment": { + "$id": "959", + "kind": "boolean", + "type": { + "$ref": "384" + }, + "value": true + }, + "enabledForDiskEncryption": { + "$id": "960", + "kind": "boolean", + "type": { + "$ref": "386" + }, + "value": true + }, + "enabledForTemplateDeployment": { + "$id": "961", + "kind": "boolean", + "type": { + "$ref": "388" + }, + "value": true + }, + "hsmPoolResourceId": { + "$id": "962", + "kind": "string", + "type": { + "$ref": "382" + }, + "value": "00000000-0000-0000-0000-000000000000" + }, + "provisioningState": { + "$id": "963", + "kind": "string", + "type": { + "$ref": "90" + }, + "value": "Succeeded" + }, + "publicNetworkAccess": { + "$id": "964", + "kind": "string", + "type": { + "$ref": "437" + }, + "value": "Enabled" + }, + "sku": { + "$id": "965", + "kind": "model", + "type": { + "$ref": "355" + }, + "value": { + "name": { + "$id": "966", + "kind": "string", + "type": { + "$ref": "4" + }, + "value": "standard" + }, + "family": { + "$id": "967", + "kind": "string", + "type": { + "$ref": "1" + }, + "value": "A" + } + } + }, + "tenantId": { + "$id": "968", + "kind": "string", + "type": { + "$ref": "352" + }, + "value": "00000000-0000-0000-0000-000000000000" + }, + "vaultUri": { + "$id": "969", + "kind": "string", + "type": { + "$ref": "380" + }, + "value": "https://sample-vault.vault.azure.net" + } + } + }, + "systemData": { + "$id": "970", + "kind": "model", + "type": { + "$ref": "336" + }, + "value": { + "createdAt": { + "$id": "971", + "kind": "string", + "type": { + "$ref": "341" + }, + "value": "2020-01-01T12:00:00.0000000Z" + }, + "createdBy": { + "$id": "972", + "kind": "string", + "type": { + "$ref": "338" + }, + "value": "keyVaultUser1" + }, + "createdByType": { + "$id": "973", + "kind": "string", + "type": { + "$ref": "111" + }, + "value": "User" + }, + "lastModifiedAt": { + "$id": "974", + "kind": "string", + "type": { + "$ref": "347" + }, + "value": "2020-01-01T12:00:00.0000000Z" + }, + "lastModifiedBy": { + "$id": "975", + "kind": "string", + "type": { + "$ref": "344" + }, + "value": "keyVaultUser2" + }, + "lastModifiedByType": { + "$id": "976", + "kind": "string", + "type": { + "$ref": "111" + }, + "value": "User" + } + } + }, + "tags": { + "$id": "977", + "kind": "dict", + "type": { + "$ref": "439" + }, + "value": {} + } + } + } + } + ] + } + ] + }, + "parameters": [ + { + "$id": "978", + "kind": "method", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "979", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.get.resourceGroupName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "980", + "kind": "method", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "The name of the vault.", + "type": { + "$id": "981", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.get.vaultName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "982", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "216" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.get.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$ref": "318" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.get" + }, + { + "$id": "983", + "kind": "lro", + "name": "createOrUpdate", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "Create or update a key vault in the specified subscription.", + "operation": { + "$id": "984", + "name": "createOrUpdate", + "resourceName": "Vault", + "doc": "Create or update a key vault in the specified subscription.", + "accessibility": "public", + "parameters": [ + { + "$id": "985", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "986", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "987", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.createOrUpdate.apiVersion", + "readOnly": false + }, + { + "$id": "988", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "989", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "990", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.createOrUpdate.subscriptionId" + }, + { + "$id": "991", + "kind": "path", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "992", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.createOrUpdate.resourceGroupName" + }, + { + "$id": "993", + "kind": "path", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "The name of the vault.", + "type": { + "$id": "994", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.createOrUpdate.vaultName" + }, + { + "$id": "995", + "kind": "header", + "name": "contentType", + "serializedName": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$ref": "218" + }, + "isApiVersion": false, + "optional": false, + "isContentType": true, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.createOrUpdate.contentType" + }, + { + "$id": "996", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "220" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.createOrUpdate.accept" + }, + { + "$id": "997", + "kind": "body", + "name": "parameters", + "serializedName": "parameters", + "doc": "Parameters to create or update the vault", + "type": { + "$ref": "454" + }, + "isApiVersion": false, + "contentTypes": [ + "application/json" + ], + "defaultContentType": "application/json", + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.createOrUpdate.resource" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "318" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + { + "statusCodes": [ + 201 + ], + "bodyType": { + "$ref": "318" + }, + "headers": [ + { + "name": "location", + "nameInResponse": "Location", + "doc": "The Location header contains the URL where the status of the long running operation can be checked.", + "type": { + "$id": "998", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "name": "retryAfter", + "nameInResponse": "Retry-After", + "doc": "The Retry-After header can indicate how long the client should wait before polling the operation status.", + "type": { + "$id": "999", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "PUT", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.createOrUpdate", + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceCreateOrUpdate", + "arguments": {} + } + ], + "examples": [ + { + "$id": "1000", + "kind": "http", + "name": "Create a new vault or update an existing vault", + "description": "Create a new vault or update an existing vault", + "filePath": "2025-05-01/createVault.json", + "parameters": [ + { + "parameter": { + "$ref": "985" + }, + "value": { + "$id": "1001", + "kind": "string", + "type": { + "$ref": "986" + }, + "value": "2025-05-01" + } + }, + { + "parameter": { + "$ref": "997" + }, + "value": { + "$id": "1002", + "kind": "model", + "type": { + "$ref": "454" + }, + "value": { + "location": { + "$id": "1003", + "kind": "string", + "type": { + "$ref": "456" + }, + "value": "westus" + }, + "properties": { + "$id": "1004", + "kind": "model", + "type": { + "$ref": "350" + }, + "value": { + "accessPolicies": { + "$id": "1005", + "kind": "array", + "type": { + "$ref": "359" + }, + "value": [ + { + "$id": "1006", + "kind": "model", + "type": { + "$ref": "360" + }, + "value": { + "objectId": { + "$id": "1007", + "kind": "string", + "type": { + "$ref": "365" + }, + "value": "00000000-0000-0000-0000-000000000000" + }, + "permissions": { + "$id": "1008", + "kind": "model", + "type": { + "$ref": "370" + }, + "value": { + "certificates": { + "$id": "1009", + "kind": "array", + "type": { + "$ref": "376" + }, + "value": [ + { + "$id": "1010", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "get" + }, + { + "$id": "1011", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "list" + }, + { + "$id": "1012", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "delete" + }, + { + "$id": "1013", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "create" + }, + { + "$id": "1014", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "import" + }, + { + "$id": "1015", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "update" + }, + { + "$id": "1016", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "managecontacts" + }, + { + "$id": "1017", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "getissuers" + }, + { + "$id": "1018", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "listissuers" + }, + { + "$id": "1019", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "setissuers" + }, + { + "$id": "1020", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "deleteissuers" + }, + { + "$id": "1021", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "manageissuers" + }, + { + "$id": "1022", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "recover" + }, + { + "$id": "1023", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "purge" + } + ] + }, + "keys": { + "$id": "1024", + "kind": "array", + "type": { + "$ref": "372" + }, + "value": [ + { + "$id": "1025", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "encrypt" + }, + { + "$id": "1026", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "decrypt" + }, + { + "$id": "1027", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "wrapKey" + }, + { + "$id": "1028", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "unwrapKey" + }, + { + "$id": "1029", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "sign" + }, + { + "$id": "1030", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "verify" + }, + { + "$id": "1031", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "get" + }, + { + "$id": "1032", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "list" + }, + { + "$id": "1033", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "create" + }, + { + "$id": "1034", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "update" + }, + { + "$id": "1035", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "import" + }, + { + "$id": "1036", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "delete" + }, + { + "$id": "1037", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "backup" + }, + { + "$id": "1038", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "restore" + }, + { + "$id": "1039", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "recover" + }, + { + "$id": "1040", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "purge" + } + ] + }, + "secrets": { + "$id": "1041", + "kind": "array", + "type": { + "$ref": "374" + }, + "value": [ + { + "$id": "1042", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "get" + }, + { + "$id": "1043", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "list" + }, + { + "$id": "1044", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "set" + }, + { + "$id": "1045", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "delete" + }, + { + "$id": "1046", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "backup" + }, + { + "$id": "1047", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "restore" + }, + { + "$id": "1048", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "recover" + }, + { + "$id": "1049", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "purge" + } + ] + } + } + }, + "tenantId": { + "$id": "1050", + "kind": "string", + "type": { + "$ref": "362" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + } + ] + }, + "enabledForDeployment": { + "$id": "1051", + "kind": "boolean", + "type": { + "$ref": "384" + }, + "value": true + }, + "enabledForDiskEncryption": { + "$id": "1052", + "kind": "boolean", + "type": { + "$ref": "386" + }, + "value": true + }, + "enabledForTemplateDeployment": { + "$id": "1053", + "kind": "boolean", + "type": { + "$ref": "388" + }, + "value": true + }, + "publicNetworkAccess": { + "$id": "1054", + "kind": "string", + "type": { + "$ref": "437" + }, + "value": "Enabled" + }, + "sku": { + "$id": "1055", + "kind": "model", + "type": { + "$ref": "355" + }, + "value": { + "name": { + "$id": "1056", + "kind": "string", + "type": { + "$ref": "4" + }, + "value": "standard" + }, + "family": { + "$id": "1057", + "kind": "string", + "type": { + "$ref": "1" + }, + "value": "A" + } + } + }, + "tenantId": { + "$id": "1058", + "kind": "string", + "type": { + "$ref": "352" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + } + } + } + }, + { + "parameter": { + "$ref": "991" + }, + "value": { + "$id": "1059", + "kind": "string", + "type": { + "$ref": "992" + }, + "value": "sample-resource-group" + } + }, + { + "parameter": { + "$ref": "988" + }, + "value": { + "$id": "1060", + "kind": "string", + "type": { + "$ref": "989" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + }, + { + "parameter": { + "$ref": "993" + }, + "value": { + "$id": "1061", + "kind": "string", + "type": { + "$ref": "994" + }, + "value": "sample-vault" + } + } + ], + "responses": [ + { + "response": { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "318" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + "statusCode": 200, + "bodyValue": { + "$id": "1062", + "kind": "model", + "type": { + "$ref": "318" + }, + "value": { + "name": { + "$id": "1063", + "kind": "string", + "type": { + "$ref": "446" + }, + "value": "sample-vault" + }, + "type": { + "$id": "1064", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/vaults" + }, + "id": { + "$id": "1065", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-resource-group/providers/Microsoft.KeyVault/vaults/sample-vault" + }, + "location": { + "$id": "1066", + "kind": "string", + "type": { + "$ref": "443" + }, + "value": "westus" + }, + "properties": { + "$id": "1067", + "kind": "model", + "type": { + "$ref": "350" + }, + "value": { + "accessPolicies": { + "$id": "1068", + "kind": "array", + "type": { + "$ref": "359" + }, + "value": [ + { + "$id": "1069", + "kind": "model", + "type": { + "$ref": "360" + }, + "value": { + "objectId": { + "$id": "1070", + "kind": "string", + "type": { + "$ref": "365" + }, + "value": "00000000-0000-0000-0000-000000000000" + }, + "permissions": { + "$id": "1071", + "kind": "model", + "type": { + "$ref": "370" + }, + "value": { + "certificates": { + "$id": "1072", + "kind": "array", + "type": { + "$ref": "376" + }, + "value": [ + { + "$id": "1073", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "get" + }, + { + "$id": "1074", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "list" + }, + { + "$id": "1075", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "delete" + }, + { + "$id": "1076", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "create" + }, + { + "$id": "1077", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "import" + }, + { + "$id": "1078", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "update" + }, + { + "$id": "1079", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "managecontacts" + }, + { + "$id": "1080", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "getissuers" + }, + { + "$id": "1081", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "listissuers" + }, + { + "$id": "1082", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "setissuers" + }, + { + "$id": "1083", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "deleteissuers" + }, + { + "$id": "1084", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "manageissuers" + }, + { + "$id": "1085", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "recover" + }, + { + "$id": "1086", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "purge" + } + ] + }, + "keys": { + "$id": "1087", + "kind": "array", + "type": { + "$ref": "372" + }, + "value": [ + { + "$id": "1088", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "encrypt" + }, + { + "$id": "1089", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "decrypt" + }, + { + "$id": "1090", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "wrapKey" + }, + { + "$id": "1091", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "unwrapKey" + }, + { + "$id": "1092", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "sign" + }, + { + "$id": "1093", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "verify" + }, + { + "$id": "1094", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "get" + }, + { + "$id": "1095", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "list" + }, + { + "$id": "1096", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "create" + }, + { + "$id": "1097", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "update" + }, + { + "$id": "1098", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "import" + }, + { + "$id": "1099", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "delete" + }, + { + "$id": "1100", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "backup" + }, + { + "$id": "1101", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "restore" + }, + { + "$id": "1102", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "recover" + }, + { + "$id": "1103", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "purge" + } + ] + }, + "secrets": { + "$id": "1104", + "kind": "array", + "type": { + "$ref": "374" + }, + "value": [ + { + "$id": "1105", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "get" + }, + { + "$id": "1106", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "list" + }, + { + "$id": "1107", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "set" + }, + { + "$id": "1108", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "delete" + }, + { + "$id": "1109", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "backup" + }, + { + "$id": "1110", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "restore" + }, + { + "$id": "1111", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "recover" + }, + { + "$id": "1112", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "purge" + } + ] + } + } + }, + "tenantId": { + "$id": "1113", + "kind": "string", + "type": { + "$ref": "362" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + } + ] + }, + "enabledForDeployment": { + "$id": "1114", + "kind": "boolean", + "type": { + "$ref": "384" + }, + "value": true + }, + "enabledForDiskEncryption": { + "$id": "1115", + "kind": "boolean", + "type": { + "$ref": "386" + }, + "value": true + }, + "enabledForTemplateDeployment": { + "$id": "1116", + "kind": "boolean", + "type": { + "$ref": "388" + }, + "value": true + }, + "hsmPoolResourceId": { + "$id": "1117", + "kind": "string", + "type": { + "$ref": "382" + }, + "value": "00000000-0000-0000-0000-000000000000" + }, + "networkAcls": { + "$id": "1118", + "kind": "model", + "type": { + "$ref": "399" + }, + "value": { + "bypass": { + "$id": "1119", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "AzureServices" + }, + "defaultAction": { + "$id": "1120", + "kind": "string", + "type": { + "$ref": "86" + }, + "value": "Deny" + }, + "ipRules": { + "$id": "1121", + "kind": "array", + "type": { + "$ref": "403" + }, + "value": [ + { + "$id": "1122", + "kind": "model", + "type": { + "$ref": "404" + }, + "value": { + "value": { + "$id": "1123", + "kind": "string", + "type": { + "$ref": "406" + }, + "value": "" + } + } + } + ] + }, + "virtualNetworkRules": { + "$id": "1124", + "kind": "array", + "type": { + "$ref": "408" + }, + "value": [ + { + "$id": "1125", + "kind": "model", + "type": { + "$ref": "409" + }, + "value": { + "id": { + "$id": "1126", + "kind": "string", + "type": { + "$ref": "411" + }, + "value": "" + }, + "ignoreMissingVnetServiceEndpoint": { + "$id": "1127", + "kind": "boolean", + "type": { + "$ref": "413" + }, + "value": false + } + } + } + ] + } + } + }, + "privateEndpointConnections": { + "$id": "1128", + "kind": "array", + "type": { + "$ref": "416" + }, + "value": [ + { + "$id": "1129", + "kind": "model", + "type": { + "$ref": "417" + }, + "value": { + "etag": { + "$id": "1130", + "kind": "string", + "type": { + "$ref": "421" + }, + "value": "" + }, + "id": { + "$id": "1131", + "kind": "string", + "type": { + "$ref": "419" + }, + "value": "" + }, + "properties": { + "$id": "1132", + "kind": "model", + "type": { + "$ref": "424" + }, + "value": { + "privateEndpoint": { + "$id": "1133", + "kind": "model", + "type": { + "$ref": "426" + }, + "value": { + "id": { + "$id": "1134", + "kind": "string", + "type": { + "$ref": "428" + }, + "value": "" + } + } + }, + "privateLinkServiceConnectionState": { + "$id": "1135", + "kind": "model", + "type": { + "$ref": "430" + }, + "value": { + "actionsRequired": { + "$id": "1136", + "kind": "string", + "type": { + "$ref": "100" + }, + "value": "None" + }, + "status": { + "$id": "1137", + "kind": "string", + "type": { + "$ref": "94" + }, + "value": "Approved" + } + } + }, + "provisioningState": { + "$id": "1138", + "kind": "string", + "type": { + "$ref": "103" + }, + "value": "Succeeded" + } + } + } + } + } + ] + }, + "provisioningState": { + "$id": "1139", + "kind": "string", + "type": { + "$ref": "90" + }, + "value": "Succeeded" + }, + "publicNetworkAccess": { + "$id": "1140", + "kind": "string", + "type": { + "$ref": "437" + }, + "value": "Enabled" + }, + "sku": { + "$id": "1141", + "kind": "model", + "type": { + "$ref": "355" + }, + "value": { + "name": { + "$id": "1142", + "kind": "string", + "type": { + "$ref": "4" + }, + "value": "standard" + }, + "family": { + "$id": "1143", + "kind": "string", + "type": { + "$ref": "1" + }, + "value": "A" + } + } + }, + "tenantId": { + "$id": "1144", + "kind": "string", + "type": { + "$ref": "352" + }, + "value": "00000000-0000-0000-0000-000000000000" + }, + "vaultUri": { + "$id": "1145", + "kind": "string", + "type": { + "$ref": "380" + }, + "value": "https://sample-vault.vault.azure.net" + } + } + }, + "systemData": { + "$id": "1146", + "kind": "model", + "type": { + "$ref": "336" + }, + "value": { + "createdAt": { + "$id": "1147", + "kind": "string", + "type": { + "$ref": "341" + }, + "value": "2020-01-01T12:00:00.0000000Z" + }, + "createdBy": { + "$id": "1148", + "kind": "string", + "type": { + "$ref": "338" + }, + "value": "keyVaultUser1" + }, + "createdByType": { + "$id": "1149", + "kind": "string", + "type": { + "$ref": "111" + }, + "value": "User" + }, + "lastModifiedAt": { + "$id": "1150", + "kind": "string", + "type": { + "$ref": "347" + }, + "value": "2020-01-01T12:00:00.0000000Z" + }, + "lastModifiedBy": { + "$id": "1151", + "kind": "string", + "type": { + "$ref": "344" + }, + "value": "keyVaultUser2" + }, + "lastModifiedByType": { + "$id": "1152", + "kind": "string", + "type": { + "$ref": "111" + }, + "value": "User" + } + } + }, + "tags": { + "$id": "1153", + "kind": "dict", + "type": { + "$ref": "439" + }, + "value": {} + } + } + } + }, + { + "response": { + "statusCodes": [ + 201 + ], + "bodyType": { + "$ref": "318" + }, + "headers": [ + { + "name": "location", + "nameInResponse": "Location", + "doc": "The Location header contains the URL where the status of the long running operation can be checked.", + "type": { + "$ref": "998" + } + }, + { + "name": "retryAfter", + "nameInResponse": "Retry-After", + "doc": "The Retry-After header can indicate how long the client should wait before polling the operation status.", + "type": { + "$ref": "999" + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + "statusCode": 201, + "bodyValue": { + "$id": "1154", + "kind": "model", + "type": { + "$ref": "318" + }, + "value": { + "name": { + "$id": "1155", + "kind": "string", + "type": { + "$ref": "446" + }, + "value": "sample-vault" + }, + "type": { + "$id": "1156", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/vaults" + }, + "id": { + "$id": "1157", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-resource-group/providers/Microsoft.KeyVault/vaults/sample-vault" + }, + "location": { + "$id": "1158", + "kind": "string", + "type": { + "$ref": "443" + }, + "value": "westus" + }, + "properties": { + "$id": "1159", + "kind": "model", + "type": { + "$ref": "350" + }, + "value": { + "accessPolicies": { + "$id": "1160", + "kind": "array", + "type": { + "$ref": "359" + }, + "value": [ + { + "$id": "1161", + "kind": "model", + "type": { + "$ref": "360" + }, + "value": { + "objectId": { + "$id": "1162", + "kind": "string", + "type": { + "$ref": "365" + }, + "value": "00000000-0000-0000-0000-000000000000" + }, + "permissions": { + "$id": "1163", + "kind": "model", + "type": { + "$ref": "370" + }, + "value": { + "certificates": { + "$id": "1164", + "kind": "array", + "type": { + "$ref": "376" + }, + "value": [ + { + "$id": "1165", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "get" + }, + { + "$id": "1166", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "list" + }, + { + "$id": "1167", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "delete" + }, + { + "$id": "1168", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "create" + }, + { + "$id": "1169", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "import" + }, + { + "$id": "1170", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "update" + }, + { + "$id": "1171", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "managecontacts" + }, + { + "$id": "1172", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "getissuers" + }, + { + "$id": "1173", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "listissuers" + }, + { + "$id": "1174", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "setissuers" + }, + { + "$id": "1175", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "deleteissuers" + }, + { + "$id": "1176", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "manageissuers" + }, + { + "$id": "1177", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "recover" + }, + { + "$id": "1178", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "purge" + } + ] + }, + "keys": { + "$id": "1179", + "kind": "array", + "type": { + "$ref": "372" + }, + "value": [ + { + "$id": "1180", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "encrypt" + }, + { + "$id": "1181", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "decrypt" + }, + { + "$id": "1182", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "wrapKey" + }, + { + "$id": "1183", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "unwrapKey" + }, + { + "$id": "1184", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "sign" + }, + { + "$id": "1185", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "verify" + }, + { + "$id": "1186", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "get" + }, + { + "$id": "1187", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "list" + }, + { + "$id": "1188", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "create" + }, + { + "$id": "1189", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "update" + }, + { + "$id": "1190", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "import" + }, + { + "$id": "1191", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "delete" + }, + { + "$id": "1192", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "backup" + }, + { + "$id": "1193", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "restore" + }, + { + "$id": "1194", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "recover" + }, + { + "$id": "1195", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "purge" + } + ] + }, + "secrets": { + "$id": "1196", + "kind": "array", + "type": { + "$ref": "374" + }, + "value": [ + { + "$id": "1197", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "get" + }, + { + "$id": "1198", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "list" + }, + { + "$id": "1199", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "set" + }, + { + "$id": "1200", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "delete" + }, + { + "$id": "1201", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "backup" + }, + { + "$id": "1202", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "restore" + }, + { + "$id": "1203", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "recover" + }, + { + "$id": "1204", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "purge" + } + ] + } + } + }, + "tenantId": { + "$id": "1205", + "kind": "string", + "type": { + "$ref": "362" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + } + ] + }, + "enabledForDeployment": { + "$id": "1206", + "kind": "boolean", + "type": { + "$ref": "384" + }, + "value": true + }, + "enabledForDiskEncryption": { + "$id": "1207", + "kind": "boolean", + "type": { + "$ref": "386" + }, + "value": true + }, + "enabledForTemplateDeployment": { + "$id": "1208", + "kind": "boolean", + "type": { + "$ref": "388" + }, + "value": true + }, + "hsmPoolResourceId": { + "$id": "1209", + "kind": "string", + "type": { + "$ref": "382" + }, + "value": "00000000-0000-0000-0000-000000000000" + }, + "provisioningState": { + "$id": "1210", + "kind": "string", + "type": { + "$ref": "90" + }, + "value": "Succeeded" + }, + "publicNetworkAccess": { + "$id": "1211", + "kind": "string", + "type": { + "$ref": "437" + }, + "value": "Enabled" + }, + "sku": { + "$id": "1212", + "kind": "model", + "type": { + "$ref": "355" + }, + "value": { + "name": { + "$id": "1213", + "kind": "string", + "type": { + "$ref": "4" + }, + "value": "standard" + }, + "family": { + "$id": "1214", + "kind": "string", + "type": { + "$ref": "1" + }, + "value": "A" + } + } + }, + "tenantId": { + "$id": "1215", + "kind": "string", + "type": { + "$ref": "352" + }, + "value": "00000000-0000-0000-0000-000000000000" + }, + "vaultUri": { + "$id": "1216", + "kind": "string", + "type": { + "$ref": "380" + }, + "value": "https://sample-vault.vault.azure.net" + } + } + }, + "systemData": { + "$id": "1217", + "kind": "model", + "type": { + "$ref": "336" + }, + "value": { + "createdAt": { + "$id": "1218", + "kind": "string", + "type": { + "$ref": "341" + }, + "value": "2020-01-01T12:00:00.0000000Z" + }, + "createdBy": { + "$id": "1219", + "kind": "string", + "type": { + "$ref": "338" + }, + "value": "keyVaultUser1" + }, + "createdByType": { + "$id": "1220", + "kind": "string", + "type": { + "$ref": "111" + }, + "value": "User" + }, + "lastModifiedAt": { + "$id": "1221", + "kind": "string", + "type": { + "$ref": "347" + }, + "value": "2020-01-01T12:00:00.0000000Z" + }, + "lastModifiedBy": { + "$id": "1222", + "kind": "string", + "type": { + "$ref": "344" + }, + "value": "keyVaultUser2" + }, + "lastModifiedByType": { + "$id": "1223", + "kind": "string", + "type": { + "$ref": "111" + }, + "value": "User" + } + } + }, + "tags": { + "$id": "1224", + "kind": "dict", + "type": { + "$ref": "439" + }, + "value": {} + } + } + } + } + ] + }, + { + "$id": "1225", + "kind": "http", + "name": "Create or update a vault with network acls", + "description": "Create or update a vault with network acls", + "filePath": "2025-05-01/createVaultWithNetworkAcls.json", + "parameters": [ + { + "parameter": { + "$ref": "985" + }, + "value": { + "$id": "1226", + "kind": "string", + "type": { + "$ref": "986" + }, + "value": "2025-05-01" + } + }, + { + "parameter": { + "$ref": "997" + }, + "value": { + "$id": "1227", + "kind": "model", + "type": { + "$ref": "454" + }, + "value": { + "location": { + "$id": "1228", + "kind": "string", + "type": { + "$ref": "456" + }, + "value": "westus" + }, + "properties": { + "$id": "1229", + "kind": "model", + "type": { + "$ref": "350" + }, + "value": { + "enabledForDeployment": { + "$id": "1230", + "kind": "boolean", + "type": { + "$ref": "384" + }, + "value": true + }, + "enabledForDiskEncryption": { + "$id": "1231", + "kind": "boolean", + "type": { + "$ref": "386" + }, + "value": true + }, + "enabledForTemplateDeployment": { + "$id": "1232", + "kind": "boolean", + "type": { + "$ref": "388" + }, + "value": true + }, + "networkAcls": { + "$id": "1233", + "kind": "model", + "type": { + "$ref": "399" + }, + "value": { + "bypass": { + "$id": "1234", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "AzureServices" + }, + "defaultAction": { + "$id": "1235", + "kind": "string", + "type": { + "$ref": "86" + }, + "value": "Deny" + }, + "ipRules": { + "$id": "1236", + "kind": "array", + "type": { + "$ref": "403" + }, + "value": [ + { + "$id": "1237", + "kind": "model", + "type": { + "$ref": "404" + }, + "value": { + "value": { + "$id": "1238", + "kind": "string", + "type": { + "$ref": "406" + }, + "value": "124.56.78.91" + } + } + }, + { + "$id": "1239", + "kind": "model", + "type": { + "$ref": "404" + }, + "value": { + "value": { + "$id": "1240", + "kind": "string", + "type": { + "$ref": "406" + }, + "value": "'10.91.4.0/24'" + } + } + } + ] + }, + "virtualNetworkRules": { + "$id": "1241", + "kind": "array", + "type": { + "$ref": "408" + }, + "value": [ + { + "$id": "1242", + "kind": "model", + "type": { + "$ref": "409" + }, + "value": { + "id": { + "$id": "1243", + "kind": "string", + "type": { + "$ref": "411" + }, + "value": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1" + } + } + } + ] + } + } + }, + "sku": { + "$id": "1244", + "kind": "model", + "type": { + "$ref": "355" + }, + "value": { + "name": { + "$id": "1245", + "kind": "string", + "type": { + "$ref": "4" + }, + "value": "standard" + }, + "family": { + "$id": "1246", + "kind": "string", + "type": { + "$ref": "1" + }, + "value": "A" + } + } + }, + "tenantId": { + "$id": "1247", + "kind": "string", + "type": { + "$ref": "352" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + } + } + } + }, + { + "parameter": { + "$ref": "991" + }, + "value": { + "$id": "1248", + "kind": "string", + "type": { + "$ref": "992" + }, + "value": "sample-resource-group" + } + }, + { + "parameter": { + "$ref": "988" + }, + "value": { + "$id": "1249", + "kind": "string", + "type": { + "$ref": "989" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + }, + { + "parameter": { + "$ref": "993" + }, + "value": { + "$id": "1250", + "kind": "string", + "type": { + "$ref": "994" + }, + "value": "sample-vault" + } + } + ], + "responses": [ + { + "response": { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "318" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + "statusCode": 200, + "bodyValue": { + "$id": "1251", + "kind": "model", + "type": { + "$ref": "318" + }, + "value": { + "name": { + "$id": "1252", + "kind": "string", + "type": { + "$ref": "446" + }, + "value": "sample-vault" + }, + "type": { + "$id": "1253", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/vaults" + }, + "id": { + "$id": "1254", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-resource-group/providers/Microsoft.KeyVault/vaults/sample-vault" + }, + "location": { + "$id": "1255", + "kind": "string", + "type": { + "$ref": "443" + }, + "value": "westus" + }, + "properties": { + "$id": "1256", + "kind": "model", + "type": { + "$ref": "350" + }, + "value": { + "enabledForDeployment": { + "$id": "1257", + "kind": "boolean", + "type": { + "$ref": "384" + }, + "value": true + }, + "enabledForDiskEncryption": { + "$id": "1258", + "kind": "boolean", + "type": { + "$ref": "386" + }, + "value": true + }, + "enabledForTemplateDeployment": { + "$id": "1259", + "kind": "boolean", + "type": { + "$ref": "388" + }, + "value": true + }, + "hsmPoolResourceId": { + "$id": "1260", + "kind": "string", + "type": { + "$ref": "382" + }, + "value": "00000000-0000-0000-0000-000000000000" + }, + "networkAcls": { + "$id": "1261", + "kind": "model", + "type": { + "$ref": "399" + }, + "value": { + "bypass": { + "$id": "1262", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "AzureServices" + }, + "defaultAction": { + "$id": "1263", + "kind": "string", + "type": { + "$ref": "86" + }, + "value": "Deny" + }, + "ipRules": { + "$id": "1264", + "kind": "array", + "type": { + "$ref": "403" + }, + "value": [ + { + "$id": "1265", + "kind": "model", + "type": { + "$ref": "404" + }, + "value": { + "value": { + "$id": "1266", + "kind": "string", + "type": { + "$ref": "406" + }, + "value": "124.56.78.91/32" + } + } + }, + { + "$id": "1267", + "kind": "model", + "type": { + "$ref": "404" + }, + "value": { + "value": { + "$id": "1268", + "kind": "string", + "type": { + "$ref": "406" + }, + "value": "'10.91.4.0/24'" + } + } + } + ] + }, + "virtualNetworkRules": { + "$id": "1269", + "kind": "array", + "type": { + "$ref": "408" + }, + "value": [ + { + "$id": "1270", + "kind": "model", + "type": { + "$ref": "409" + }, + "value": { + "id": { + "$id": "1271", + "kind": "string", + "type": { + "$ref": "411" + }, + "value": "/subscriptions/subid/resourcegroups/rg1/providers/microsoft.network/virtualnetworks/test-vnet/subnets/subnet1" + } + } + } + ] + } + } + }, + "sku": { + "$id": "1272", + "kind": "model", + "type": { + "$ref": "355" + }, + "value": { + "name": { + "$id": "1273", + "kind": "string", + "type": { + "$ref": "4" + }, + "value": "standard" + }, + "family": { + "$id": "1274", + "kind": "string", + "type": { + "$ref": "1" + }, + "value": "A" + } + } + }, + "tenantId": { + "$id": "1275", + "kind": "string", + "type": { + "$ref": "352" + }, + "value": "00000000-0000-0000-0000-000000000000" + }, + "vaultUri": { + "$id": "1276", + "kind": "string", + "type": { + "$ref": "380" + }, + "value": "https://sample-vault.vault.azure.net" + } + } + }, + "systemData": { + "$id": "1277", + "kind": "model", + "type": { + "$ref": "336" + }, + "value": { + "createdAt": { + "$id": "1278", + "kind": "string", + "type": { + "$ref": "341" + }, + "value": "2020-01-01T12:00:00.0000000Z" + }, + "createdBy": { + "$id": "1279", + "kind": "string", + "type": { + "$ref": "338" + }, + "value": "keyVaultUser1" + }, + "createdByType": { + "$id": "1280", + "kind": "string", + "type": { + "$ref": "111" + }, + "value": "User" + }, + "lastModifiedAt": { + "$id": "1281", + "kind": "string", + "type": { + "$ref": "347" + }, + "value": "2020-01-01T12:00:00.0000000Z" + }, + "lastModifiedBy": { + "$id": "1282", + "kind": "string", + "type": { + "$ref": "344" + }, + "value": "keyVaultUser2" + }, + "lastModifiedByType": { + "$id": "1283", + "kind": "string", + "type": { + "$ref": "111" + }, + "value": "User" + } + } + }, + "tags": { + "$id": "1284", + "kind": "dict", + "type": { + "$ref": "439" + }, + "value": {} + } + } + } + }, + { + "response": { + "statusCodes": [ + 201 + ], + "bodyType": { + "$ref": "318" + }, + "headers": [ + { + "name": "location", + "nameInResponse": "Location", + "doc": "The Location header contains the URL where the status of the long running operation can be checked.", + "type": { + "$ref": "998" + } + }, + { + "name": "retryAfter", + "nameInResponse": "Retry-After", + "doc": "The Retry-After header can indicate how long the client should wait before polling the operation status.", + "type": { + "$ref": "999" + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + "statusCode": 201, + "bodyValue": { + "$id": "1285", + "kind": "model", + "type": { + "$ref": "318" + }, + "value": { + "name": { + "$id": "1286", + "kind": "string", + "type": { + "$ref": "446" + }, + "value": "sample-vault" + }, + "type": { + "$id": "1287", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/vaults" + }, + "id": { + "$id": "1288", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-resource-group/providers/Microsoft.KeyVault/vaults/sample-vault" + }, + "location": { + "$id": "1289", + "kind": "string", + "type": { + "$ref": "443" + }, + "value": "westus" + }, + "properties": { + "$id": "1290", + "kind": "model", + "type": { + "$ref": "350" + }, + "value": { + "enabledForDeployment": { + "$id": "1291", + "kind": "boolean", + "type": { + "$ref": "384" + }, + "value": true + }, + "enabledForDiskEncryption": { + "$id": "1292", + "kind": "boolean", + "type": { + "$ref": "386" + }, + "value": true + }, + "enabledForTemplateDeployment": { + "$id": "1293", + "kind": "boolean", + "type": { + "$ref": "388" + }, + "value": true + }, + "hsmPoolResourceId": { + "$id": "1294", + "kind": "string", + "type": { + "$ref": "382" + }, + "value": "00000000-0000-0000-0000-000000000000" + }, + "networkAcls": { + "$id": "1295", + "kind": "model", + "type": { + "$ref": "399" + }, + "value": { + "bypass": { + "$id": "1296", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "AzureServices" + }, + "defaultAction": { + "$id": "1297", + "kind": "string", + "type": { + "$ref": "86" + }, + "value": "Deny" + }, + "ipRules": { + "$id": "1298", + "kind": "array", + "type": { + "$ref": "403" + }, + "value": [ + { + "$id": "1299", + "kind": "model", + "type": { + "$ref": "404" + }, + "value": { + "value": { + "$id": "1300", + "kind": "string", + "type": { + "$ref": "406" + }, + "value": "124.56.78.91/32" + } + } + }, + { + "$id": "1301", + "kind": "model", + "type": { + "$ref": "404" + }, + "value": { + "value": { + "$id": "1302", + "kind": "string", + "type": { + "$ref": "406" + }, + "value": "'10.91.4.0/24'" + } + } + } + ] + }, + "virtualNetworkRules": { + "$id": "1303", + "kind": "array", + "type": { + "$ref": "408" + }, + "value": [ + { + "$id": "1304", + "kind": "model", + "type": { + "$ref": "409" + }, + "value": { + "id": { + "$id": "1305", + "kind": "string", + "type": { + "$ref": "411" + }, + "value": "/subscriptions/subid/resourcegroups/rg1/providers/microsoft.network/virtualnetworks/test-vnet/subnets/subnet1" + } + } + } + ] + } + } + }, + "sku": { + "$id": "1306", + "kind": "model", + "type": { + "$ref": "355" + }, + "value": { + "name": { + "$id": "1307", + "kind": "string", + "type": { + "$ref": "4" + }, + "value": "standard" + }, + "family": { + "$id": "1308", + "kind": "string", + "type": { + "$ref": "1" + }, + "value": "A" + } + } + }, + "tenantId": { + "$id": "1309", + "kind": "string", + "type": { + "$ref": "352" + }, + "value": "00000000-0000-0000-0000-000000000000" + }, + "vaultUri": { + "$id": "1310", + "kind": "string", + "type": { + "$ref": "380" + }, + "value": "https://sample-vault.vault.azure.net" + } + } + }, + "systemData": { + "$id": "1311", + "kind": "model", + "type": { + "$ref": "336" + }, + "value": { + "createdAt": { + "$id": "1312", + "kind": "string", + "type": { + "$ref": "341" + }, + "value": "2020-01-01T12:00:00.0000000Z" + }, + "createdBy": { + "$id": "1313", + "kind": "string", + "type": { + "$ref": "338" + }, + "value": "keyVaultUser1" + }, + "createdByType": { + "$id": "1314", + "kind": "string", + "type": { + "$ref": "111" + }, + "value": "User" + }, + "lastModifiedAt": { + "$id": "1315", + "kind": "string", + "type": { + "$ref": "347" + }, + "value": "2020-01-01T12:00:00.0000000Z" + }, + "lastModifiedBy": { + "$id": "1316", + "kind": "string", + "type": { + "$ref": "344" + }, + "value": "keyVaultUser2" + }, + "lastModifiedByType": { + "$id": "1317", + "kind": "string", + "type": { + "$ref": "111" + }, + "value": "User" + } + } + }, + "tags": { + "$id": "1318", + "kind": "dict", + "type": { + "$ref": "439" + }, + "value": {} + } + } + } + } + ] + } + ] + }, + "parameters": [ + { + "$id": "1319", + "kind": "method", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "1320", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.createOrUpdate.resourceGroupName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "1321", + "kind": "method", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "The name of the vault.", + "type": { + "$id": "1322", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.createOrUpdate.vaultName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "1323", + "kind": "method", + "name": "parameters", + "serializedName": "parameters", + "doc": "Parameters to create or update the vault", + "type": { + "$ref": "454" + }, + "location": "Body", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.createOrUpdate.resource", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "1324", + "kind": "method", + "name": "contentType", + "serializedName": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$ref": "222" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.createOrUpdate.contentType", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "1325", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "224" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.createOrUpdate.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$ref": "318" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.createOrUpdate", + "lroMetadata": { + "finalStateVia": 1, + "finalResponse": { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "318" + } + } + } + }, + { + "$id": "1326", + "kind": "basic", + "name": "update", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "Update a key vault in the specified subscription.", + "operation": { + "$id": "1327", + "name": "update", + "resourceName": "Vault", + "doc": "Update a key vault in the specified subscription.", + "accessibility": "public", + "parameters": [ + { + "$id": "1328", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1329", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "1330", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.update.apiVersion", + "readOnly": false + }, + { + "$id": "1331", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "1332", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1333", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.update.subscriptionId" + }, + { + "$id": "1334", + "kind": "path", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "1335", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.update.resourceGroupName" + }, + { + "$id": "1336", + "kind": "path", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "The name of the vault.", + "type": { + "$id": "1337", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.update.vaultName" + }, + { + "$id": "1338", + "kind": "header", + "name": "contentType", + "serializedName": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$ref": "226" + }, + "isApiVersion": false, + "optional": false, + "isContentType": true, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.update.contentType" + }, + { + "$id": "1339", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "228" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.update.accept" + }, + { + "$id": "1340", + "kind": "body", + "name": "parameters", + "serializedName": "parameters", + "doc": "Parameters to patch the vault", + "type": { + "$ref": "491" + }, + "isApiVersion": false, + "contentTypes": [ + "application/json" + ], + "defaultContentType": "application/json", + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.update.properties" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "318" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + { + "statusCodes": [ + 201 + ], + "bodyType": { + "$ref": "318" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "PATCH", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.update", + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceUpdate", + "arguments": {} + } + ], + "examples": [ + { + "$id": "1341", + "kind": "http", + "name": "Update an existing vault", + "description": "Update an existing vault", + "filePath": "2025-05-01/updateVault.json", + "parameters": [ + { + "parameter": { + "$ref": "1328" + }, + "value": { + "$id": "1342", + "kind": "string", + "type": { + "$ref": "1329" + }, + "value": "2025-05-01" + } + }, + { + "parameter": { + "$ref": "1340" + }, + "value": { + "$id": "1343", + "kind": "model", + "type": { + "$ref": "491" + }, + "value": { + "properties": { + "$id": "1344", + "kind": "model", + "type": { + "$ref": "494" + }, + "value": { + "accessPolicies": { + "$id": "1345", + "kind": "array", + "type": { + "$ref": "359" + }, + "value": [ + { + "$id": "1346", + "kind": "model", + "type": { + "$ref": "360" + }, + "value": { + "objectId": { + "$id": "1347", + "kind": "string", + "type": { + "$ref": "365" + }, + "value": "00000000-0000-0000-0000-000000000000" + }, + "permissions": { + "$id": "1348", + "kind": "model", + "type": { + "$ref": "370" + }, + "value": { + "certificates": { + "$id": "1349", + "kind": "array", + "type": { + "$ref": "376" + }, + "value": [ + { + "$id": "1350", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "get" + }, + { + "$id": "1351", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "list" + }, + { + "$id": "1352", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "delete" + }, + { + "$id": "1353", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "create" + }, + { + "$id": "1354", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "import" + }, + { + "$id": "1355", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "update" + }, + { + "$id": "1356", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "managecontacts" + }, + { + "$id": "1357", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "getissuers" + }, + { + "$id": "1358", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "listissuers" + }, + { + "$id": "1359", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "setissuers" + }, + { + "$id": "1360", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "deleteissuers" + }, + { + "$id": "1361", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "manageissuers" + }, + { + "$id": "1362", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "recover" + }, + { + "$id": "1363", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "purge" + } + ] + }, + "keys": { + "$id": "1364", + "kind": "array", + "type": { + "$ref": "372" + }, + "value": [ + { + "$id": "1365", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "encrypt" + }, + { + "$id": "1366", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "decrypt" + }, + { + "$id": "1367", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "wrapKey" + }, + { + "$id": "1368", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "unwrapKey" + }, + { + "$id": "1369", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "sign" + }, + { + "$id": "1370", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "verify" + }, + { + "$id": "1371", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "get" + }, + { + "$id": "1372", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "list" + }, + { + "$id": "1373", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "create" + }, + { + "$id": "1374", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "update" + }, + { + "$id": "1375", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "import" + }, + { + "$id": "1376", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "delete" + }, + { + "$id": "1377", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "backup" + }, + { + "$id": "1378", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "restore" + }, + { + "$id": "1379", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "recover" + }, + { + "$id": "1380", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "purge" + } + ] + }, + "secrets": { + "$id": "1381", + "kind": "array", + "type": { + "$ref": "374" + }, + "value": [ + { + "$id": "1382", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "get" + }, + { + "$id": "1383", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "list" + }, + { + "$id": "1384", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "set" + }, + { + "$id": "1385", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "delete" + }, + { + "$id": "1386", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "backup" + }, + { + "$id": "1387", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "restore" + }, + { + "$id": "1388", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "recover" + }, + { + "$id": "1389", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "purge" + } + ] + } + } + }, + "tenantId": { + "$id": "1390", + "kind": "string", + "type": { + "$ref": "362" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + } + ] + }, + "enabledForDeployment": { + "$id": "1391", + "kind": "boolean", + "type": { + "$ref": "501" + }, + "value": true + }, + "enabledForDiskEncryption": { + "$id": "1392", + "kind": "boolean", + "type": { + "$ref": "503" + }, + "value": true + }, + "enabledForTemplateDeployment": { + "$id": "1393", + "kind": "boolean", + "type": { + "$ref": "505" + }, + "value": true + }, + "publicNetworkAccess": { + "$id": "1394", + "kind": "string", + "type": { + "$ref": "517" + }, + "value": "Enabled" + }, + "sku": { + "$id": "1395", + "kind": "model", + "type": { + "$ref": "355" + }, + "value": { + "name": { + "$id": "1396", + "kind": "string", + "type": { + "$ref": "4" + }, + "value": "standard" + }, + "family": { + "$id": "1397", + "kind": "string", + "type": { + "$ref": "1" + }, + "value": "A" + } + } + }, + "tenantId": { + "$id": "1398", + "kind": "string", + "type": { + "$ref": "496" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + } + } + } + }, + { + "parameter": { + "$ref": "1334" + }, + "value": { + "$id": "1399", + "kind": "string", + "type": { + "$ref": "1335" + }, + "value": "sample-resource-group" + } + }, + { + "parameter": { + "$ref": "1331" + }, + "value": { + "$id": "1400", + "kind": "string", + "type": { + "$ref": "1332" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + }, + { + "parameter": { + "$ref": "1336" + }, + "value": { + "$id": "1401", + "kind": "string", + "type": { + "$ref": "1337" + }, + "value": "sample-vault" + } + } + ], + "responses": [ + { + "response": { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "318" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + "statusCode": 200, + "bodyValue": { + "$id": "1402", + "kind": "model", + "type": { + "$ref": "318" + }, + "value": { + "name": { + "$id": "1403", + "kind": "string", + "type": { + "$ref": "446" + }, + "value": "sample-vault" + }, + "type": { + "$id": "1404", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/vaults" + }, + "id": { + "$id": "1405", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-resource-group/providers/Microsoft.KeyVault/vaults/sample-vault" + }, + "location": { + "$id": "1406", + "kind": "string", + "type": { + "$ref": "443" + }, + "value": "westus" + }, + "properties": { + "$id": "1407", + "kind": "model", + "type": { + "$ref": "350" + }, + "value": { + "accessPolicies": { + "$id": "1408", + "kind": "array", + "type": { + "$ref": "359" + }, + "value": [ + { + "$id": "1409", + "kind": "model", + "type": { + "$ref": "360" + }, + "value": { + "objectId": { + "$id": "1410", + "kind": "string", + "type": { + "$ref": "365" + }, + "value": "00000000-0000-0000-0000-000000000000" + }, + "permissions": { + "$id": "1411", + "kind": "model", + "type": { + "$ref": "370" + }, + "value": { + "certificates": { + "$id": "1412", + "kind": "array", + "type": { + "$ref": "376" + }, + "value": [ + { + "$id": "1413", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "get" + }, + { + "$id": "1414", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "list" + }, + { + "$id": "1415", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "delete" + }, + { + "$id": "1416", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "create" + }, + { + "$id": "1417", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "import" + }, + { + "$id": "1418", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "update" + }, + { + "$id": "1419", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "managecontacts" + }, + { + "$id": "1420", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "getissuers" + }, + { + "$id": "1421", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "listissuers" + }, + { + "$id": "1422", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "setissuers" + }, + { + "$id": "1423", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "deleteissuers" + }, + { + "$id": "1424", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "manageissuers" + }, + { + "$id": "1425", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "recover" + }, + { + "$id": "1426", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "purge" + } + ] + }, + "keys": { + "$id": "1427", + "kind": "array", + "type": { + "$ref": "372" + }, + "value": [ + { + "$id": "1428", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "encrypt" + }, + { + "$id": "1429", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "decrypt" + }, + { + "$id": "1430", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "wrapKey" + }, + { + "$id": "1431", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "unwrapKey" + }, + { + "$id": "1432", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "sign" + }, + { + "$id": "1433", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "verify" + }, + { + "$id": "1434", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "get" + }, + { + "$id": "1435", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "list" + }, + { + "$id": "1436", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "create" + }, + { + "$id": "1437", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "update" + }, + { + "$id": "1438", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "import" + }, + { + "$id": "1439", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "delete" + }, + { + "$id": "1440", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "backup" + }, + { + "$id": "1441", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "restore" + }, + { + "$id": "1442", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "recover" + }, + { + "$id": "1443", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "purge" + } + ] + }, + "secrets": { + "$id": "1444", + "kind": "array", + "type": { + "$ref": "374" + }, + "value": [ + { + "$id": "1445", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "get" + }, + { + "$id": "1446", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "list" + }, + { + "$id": "1447", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "set" + }, + { + "$id": "1448", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "delete" + }, + { + "$id": "1449", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "backup" + }, + { + "$id": "1450", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "restore" + }, + { + "$id": "1451", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "recover" + }, + { + "$id": "1452", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "purge" + } + ] + } + } + }, + "tenantId": { + "$id": "1453", + "kind": "string", + "type": { + "$ref": "362" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + } + ] + }, + "enabledForDeployment": { + "$id": "1454", + "kind": "boolean", + "type": { + "$ref": "384" + }, + "value": true + }, + "enabledForDiskEncryption": { + "$id": "1455", + "kind": "boolean", + "type": { + "$ref": "386" + }, + "value": true + }, + "enabledForTemplateDeployment": { + "$id": "1456", + "kind": "boolean", + "type": { + "$ref": "388" + }, + "value": true + }, + "hsmPoolResourceId": { + "$id": "1457", + "kind": "string", + "type": { + "$ref": "382" + }, + "value": "00000000-0000-0000-0000-000000000000" + }, + "networkAcls": { + "$id": "1458", + "kind": "model", + "type": { + "$ref": "399" + }, + "value": { + "bypass": { + "$id": "1459", + "kind": "string", + "type": { + "$ref": "82" + }, + "value": "AzureServices" + }, + "defaultAction": { + "$id": "1460", + "kind": "string", + "type": { + "$ref": "86" + }, + "value": "Deny" + }, + "ipRules": { + "$id": "1461", + "kind": "array", + "type": { + "$ref": "403" + }, + "value": [ + { + "$id": "1462", + "kind": "model", + "type": { + "$ref": "404" + }, + "value": { + "value": { + "$id": "1463", + "kind": "string", + "type": { + "$ref": "406" + }, + "value": "" + } + } + } + ] + }, + "virtualNetworkRules": { + "$id": "1464", + "kind": "array", + "type": { + "$ref": "408" + }, + "value": [ + { + "$id": "1465", + "kind": "model", + "type": { + "$ref": "409" + }, + "value": { + "id": { + "$id": "1466", + "kind": "string", + "type": { + "$ref": "411" + }, + "value": "" + }, + "ignoreMissingVnetServiceEndpoint": { + "$id": "1467", + "kind": "boolean", + "type": { + "$ref": "413" + }, + "value": false + } + } + } + ] + } + } + }, + "privateEndpointConnections": { + "$id": "1468", + "kind": "array", + "type": { + "$ref": "416" + }, + "value": [ + { + "$id": "1469", + "kind": "model", + "type": { + "$ref": "417" + }, + "value": { + "id": { + "$id": "1470", + "kind": "string", + "type": { + "$ref": "419" + }, + "value": "" + }, + "properties": { + "$id": "1471", + "kind": "model", + "type": { + "$ref": "424" + }, + "value": { + "privateEndpoint": { + "$id": "1472", + "kind": "model", + "type": { + "$ref": "426" + }, + "value": { + "id": { + "$id": "1473", + "kind": "string", + "type": { + "$ref": "428" + }, + "value": "" + } + } + }, + "privateLinkServiceConnectionState": { + "$id": "1474", + "kind": "model", + "type": { + "$ref": "430" + }, + "value": { + "actionsRequired": { + "$id": "1475", + "kind": "string", + "type": { + "$ref": "100" + }, + "value": "None" + }, + "status": { + "$id": "1476", + "kind": "string", + "type": { + "$ref": "94" + }, + "value": "Approved" + } + } + }, + "provisioningState": { + "$id": "1477", + "kind": "string", + "type": { + "$ref": "103" + }, + "value": "Succeeded" + } + } + } + } + } + ] + }, + "provisioningState": { + "$id": "1478", + "kind": "string", + "type": { + "$ref": "90" + }, + "value": "Succeeded" + }, + "publicNetworkAccess": { + "$id": "1479", + "kind": "string", + "type": { + "$ref": "437" + }, + "value": "Enabled" + }, + "sku": { + "$id": "1480", + "kind": "model", + "type": { + "$ref": "355" + }, + "value": { + "name": { + "$id": "1481", + "kind": "string", + "type": { + "$ref": "4" + }, + "value": "standard" + }, + "family": { + "$id": "1482", + "kind": "string", + "type": { + "$ref": "1" + }, + "value": "A" + } + } + }, + "tenantId": { + "$id": "1483", + "kind": "string", + "type": { + "$ref": "352" + }, + "value": "00000000-0000-0000-0000-000000000000" + }, + "vaultUri": { + "$id": "1484", + "kind": "string", + "type": { + "$ref": "380" + }, + "value": "https://sample-vault.vault.azure.net" + } + } + }, + "systemData": { + "$id": "1485", + "kind": "model", + "type": { + "$ref": "336" + }, + "value": { + "createdAt": { + "$id": "1486", + "kind": "string", + "type": { + "$ref": "341" + }, + "value": "2020-01-01T12:00:00.0000000Z" + }, + "createdBy": { + "$id": "1487", + "kind": "string", + "type": { + "$ref": "338" + }, + "value": "keyVaultUser1" + }, + "createdByType": { + "$id": "1488", + "kind": "string", + "type": { + "$ref": "111" + }, + "value": "User" + }, + "lastModifiedAt": { + "$id": "1489", + "kind": "string", + "type": { + "$ref": "347" + }, + "value": "2020-01-01T12:00:00.0000000Z" + }, + "lastModifiedBy": { + "$id": "1490", + "kind": "string", + "type": { + "$ref": "344" + }, + "value": "keyVaultUser2" + }, + "lastModifiedByType": { + "$id": "1491", + "kind": "string", + "type": { + "$ref": "111" + }, + "value": "User" + } + } + }, + "tags": { + "$id": "1492", + "kind": "dict", + "type": { + "$ref": "439" + }, + "value": {} + } + } + } + }, + { + "response": { + "statusCodes": [ + 201 + ], + "bodyType": { + "$ref": "318" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + "statusCode": 201, + "bodyValue": { + "$id": "1493", + "kind": "model", + "type": { + "$ref": "318" + }, + "value": { + "name": { + "$id": "1494", + "kind": "string", + "type": { + "$ref": "446" + }, + "value": "sample-vault" + }, + "type": { + "$id": "1495", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/vaults" + }, + "id": { + "$id": "1496", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-resource-group/providers/Microsoft.KeyVault/vaults/sample-vault" + }, + "location": { + "$id": "1497", + "kind": "string", + "type": { + "$ref": "443" + }, + "value": "westus" + }, + "properties": { + "$id": "1498", + "kind": "model", + "type": { + "$ref": "350" + }, + "value": { + "accessPolicies": { + "$id": "1499", + "kind": "array", + "type": { + "$ref": "359" + }, + "value": [ + { + "$id": "1500", + "kind": "model", + "type": { + "$ref": "360" + }, + "value": { + "objectId": { + "$id": "1501", + "kind": "string", + "type": { + "$ref": "365" + }, + "value": "00000000-0000-0000-0000-000000000000" + }, + "permissions": { + "$id": "1502", + "kind": "model", + "type": { + "$ref": "370" + }, + "value": { + "certificates": { + "$id": "1503", + "kind": "array", + "type": { + "$ref": "376" + }, + "value": [ + { + "$id": "1504", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "get" + }, + { + "$id": "1505", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "list" + }, + { + "$id": "1506", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "delete" + }, + { + "$id": "1507", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "create" + }, + { + "$id": "1508", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "import" + }, + { + "$id": "1509", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "update" + }, + { + "$id": "1510", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "managecontacts" + }, + { + "$id": "1511", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "getissuers" + }, + { + "$id": "1512", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "listissuers" + }, + { + "$id": "1513", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "setissuers" + }, + { + "$id": "1514", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "deleteissuers" + }, + { + "$id": "1515", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "manageissuers" + }, + { + "$id": "1516", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "recover" + }, + { + "$id": "1517", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "purge" + } + ] + }, + "keys": { + "$id": "1518", + "kind": "array", + "type": { + "$ref": "372" + }, + "value": [ + { + "$id": "1519", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "encrypt" + }, + { + "$id": "1520", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "decrypt" + }, + { + "$id": "1521", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "wrapKey" + }, + { + "$id": "1522", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "unwrapKey" + }, + { + "$id": "1523", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "sign" + }, + { + "$id": "1524", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "verify" + }, + { + "$id": "1525", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "get" + }, + { + "$id": "1526", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "list" + }, + { + "$id": "1527", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "create" + }, + { + "$id": "1528", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "update" + }, + { + "$id": "1529", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "import" + }, + { + "$id": "1530", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "delete" + }, + { + "$id": "1531", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "backup" + }, + { + "$id": "1532", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "restore" + }, + { + "$id": "1533", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "recover" + }, + { + "$id": "1534", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "purge" + } + ] + }, + "secrets": { + "$id": "1535", + "kind": "array", + "type": { + "$ref": "374" + }, + "value": [ + { + "$id": "1536", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "get" + }, + { + "$id": "1537", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "list" + }, + { + "$id": "1538", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "set" + }, + { + "$id": "1539", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "delete" + }, + { + "$id": "1540", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "backup" + }, + { + "$id": "1541", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "restore" + }, + { + "$id": "1542", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "recover" + }, + { + "$id": "1543", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "purge" + } + ] + } + } + }, + "tenantId": { + "$id": "1544", + "kind": "string", + "type": { + "$ref": "362" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + } + ] + }, + "enabledForDeployment": { + "$id": "1545", + "kind": "boolean", + "type": { + "$ref": "384" + }, + "value": true + }, + "enabledForDiskEncryption": { + "$id": "1546", + "kind": "boolean", + "type": { + "$ref": "386" + }, + "value": true + }, + "enabledForTemplateDeployment": { + "$id": "1547", + "kind": "boolean", + "type": { + "$ref": "388" + }, + "value": true + }, + "hsmPoolResourceId": { + "$id": "1548", + "kind": "string", + "type": { + "$ref": "382" + }, + "value": "00000000-0000-0000-0000-000000000000" + }, + "provisioningState": { + "$id": "1549", + "kind": "string", + "type": { + "$ref": "90" + }, + "value": "Succeeded" + }, + "publicNetworkAccess": { + "$id": "1550", + "kind": "string", + "type": { + "$ref": "437" + }, + "value": "Enabled" + }, + "sku": { + "$id": "1551", + "kind": "model", + "type": { + "$ref": "355" + }, + "value": { + "name": { + "$id": "1552", + "kind": "string", + "type": { + "$ref": "4" + }, + "value": "standard" + }, + "family": { + "$id": "1553", + "kind": "string", + "type": { + "$ref": "1" + }, + "value": "A" + } + } + }, + "tenantId": { + "$id": "1554", + "kind": "string", + "type": { + "$ref": "352" + }, + "value": "00000000-0000-0000-0000-000000000000" + }, + "vaultUri": { + "$id": "1555", + "kind": "string", + "type": { + "$ref": "380" + }, + "value": "https://sample-vault.vault.azure.net" + } + } + }, + "systemData": { + "$id": "1556", + "kind": "model", + "type": { + "$ref": "336" + }, + "value": { + "createdAt": { + "$id": "1557", + "kind": "string", + "type": { + "$ref": "341" + }, + "value": "2020-01-01T12:00:00.0000000Z" + }, + "createdBy": { + "$id": "1558", + "kind": "string", + "type": { + "$ref": "338" + }, + "value": "keyVaultUser1" + }, + "createdByType": { + "$id": "1559", + "kind": "string", + "type": { + "$ref": "111" + }, + "value": "User" + }, + "lastModifiedAt": { + "$id": "1560", + "kind": "string", + "type": { + "$ref": "347" + }, + "value": "2020-01-01T12:00:00.0000000Z" + }, + "lastModifiedBy": { + "$id": "1561", + "kind": "string", + "type": { + "$ref": "344" + }, + "value": "keyVaultUser2" + }, + "lastModifiedByType": { + "$id": "1562", + "kind": "string", + "type": { + "$ref": "111" + }, + "value": "User" + } + } + }, + "tags": { + "$id": "1563", + "kind": "dict", + "type": { + "$ref": "439" + }, + "value": {} + } + } + } + } + ] + } + ] + }, + "parameters": [ + { + "$id": "1564", + "kind": "method", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "1565", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.update.resourceGroupName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "1566", + "kind": "method", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "The name of the vault.", + "type": { + "$id": "1567", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.update.vaultName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "1568", + "kind": "method", + "name": "parameters", + "serializedName": "parameters", + "doc": "Parameters to patch the vault", + "type": { + "$ref": "491" + }, + "location": "Body", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.update.properties", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "1569", + "kind": "method", + "name": "contentType", + "serializedName": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$ref": "226" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.update.contentType", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "1570", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "228" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.update.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$ref": "318" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.update" + }, + { + "$id": "1571", + "kind": "basic", + "name": "delete", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "Deletes the specified Azure key vault.", + "operation": { + "$id": "1572", + "name": "delete", + "resourceName": "Vault", + "doc": "Deletes the specified Azure key vault.", + "accessibility": "public", + "parameters": [ + { + "$id": "1573", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1574", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "1575", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.delete.apiVersion", + "readOnly": false + }, + { + "$id": "1576", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "1577", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1578", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.delete.subscriptionId" + }, + { + "$id": "1579", + "kind": "path", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "1580", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.delete.resourceGroupName" + }, + { + "$id": "1581", + "kind": "path", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "The name of the vault.", + "type": { + "$id": "1582", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.delete.vaultName" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "headers": [], + "isErrorResponse": false + }, + { + "statusCodes": [ + 204 + ], + "headers": [], + "isErrorResponse": false + } + ], + "httpMethod": "DELETE", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.delete", + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceDelete", + "arguments": {} + } + ], + "examples": [ + { + "$id": "1583", + "kind": "http", + "name": "Delete a vault", + "description": "Delete a vault", + "filePath": "2025-05-01/deleteVault.json", + "parameters": [ + { + "parameter": { + "$ref": "1573" + }, + "value": { + "$id": "1584", + "kind": "string", + "type": { + "$ref": "1574" + }, + "value": "2025-05-01" + } + }, + { + "parameter": { + "$ref": "1579" + }, + "value": { + "$id": "1585", + "kind": "string", + "type": { + "$ref": "1580" + }, + "value": "sample-resource-group" + } + }, + { + "parameter": { + "$ref": "1576" + }, + "value": { + "$id": "1586", + "kind": "string", + "type": { + "$ref": "1577" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + }, + { + "parameter": { + "$ref": "1581" + }, + "value": { + "$id": "1587", + "kind": "string", + "type": { + "$ref": "1582" + }, + "value": "sample-vault" + } + } + ], + "responses": [ + { + "response": { + "statusCodes": [ + 200 + ], + "headers": [], + "isErrorResponse": false + }, + "statusCode": 200 + }, + { + "response": { + "statusCodes": [ + 204 + ], + "headers": [], + "isErrorResponse": false + }, + "statusCode": 204 + } + ] + } + ] + }, + "parameters": [ + { + "$id": "1588", + "kind": "method", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "1589", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.delete.resourceGroupName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "1590", + "kind": "method", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "The name of the vault.", + "type": { + "$id": "1591", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.delete.vaultName", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": {}, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.delete" + }, + { + "$id": "1592", + "kind": "paging", + "name": "listByResourceGroup", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "The List operation gets information about the vaults associated with the subscription and within the specified resource group.", + "operation": { + "$id": "1593", + "name": "listByResourceGroup", + "resourceName": "Vault", + "doc": "The List operation gets information about the vaults associated with the subscription and within the specified resource group.", + "accessibility": "public", + "parameters": [ + { + "$id": "1594", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1595", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "1596", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.listByResourceGroup.apiVersion", + "readOnly": false + }, + { + "$id": "1597", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "1598", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1599", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.listByResourceGroup.subscriptionId" + }, + { + "$id": "1600", + "kind": "path", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "1601", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.listByResourceGroup.resourceGroupName" + }, + { + "$id": "1602", + "kind": "query", + "name": "$top", + "serializedName": "$top", + "doc": "Maximum number of results to return.", + "type": { + "$id": "1603", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "optional": true, + "scope": "Method", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.listByResourceGroup.$top", + "readOnly": false + }, + { + "$id": "1604", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "230" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.listByResourceGroup.accept" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "518" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.listByResourceGroup", + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceList", + "arguments": {} + } + ], + "examples": [ + { + "$id": "1605", + "kind": "http", + "name": "List vaults in the specified resource group", + "description": "List vaults in the specified resource group", + "filePath": "2025-05-01/listVaultByResourceGroup.json", + "parameters": [ + { + "parameter": { + "$ref": "1602" + }, + "value": { + "$id": "1606", + "kind": "number", + "type": { + "$ref": "1603" + }, + "value": 1 + } + }, + { + "parameter": { + "$ref": "1594" + }, + "value": { + "$id": "1607", + "kind": "string", + "type": { + "$ref": "1595" + }, + "value": "2025-05-01" + } + }, + { + "parameter": { + "$ref": "1600" + }, + "value": { + "$id": "1608", + "kind": "string", + "type": { + "$ref": "1601" + }, + "value": "sample-group" + } + }, + { + "parameter": { + "$ref": "1597" + }, + "value": { + "$id": "1609", + "kind": "string", + "type": { + "$ref": "1598" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + ], + "responses": [ + { + "response": { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "518" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + "statusCode": 200, + "bodyValue": { + "$id": "1610", + "kind": "model", + "type": { + "$ref": "518" + }, + "value": { + "nextLink": { + "$id": "1611", + "kind": "string", + "type": { + "$ref": "522" + }, + "value": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults?api-version=2025-05-01&$skiptoken=dmF1bHQtcGVza3ktanVyeS03MzA3Ng==" + }, + "value": { + "$id": "1612", + "kind": "array", + "type": { + "$ref": "520" + }, + "value": [ + { + "$id": "1613", + "kind": "model", + "type": { + "$ref": "318" + }, + "value": { + "name": { + "$id": "1614", + "kind": "string", + "type": { + "$ref": "446" + }, + "value": "sample-vault" + }, + "type": { + "$id": "1615", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/vaults" + }, + "id": { + "$id": "1616", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault" + }, + "location": { + "$id": "1617", + "kind": "string", + "type": { + "$ref": "443" + }, + "value": "westus" + }, + "properties": { + "$id": "1618", + "kind": "model", + "type": { + "$ref": "350" + }, + "value": { + "accessPolicies": { + "$id": "1619", + "kind": "array", + "type": { + "$ref": "359" + }, + "value": [ + { + "$id": "1620", + "kind": "model", + "type": { + "$ref": "360" + }, + "value": { + "objectId": { + "$id": "1621", + "kind": "string", + "type": { + "$ref": "365" + }, + "value": "00000000-0000-0000-0000-000000000000" + }, + "permissions": { + "$id": "1622", + "kind": "model", + "type": { + "$ref": "370" + }, + "value": { + "certificates": { + "$id": "1623", + "kind": "array", + "type": { + "$ref": "376" + }, + "value": [ + { + "$id": "1624", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "get" + }, + { + "$id": "1625", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "list" + }, + { + "$id": "1626", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "delete" + }, + { + "$id": "1627", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "create" + }, + { + "$id": "1628", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "import" + }, + { + "$id": "1629", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "update" + }, + { + "$id": "1630", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "managecontacts" + }, + { + "$id": "1631", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "getissuers" + }, + { + "$id": "1632", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "listissuers" + }, + { + "$id": "1633", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "setissuers" + }, + { + "$id": "1634", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "deleteissuers" + }, + { + "$id": "1635", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "manageissuers" + }, + { + "$id": "1636", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "recover" + }, + { + "$id": "1637", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "purge" + } + ] + }, + "keys": { + "$id": "1638", + "kind": "array", + "type": { + "$ref": "372" + }, + "value": [ + { + "$id": "1639", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "encrypt" + }, + { + "$id": "1640", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "decrypt" + }, + { + "$id": "1641", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "wrapKey" + }, + { + "$id": "1642", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "unwrapKey" + }, + { + "$id": "1643", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "sign" + }, + { + "$id": "1644", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "verify" + }, + { + "$id": "1645", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "get" + }, + { + "$id": "1646", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "list" + }, + { + "$id": "1647", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "create" + }, + { + "$id": "1648", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "update" + }, + { + "$id": "1649", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "import" + }, + { + "$id": "1650", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "delete" + }, + { + "$id": "1651", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "backup" + }, + { + "$id": "1652", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "restore" + }, + { + "$id": "1653", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "recover" + }, + { + "$id": "1654", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "purge" + } + ] + }, + "secrets": { + "$id": "1655", + "kind": "array", + "type": { + "$ref": "374" + }, + "value": [ + { + "$id": "1656", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "get" + }, + { + "$id": "1657", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "list" + }, + { + "$id": "1658", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "set" + }, + { + "$id": "1659", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "delete" + }, + { + "$id": "1660", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "backup" + }, + { + "$id": "1661", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "restore" + }, + { + "$id": "1662", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "recover" + }, + { + "$id": "1663", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "purge" + } + ] + } + } + }, + "tenantId": { + "$id": "1664", + "kind": "string", + "type": { + "$ref": "362" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + } + ] + }, + "enableSoftDelete": { + "$id": "1665", + "kind": "boolean", + "type": { + "$ref": "390" + }, + "value": true + }, + "enabledForDeployment": { + "$id": "1666", + "kind": "boolean", + "type": { + "$ref": "384" + }, + "value": true + }, + "enabledForDiskEncryption": { + "$id": "1667", + "kind": "boolean", + "type": { + "$ref": "386" + }, + "value": true + }, + "enabledForTemplateDeployment": { + "$id": "1668", + "kind": "boolean", + "type": { + "$ref": "388" + }, + "value": true + }, + "hsmPoolResourceId": { + "$id": "1669", + "kind": "string", + "type": { + "$ref": "382" + }, + "value": "00000000-0000-0000-0000-000000000000" + }, + "provisioningState": { + "$id": "1670", + "kind": "string", + "type": { + "$ref": "90" + }, + "value": "Succeeded" + }, + "sku": { + "$id": "1671", + "kind": "model", + "type": { + "$ref": "355" + }, + "value": { + "name": { + "$id": "1672", + "kind": "string", + "type": { + "$ref": "4" + }, + "value": "premium" + }, + "family": { + "$id": "1673", + "kind": "string", + "type": { + "$ref": "1" + }, + "value": "A" + } + } + }, + "tenantId": { + "$id": "1674", + "kind": "string", + "type": { + "$ref": "352" + }, + "value": "00000000-0000-0000-0000-000000000000" + }, + "vaultUri": { + "$id": "1675", + "kind": "string", + "type": { + "$ref": "380" + }, + "value": "https://sample-vault.vault.azure.net/" + } + } + }, + "systemData": { + "$id": "1676", + "kind": "model", + "type": { + "$ref": "336" + }, + "value": { + "createdAt": { + "$id": "1677", + "kind": "string", + "type": { + "$ref": "341" + }, + "value": "2020-01-01T12:00:00.0000000Z" + }, + "createdBy": { + "$id": "1678", + "kind": "string", + "type": { + "$ref": "338" + }, + "value": "keyVaultUser1" + }, + "createdByType": { + "$id": "1679", + "kind": "string", + "type": { + "$ref": "111" + }, + "value": "User" + }, + "lastModifiedAt": { + "$id": "1680", + "kind": "string", + "type": { + "$ref": "347" + }, + "value": "2020-01-01T12:00:00.0000000Z" + }, + "lastModifiedBy": { + "$id": "1681", + "kind": "string", + "type": { + "$ref": "344" + }, + "value": "keyVaultUser2" + }, + "lastModifiedByType": { + "$id": "1682", + "kind": "string", + "type": { + "$ref": "111" + }, + "value": "User" + } + } + }, + "tags": { + "$id": "1683", + "kind": "dict", + "type": { + "$ref": "439" + }, + "value": {} + } + } + } + ] + } + } + } + } + ] + } + ] + }, + "parameters": [ + { + "$id": "1684", + "kind": "method", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "1685", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.listByResourceGroup.resourceGroupName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "1686", + "kind": "method", + "name": "$top", + "serializedName": "$top", + "doc": "Maximum number of results to return.", + "type": { + "$id": "1687", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "optional": true, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.listByResourceGroup.$top", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "1688", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "230" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.listByResourceGroup.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$ref": "520" + }, + "resultSegments": [ + "value" + ] + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.listByResourceGroup", + "pagingMetadata": { + "itemPropertySegments": [ + "value" + ], + "nextLink": { + "responseSegments": [ + "nextLink" + ], + "responseLocation": "Body" + } + } + }, + { + "$id": "1689", + "kind": "paging", + "name": "listBySubscription", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "The List operation gets information about the vaults associated with the subscription.", + "operation": { + "$id": "1690", + "name": "listBySubscription", + "resourceName": "Vault", + "doc": "The List operation gets information about the vaults associated with the subscription.", + "accessibility": "public", + "parameters": [ + { + "$id": "1691", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1692", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "1693", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.listBySubscription.apiVersion", + "readOnly": false + }, + { + "$id": "1694", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "1695", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1696", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.listBySubscription.subscriptionId" + }, + { + "$id": "1697", + "kind": "query", + "name": "$top", + "serializedName": "$top", + "doc": "Maximum number of results to return.", + "type": { + "$id": "1698", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "optional": true, + "scope": "Method", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.listBySubscription.$top", + "readOnly": false + }, + { + "$id": "1699", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "232" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.listBySubscription.accept" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "518" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.listBySubscription", + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceList", + "arguments": {} + } + ], + "examples": [ + { + "$id": "1700", + "kind": "http", + "name": "List vaults in the specified subscription", + "description": "List vaults in the specified subscription", + "filePath": "2025-05-01/listVaultBySubscription.json", + "parameters": [ + { + "parameter": { + "$ref": "1697" + }, + "value": { + "$id": "1701", + "kind": "number", + "type": { + "$ref": "1698" + }, + "value": 1 + } + }, + { + "parameter": { + "$ref": "1691" + }, + "value": { + "$id": "1702", + "kind": "string", + "type": { + "$ref": "1692" + }, + "value": "2025-05-01" + } + }, + { + "parameter": { + "$ref": "1694" + }, + "value": { + "$id": "1703", + "kind": "string", + "type": { + "$ref": "1695" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + ], + "responses": [ + { + "response": { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "518" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + "statusCode": 200, + "bodyValue": { + "$id": "1704", + "kind": "model", + "type": { + "$ref": "518" + }, + "value": { + "nextLink": { + "$id": "1705", + "kind": "string", + "type": { + "$ref": "522" + }, + "value": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resources?api-version=22025-05-01&$skiptoken=dmF1bHQtcGVza3ktanVyeS03MzA3Ng==" + }, + "value": { + "$id": "1706", + "kind": "array", + "type": { + "$ref": "520" + }, + "value": [ + { + "$id": "1707", + "kind": "model", + "type": { + "$ref": "318" + }, + "value": { + "name": { + "$id": "1708", + "kind": "string", + "type": { + "$ref": "446" + }, + "value": "sample-vault" + }, + "type": { + "$id": "1709", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/vaults" + }, + "id": { + "$id": "1710", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault" + }, + "location": { + "$id": "1711", + "kind": "string", + "type": { + "$ref": "443" + }, + "value": "westus" + }, + "properties": { + "$id": "1712", + "kind": "model", + "type": { + "$ref": "350" + }, + "value": { + "accessPolicies": { + "$id": "1713", + "kind": "array", + "type": { + "$ref": "359" + }, + "value": [ + { + "$id": "1714", + "kind": "model", + "type": { + "$ref": "360" + }, + "value": { + "objectId": { + "$id": "1715", + "kind": "string", + "type": { + "$ref": "365" + }, + "value": "00000000-0000-0000-0000-000000000000" + }, + "permissions": { + "$id": "1716", + "kind": "model", + "type": { + "$ref": "370" + }, + "value": { + "certificates": { + "$id": "1717", + "kind": "array", + "type": { + "$ref": "376" + }, + "value": [ + { + "$id": "1718", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "get" + }, + { + "$id": "1719", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "list" + }, + { + "$id": "1720", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "delete" + }, + { + "$id": "1721", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "create" + }, + { + "$id": "1722", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "import" + }, + { + "$id": "1723", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "update" + }, + { + "$id": "1724", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "managecontacts" + }, + { + "$id": "1725", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "getissuers" + }, + { + "$id": "1726", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "listissuers" + }, + { + "$id": "1727", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "setissuers" + }, + { + "$id": "1728", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "deleteissuers" + }, + { + "$id": "1729", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "manageissuers" + }, + { + "$id": "1730", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "recover" + }, + { + "$id": "1731", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "purge" + } + ] + }, + "keys": { + "$id": "1732", + "kind": "array", + "type": { + "$ref": "372" + }, + "value": [ + { + "$id": "1733", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "encrypt" + }, + { + "$id": "1734", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "decrypt" + }, + { + "$id": "1735", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "wrapKey" + }, + { + "$id": "1736", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "unwrapKey" + }, + { + "$id": "1737", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "sign" + }, + { + "$id": "1738", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "verify" + }, + { + "$id": "1739", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "get" + }, + { + "$id": "1740", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "list" + }, + { + "$id": "1741", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "create" + }, + { + "$id": "1742", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "update" + }, + { + "$id": "1743", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "import" + }, + { + "$id": "1744", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "delete" + }, + { + "$id": "1745", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "backup" + }, + { + "$id": "1746", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "restore" + }, + { + "$id": "1747", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "recover" + }, + { + "$id": "1748", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "purge" + } + ] + }, + "secrets": { + "$id": "1749", + "kind": "array", + "type": { + "$ref": "374" + }, + "value": [ + { + "$id": "1750", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "get" + }, + { + "$id": "1751", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "list" + }, + { + "$id": "1752", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "set" + }, + { + "$id": "1753", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "delete" + }, + { + "$id": "1754", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "backup" + }, + { + "$id": "1755", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "restore" + }, + { + "$id": "1756", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "recover" + }, + { + "$id": "1757", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "purge" + } + ] + } + } + }, + "tenantId": { + "$id": "1758", + "kind": "string", + "type": { + "$ref": "362" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + } + ] + }, + "enableSoftDelete": { + "$id": "1759", + "kind": "boolean", + "type": { + "$ref": "390" + }, + "value": true + }, + "enabledForDeployment": { + "$id": "1760", + "kind": "boolean", + "type": { + "$ref": "384" + }, + "value": true + }, + "enabledForDiskEncryption": { + "$id": "1761", + "kind": "boolean", + "type": { + "$ref": "386" + }, + "value": true + }, + "enabledForTemplateDeployment": { + "$id": "1762", + "kind": "boolean", + "type": { + "$ref": "388" + }, + "value": true + }, + "hsmPoolResourceId": { + "$id": "1763", + "kind": "string", + "type": { + "$ref": "382" + }, + "value": "00000000-0000-0000-0000-000000000000" + }, + "provisioningState": { + "$id": "1764", + "kind": "string", + "type": { + "$ref": "90" + }, + "value": "Succeeded" + }, + "sku": { + "$id": "1765", + "kind": "model", + "type": { + "$ref": "355" + }, + "value": { + "name": { + "$id": "1766", + "kind": "string", + "type": { + "$ref": "4" + }, + "value": "premium" + }, + "family": { + "$id": "1767", + "kind": "string", + "type": { + "$ref": "1" + }, + "value": "A" + } + } + }, + "tenantId": { + "$id": "1768", + "kind": "string", + "type": { + "$ref": "352" + }, + "value": "00000000-0000-0000-0000-000000000000" + }, + "vaultUri": { + "$id": "1769", + "kind": "string", + "type": { + "$ref": "380" + }, + "value": "https://sample-vault.vault.azure.net/" + } + } + }, + "systemData": { + "$id": "1770", + "kind": "model", + "type": { + "$ref": "336" + }, + "value": { + "createdAt": { + "$id": "1771", + "kind": "string", + "type": { + "$ref": "341" + }, + "value": "2020-01-01T12:00:00.0000000Z" + }, + "createdBy": { + "$id": "1772", + "kind": "string", + "type": { + "$ref": "338" + }, + "value": "keyVaultUser1" + }, + "createdByType": { + "$id": "1773", + "kind": "string", + "type": { + "$ref": "111" + }, + "value": "User" + }, + "lastModifiedAt": { + "$id": "1774", + "kind": "string", + "type": { + "$ref": "347" + }, + "value": "2020-01-01T12:00:00.0000000Z" + }, + "lastModifiedBy": { + "$id": "1775", + "kind": "string", + "type": { + "$ref": "344" + }, + "value": "keyVaultUser2" + }, + "lastModifiedByType": { + "$id": "1776", + "kind": "string", + "type": { + "$ref": "111" + }, + "value": "User" + } + } + }, + "tags": { + "$id": "1777", + "kind": "dict", + "type": { + "$ref": "439" + }, + "value": {} + } + } + } + ] + } + } + } + } + ] + } + ] + }, + "parameters": [ + { + "$id": "1778", + "kind": "method", + "name": "$top", + "serializedName": "$top", + "doc": "Maximum number of results to return.", + "type": { + "$id": "1779", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "optional": true, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.listBySubscription.$top", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "1780", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "232" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.listBySubscription.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$ref": "520" + }, + "resultSegments": [ + "value" + ] + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.listBySubscription", + "pagingMetadata": { + "itemPropertySegments": [ + "value" + ], + "nextLink": { + "responseSegments": [ + "nextLink" + ], + "responseLocation": "Body" + } + } + }, + { + "$id": "1781", + "kind": "basic", + "name": "updateAccessPolicy", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "Update access policies in a key vault in the specified subscription.", + "operation": { + "$id": "1782", + "name": "updateAccessPolicy", + "resourceName": "Vaults", + "doc": "Update access policies in a key vault in the specified subscription.", + "accessibility": "public", + "parameters": [ + { + "$id": "1783", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1784", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "1785", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.updateAccessPolicy.apiVersion", + "readOnly": false + }, + { + "$id": "1786", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "1787", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1788", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.updateAccessPolicy.subscriptionId" + }, + { + "$id": "1789", + "kind": "path", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "1790", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.updateAccessPolicy.resourceGroupName" + }, + { + "$id": "1791", + "kind": "path", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "Name of the vault", + "type": { + "$id": "1792", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.updateAccessPolicy.vaultName" + }, + { + "$id": "1793", + "kind": "path", + "name": "operationKind", + "serializedName": "operationKind", + "doc": "Name of the operation", + "type": { + "$ref": "208" + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.updateAccessPolicy.operationKind" + }, + { + "$id": "1794", + "kind": "header", + "name": "contentType", + "serializedName": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$ref": "234" + }, + "isApiVersion": false, + "optional": false, + "isContentType": true, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.updateAccessPolicy.contentType" + }, + { + "$id": "1795", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "236" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.updateAccessPolicy.accept" + }, + { + "$id": "1796", + "kind": "body", + "name": "parameters", + "serializedName": "parameters", + "doc": "Access policy to merge into the vault", + "type": { + "$ref": "524" + }, + "isApiVersion": false, + "contentTypes": [ + "application/json" + ], + "defaultContentType": "application/json", + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.updateAccessPolicy.resource" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "524" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + { + "statusCodes": [ + 201 + ], + "bodyType": { + "$ref": "524" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "PUT", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.updateAccessPolicy", + "decorators": [], + "examples": [ + { + "$id": "1797", + "kind": "http", + "name": "Add an access policy, or update an access policy with new permissions", + "description": "Add an access policy, or update an access policy with new permissions", + "filePath": "2025-05-01/updateAccessPoliciesAdd.json", + "parameters": [ + { + "parameter": { + "$ref": "1783" + }, + "value": { + "$id": "1798", + "kind": "string", + "type": { + "$ref": "1784" + }, + "value": "2025-05-01" + } + }, + { + "parameter": { + "$ref": "1793" + }, + "value": { + "$id": "1799", + "kind": "string", + "type": { + "$ref": "208" + }, + "value": "add" + } + }, + { + "parameter": { + "$ref": "1796" + }, + "value": { + "$id": "1800", + "kind": "model", + "type": { + "$ref": "524" + }, + "value": { + "properties": { + "$id": "1801", + "kind": "model", + "type": { + "$ref": "535" + }, + "value": { + "accessPolicies": { + "$id": "1802", + "kind": "array", + "type": { + "$ref": "359" + }, + "value": [ + { + "$id": "1803", + "kind": "model", + "type": { + "$ref": "360" + }, + "value": { + "objectId": { + "$id": "1804", + "kind": "string", + "type": { + "$ref": "365" + }, + "value": "00000000-0000-0000-0000-000000000000" + }, + "permissions": { + "$id": "1805", + "kind": "model", + "type": { + "$ref": "370" + }, + "value": { + "certificates": { + "$id": "1806", + "kind": "array", + "type": { + "$ref": "376" + }, + "value": [ + { + "$id": "1807", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "get" + } + ] + }, + "keys": { + "$id": "1808", + "kind": "array", + "type": { + "$ref": "372" + }, + "value": [ + { + "$id": "1809", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "encrypt" + } + ] + }, + "secrets": { + "$id": "1810", + "kind": "array", + "type": { + "$ref": "374" + }, + "value": [ + { + "$id": "1811", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "get" + } + ] + } + } + }, + "tenantId": { + "$id": "1812", + "kind": "string", + "type": { + "$ref": "362" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + } + ] + } + } + } + } + } + }, + { + "parameter": { + "$ref": "1789" + }, + "value": { + "$id": "1813", + "kind": "string", + "type": { + "$ref": "1790" + }, + "value": "sample-group" + } + }, + { + "parameter": { + "$ref": "1786" + }, + "value": { + "$id": "1814", + "kind": "string", + "type": { + "$ref": "1787" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + }, + { + "parameter": { + "$ref": "1791" + }, + "value": { + "$id": "1815", + "kind": "string", + "type": { + "$ref": "1792" + }, + "value": "sample-vault" + } + } + ], + "responses": [ + { + "response": { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "524" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + "statusCode": 200, + "bodyValue": { + "$id": "1816", + "kind": "model", + "type": { + "$ref": "524" + }, + "value": { + "type": { + "$id": "1817", + "kind": "string", + "type": { + "$ref": "530" + }, + "value": "Microsoft.KeyVault/vaults/accessPolicies" + }, + "id": { + "$id": "1818", + "kind": "string", + "type": { + "$ref": "526" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault/accessPolicies/" + }, + "properties": { + "$id": "1819", + "kind": "model", + "type": { + "$ref": "535" + }, + "value": { + "accessPolicies": { + "$id": "1820", + "kind": "array", + "type": { + "$ref": "359" + }, + "value": [ + { + "$id": "1821", + "kind": "model", + "type": { + "$ref": "360" + }, + "value": { + "objectId": { + "$id": "1822", + "kind": "string", + "type": { + "$ref": "365" + }, + "value": "00000000-0000-0000-0000-000000000000" + }, + "permissions": { + "$id": "1823", + "kind": "model", + "type": { + "$ref": "370" + }, + "value": { + "certificates": { + "$id": "1824", + "kind": "array", + "type": { + "$ref": "376" + }, + "value": [ + { + "$id": "1825", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "get" + } + ] + }, + "keys": { + "$id": "1826", + "kind": "array", + "type": { + "$ref": "372" + }, + "value": [ + { + "$id": "1827", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "encrypt" + } + ] + }, + "secrets": { + "$id": "1828", + "kind": "array", + "type": { + "$ref": "374" + }, + "value": [ + { + "$id": "1829", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "get" + } + ] + } + } + }, + "tenantId": { + "$id": "1830", + "kind": "string", + "type": { + "$ref": "362" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + } + ] + } + } + } + } + } + }, + { + "response": { + "statusCodes": [ + 201 + ], + "bodyType": { + "$ref": "524" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + "statusCode": 201, + "bodyValue": { + "$id": "1831", + "kind": "model", + "type": { + "$ref": "524" + }, + "value": { + "type": { + "$id": "1832", + "kind": "string", + "type": { + "$ref": "530" + }, + "value": "Microsoft.KeyVault/vaults/accessPolicies" + }, + "id": { + "$id": "1833", + "kind": "string", + "type": { + "$ref": "526" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault/accessPolicies/" + }, + "properties": { + "$id": "1834", + "kind": "model", + "type": { + "$ref": "535" + }, + "value": { + "accessPolicies": { + "$id": "1835", + "kind": "array", + "type": { + "$ref": "359" + }, + "value": [ + { + "$id": "1836", + "kind": "model", + "type": { + "$ref": "360" + }, + "value": { + "objectId": { + "$id": "1837", + "kind": "string", + "type": { + "$ref": "365" + }, + "value": "00000000-0000-0000-0000-000000000000" + }, + "permissions": { + "$id": "1838", + "kind": "model", + "type": { + "$ref": "370" + }, + "value": { + "certificates": { + "$id": "1839", + "kind": "array", + "type": { + "$ref": "376" + }, + "value": [ + { + "$id": "1840", + "kind": "string", + "type": { + "$ref": "42" + }, + "value": "get" + } + ] + }, + "keys": { + "$id": "1841", + "kind": "array", + "type": { + "$ref": "372" + }, + "value": [ + { + "$id": "1842", + "kind": "string", + "type": { + "$ref": "8" + }, + "value": "encrypt" + } + ] + }, + "secrets": { + "$id": "1843", + "kind": "array", + "type": { + "$ref": "374" + }, + "value": [ + { + "$id": "1844", + "kind": "string", + "type": { + "$ref": "31" + }, + "value": "get" + } + ] + } + } + }, + "tenantId": { + "$id": "1845", + "kind": "string", + "type": { + "$ref": "362" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + } + ] + } + } + } + } + } + } + ] + } + ] + }, + "parameters": [ + { + "$id": "1846", + "kind": "method", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "1847", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.updateAccessPolicy.resourceGroupName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "1848", + "kind": "method", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "Name of the vault", + "type": { + "$id": "1849", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.updateAccessPolicy.vaultName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "1850", + "kind": "method", + "name": "operationKind", + "serializedName": "operationKind", + "doc": "Name of the operation", + "type": { + "$ref": "208" + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.updateAccessPolicy.operationKind", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "1851", + "kind": "method", + "name": "parameters", + "serializedName": "parameters", + "doc": "Access policy to merge into the vault", + "type": { + "$ref": "524" + }, + "location": "Body", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.updateAccessPolicy.resource", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "1852", + "kind": "method", + "name": "contentType", + "serializedName": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$ref": "234" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.updateAccessPolicy.contentType", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "1853", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "236" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.updateAccessPolicy.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$ref": "524" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.updateAccessPolicy" + }, + { + "$id": "1854", + "kind": "basic", + "name": "GetPrivateLinkResources", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "Gets the private link resources supported for the key vault.", + "operation": { + "$id": "1855", + "name": "GetPrivateLinkResources", + "resourceName": "Vaults", + "doc": "Gets the private link resources supported for the key vault.", + "accessibility": "public", + "parameters": [ + { + "$id": "1856", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1857", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "1858", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.listByVault.apiVersion", + "readOnly": false + }, + { + "$id": "1859", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "1860", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1861", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.listByVault.subscriptionId" + }, + { + "$id": "1862", + "kind": "path", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "1863", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.listByVault.resourceGroupName" + }, + { + "$id": "1864", + "kind": "path", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "The name of the vault.", + "type": { + "$id": "1865", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.listByVault.vaultName" + }, + { + "$id": "1866", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "238" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.listByVault.accept" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "537" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.listByVault", + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceAction", + "arguments": {} + } + ] + }, + "parameters": [ + { + "$id": "1867", + "kind": "method", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "1868", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.listByVault.resourceGroupName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "1869", + "kind": "method", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "The name of the vault.", + "type": { + "$id": "1870", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.listByVault.vaultName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "1871", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "238" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.listByVault.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$ref": "537" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults.listByVault" + } + ], + "parameters": [ + { + "$id": "1872", + "kind": "endpoint", + "name": "endpoint", + "serializedName": "endpoint", + "doc": "Service host", + "type": { + "$id": "1873", + "kind": "url", + "name": "endpoint", + "crossLanguageDefinitionId": "TypeSpec.url" + }, + "isApiVersion": false, + "optional": false, + "scope": "Client", + "isEndpoint": true, + "defaultValue": { + "type": { + "$id": "1874", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "https://management.azure.com" + }, + "serverUrlTemplate": "{endpoint}", + "skipUrlEncoding": false, + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.endpoint" + } + ], + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceOperations", + "arguments": {} + } + ], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Vaults", + "apiVersions": [ + "2025-05-01" + ], + "parent": { + "$ref": "884" + } + }, + { + "$id": "1875", + "kind": "client", + "name": "DeletedVaults", + "namespace": "Azure.ResourceManager.KeyVault", + "methods": [ + { + "$id": "1876", + "kind": "basic", + "name": "getDeleted", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "Gets the deleted Azure key vault.", + "operation": { + "$id": "1877", + "name": "getDeleted", + "resourceName": "DeletedVault", + "doc": "Gets the deleted Azure key vault.", + "accessibility": "public", + "parameters": [ + { + "$id": "1878", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1879", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "1880", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedVaults.getDeleted.apiVersion", + "readOnly": false + }, + { + "$id": "1881", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "1882", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1883", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedVaults.getDeleted.subscriptionId" + }, + { + "$id": "1884", + "kind": "path", + "name": "location", + "serializedName": "location", + "doc": "The name of the Azure region.", + "type": { + "$id": "1885", + "kind": "string", + "name": "azureLocation", + "crossLanguageDefinitionId": "Azure.Core.azureLocation", + "baseType": { + "$id": "1886", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedVaults.getDeleted.location" + }, + { + "$id": "1887", + "kind": "path", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "The name of the vault.", + "type": { + "$id": "1888", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedVaults.getDeleted.vaultName" + }, + { + "$id": "1889", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "240" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedVaults.getDeleted.accept" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "554" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedVaults.getDeleted", + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceRead", + "arguments": {} + } + ] + }, + "parameters": [ + { + "$id": "1890", + "kind": "method", + "name": "location", + "serializedName": "location", + "doc": "The name of the Azure region.", + "type": { + "$id": "1891", + "kind": "string", + "name": "azureLocation", + "crossLanguageDefinitionId": "Azure.Core.azureLocation", + "baseType": { + "$id": "1892", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedVaults.getDeleted.location", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "1893", + "kind": "method", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "The name of the vault.", + "type": { + "$id": "1894", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedVaults.getDeleted.vaultName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "1895", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "240" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedVaults.getDeleted.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$ref": "554" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedVaults.getDeleted" + }, + { + "$id": "1896", + "kind": "lro", + "name": "purgeDeleted", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "Permanently deletes the specified vault. aka Purges the deleted Azure key vault.", + "operation": { + "$id": "1897", + "name": "purgeDeleted", + "resourceName": "DeletedVaults", + "doc": "Permanently deletes the specified vault. aka Purges the deleted Azure key vault.", + "accessibility": "public", + "parameters": [ + { + "$id": "1898", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1899", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "1900", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedVaults.purgeDeleted.apiVersion", + "readOnly": false + }, + { + "$id": "1901", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "1902", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1903", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedVaults.purgeDeleted.subscriptionId" + }, + { + "$id": "1904", + "kind": "path", + "name": "location", + "serializedName": "location", + "doc": "The name of the Azure region.", + "type": { + "$id": "1905", + "kind": "string", + "name": "azureLocation", + "crossLanguageDefinitionId": "Azure.Core.azureLocation", + "baseType": { + "$id": "1906", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedVaults.purgeDeleted.location" + }, + { + "$id": "1907", + "kind": "path", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "The name of the vault.", + "type": { + "$id": "1908", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedVaults.purgeDeleted.vaultName" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "headers": [], + "isErrorResponse": false + }, + { + "statusCodes": [ + 202 + ], + "headers": [ + { + "name": "location", + "nameInResponse": "Location", + "doc": "The Location header contains the URL where the status of the long running operation can be checked.", + "type": { + "$id": "1909", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "name": "retryAfter", + "nameInResponse": "Retry-After", + "doc": "The Retry-After header can indicate how long the client should wait before polling the operation status.", + "type": { + "$id": "1910", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + } + } + ], + "isErrorResponse": false + } + ], + "httpMethod": "POST", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedVaults.purgeDeleted", + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceAction", + "arguments": {} + } + ] + }, + "parameters": [ + { + "$id": "1911", + "kind": "method", + "name": "location", + "serializedName": "location", + "doc": "The name of the Azure region.", + "type": { + "$id": "1912", + "kind": "string", + "name": "azureLocation", + "crossLanguageDefinitionId": "Azure.Core.azureLocation", + "baseType": { + "$id": "1913", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedVaults.purgeDeleted.location", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "1914", + "kind": "method", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "The name of the vault.", + "type": { + "$id": "1915", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedVaults.purgeDeleted.vaultName", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": {}, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedVaults.purgeDeleted", + "lroMetadata": { + "finalStateVia": 1, + "finalResponse": { + "statusCodes": [ + 200 + ] + } + } + } + ], + "parameters": [ + { + "$id": "1916", + "kind": "endpoint", + "name": "endpoint", + "serializedName": "endpoint", + "doc": "Service host", + "type": { + "$id": "1917", + "kind": "url", + "name": "endpoint", + "crossLanguageDefinitionId": "TypeSpec.url" + }, + "isApiVersion": false, + "optional": false, + "scope": "Client", + "isEndpoint": true, + "defaultValue": { + "type": { + "$id": "1918", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "https://management.azure.com" + }, + "serverUrlTemplate": "{endpoint}", + "skipUrlEncoding": false, + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.endpoint" + } + ], + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceOperations", + "arguments": {} + } + ], + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedVaults", + "apiVersions": [ + "2025-05-01" + ], + "parent": { + "$ref": "884" + } + }, + { + "$id": "1919", + "kind": "client", + "name": "PrivateEndpointConnections", + "namespace": "Azure.ResourceManager.KeyVault", + "methods": [ + { + "$id": "1920", + "kind": "basic", + "name": "get", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "Gets the specified private endpoint connection associated with the key vault.", + "operation": { + "$id": "1921", + "name": "get", + "resourceName": "PrivateEndpointConnection", + "doc": "Gets the specified private endpoint connection associated with the key vault.", + "accessibility": "public", + "parameters": [ + { + "$id": "1922", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1923", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "1924", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.get.apiVersion", + "readOnly": false + }, + { + "$id": "1925", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "1926", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1927", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.get.subscriptionId" + }, + { + "$id": "1928", + "kind": "path", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "1929", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.get.resourceGroupName" + }, + { + "$id": "1930", + "kind": "path", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "The name of the vault.", + "type": { + "$id": "1931", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.get.vaultName" + }, + { + "$id": "1932", + "kind": "path", + "name": "privateEndpointConnectionName", + "serializedName": "privateEndpointConnectionName", + "doc": "Name of the private endpoint connection associated with the key vault.", + "type": { + "$id": "1933", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.get.privateEndpointConnectionName" + }, + { + "$id": "1934", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "242" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.get.accept" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "576" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + { + "statusCodes": [ + 204 + ], + "headers": [], + "isErrorResponse": false + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.get", + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceRead", + "arguments": {} + } + ], + "examples": [ + { + "$id": "1935", + "kind": "http", + "name": "KeyVaultGetPrivateEndpointConnection", + "description": "KeyVaultGetPrivateEndpointConnection", + "filePath": "2025-05-01/getPrivateEndpointConnection.json", + "parameters": [ + { + "parameter": { + "$ref": "1922" + }, + "value": { + "$id": "1936", + "kind": "string", + "type": { + "$ref": "1923" + }, + "value": "2025-05-01" + } + }, + { + "parameter": { + "$ref": "1932" + }, + "value": { + "$id": "1937", + "kind": "string", + "type": { + "$ref": "1933" + }, + "value": "sample-pec" + } + }, + { + "parameter": { + "$ref": "1928" + }, + "value": { + "$id": "1938", + "kind": "string", + "type": { + "$ref": "1929" + }, + "value": "sample-group" + } + }, + { + "parameter": { + "$ref": "1925" + }, + "value": { + "$id": "1939", + "kind": "string", + "type": { + "$ref": "1926" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + }, + { + "parameter": { + "$ref": "1930" + }, + "value": { + "$id": "1940", + "kind": "string", + "type": { + "$ref": "1931" + }, + "value": "sample-vault" + } + } + ], + "responses": [ + { + "response": { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "576" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + "statusCode": 200, + "bodyValue": { + "$id": "1941", + "kind": "model", + "type": { + "$ref": "576" + }, + "value": { + "name": { + "$id": "1942", + "kind": "string", + "type": { + "$ref": "583" + }, + "value": "sample-pec" + }, + "type": { + "$id": "1943", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/vaults/privateEndpointConnections" + }, + "etag": { + "$id": "1944", + "kind": "string", + "type": { + "$ref": "589" + }, + "value": "" + }, + "id": { + "$id": "1945", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault/privateEndpointConnections/sample-pec" + }, + "properties": { + "$id": "1946", + "kind": "model", + "type": { + "$ref": "424" + }, + "value": { + "privateEndpoint": { + "$id": "1947", + "kind": "model", + "type": { + "$ref": "426" + }, + "value": { + "id": { + "$id": "1948", + "kind": "string", + "type": { + "$ref": "428" + }, + "value": "/subscriptions/00000000-0000-0000-1234-000000000000/resourceGroups/sample-group/providers/Microsoft.Network/privateEndpoints/sample-pe" + } + } + }, + "privateLinkServiceConnectionState": { + "$id": "1949", + "kind": "model", + "type": { + "$ref": "430" + }, + "value": { + "description": { + "$id": "1950", + "kind": "string", + "type": { + "$ref": "433" + }, + "value": "This was automatically approved by user1234@contoso.com" + }, + "actionsRequired": { + "$id": "1951", + "kind": "string", + "type": { + "$ref": "100" + }, + "value": "None" + }, + "status": { + "$id": "1952", + "kind": "string", + "type": { + "$ref": "94" + }, + "value": "Approved" + } + } + }, + "provisioningState": { + "$id": "1953", + "kind": "string", + "type": { + "$ref": "103" + }, + "value": "Succeeded" + } + } + } + } + } + }, + { + "response": { + "statusCodes": [ + 204 + ], + "headers": [], + "isErrorResponse": false + }, + "statusCode": 204 + } + ] + } + ] + }, + "parameters": [ + { + "$id": "1954", + "kind": "method", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "1955", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.get.resourceGroupName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "1956", + "kind": "method", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "The name of the vault.", + "type": { + "$id": "1957", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.get.vaultName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "1958", + "kind": "method", + "name": "privateEndpointConnectionName", + "serializedName": "privateEndpointConnectionName", + "doc": "Name of the private endpoint connection associated with the key vault.", + "type": { + "$id": "1959", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.get.privateEndpointConnectionName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "1960", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "242" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.get.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$id": "1961", + "kind": "nullable", + "type": { + "$ref": "576" + }, + "namespace": "Azure.ResourceManager.KeyVault" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.get" + }, + { + "$id": "1962", + "kind": "basic", + "name": "put", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "Updates the specified private endpoint connection associated with the key vault.", + "operation": { + "$id": "1963", + "name": "put", + "resourceName": "PrivateEndpointConnection", + "doc": "Updates the specified private endpoint connection associated with the key vault.", + "accessibility": "public", + "parameters": [ + { + "$id": "1964", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1965", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "1966", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.put.apiVersion", + "readOnly": false + }, + { + "$id": "1967", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "1968", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1969", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.put.subscriptionId" + }, + { + "$id": "1970", + "kind": "path", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "1971", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.put.resourceGroupName" + }, + { + "$id": "1972", + "kind": "path", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "The name of the vault.", + "type": { + "$id": "1973", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.put.vaultName" + }, + { + "$id": "1974", + "kind": "path", + "name": "privateEndpointConnectionName", + "serializedName": "privateEndpointConnectionName", + "doc": "Name of the private endpoint connection associated with the key vault.", + "type": { + "$id": "1975", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.put.privateEndpointConnectionName" + }, + { + "$id": "1976", + "kind": "header", + "name": "contentType", + "serializedName": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$ref": "244" + }, + "isApiVersion": false, + "optional": false, + "isContentType": true, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.put.contentType" + }, + { + "$id": "1977", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "246" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.put.accept" + }, + { + "$id": "1978", + "kind": "body", + "name": "properties", + "serializedName": "properties", + "doc": "The intended state of private endpoint connection.", + "type": { + "$ref": "576" + }, + "isApiVersion": false, + "contentTypes": [ + "application/json" + ], + "defaultContentType": "application/json", + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.put.resource" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "576" + }, + "headers": [ + { + "name": "retryAfter", + "nameInResponse": "Retry-After", + "doc": "The Retry-After header can indicate how long the client should wait before polling the operation status.", + "type": { + "$id": "1979", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + } + }, + { + "name": "azureAsyncOperation", + "nameInResponse": "Azure-AsyncOperation", + "doc": "(specified only if operation does not finish synchronously) The URI to poll for completion status. The response of this URI may be synchronous or asynchronous.", + "type": { + "$id": "1980", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "PUT", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.put", + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceCreateOrUpdate", + "arguments": {} + } + ], + "examples": [ + { + "$id": "1981", + "kind": "http", + "name": "KeyVaultPutPrivateEndpointConnection", + "description": "KeyVaultPutPrivateEndpointConnection", + "filePath": "2025-05-01/putPrivateEndpointConnection.json", + "parameters": [ + { + "parameter": { + "$ref": "1964" + }, + "value": { + "$id": "1982", + "kind": "string", + "type": { + "$ref": "1965" + }, + "value": "2025-05-01" + } + }, + { + "parameter": { + "$ref": "1974" + }, + "value": { + "$id": "1983", + "kind": "string", + "type": { + "$ref": "1975" + }, + "value": "sample-pec" + } + }, + { + "parameter": { + "$ref": "1978" + }, + "value": { + "$id": "1984", + "kind": "model", + "type": { + "$ref": "576" + }, + "value": { + "etag": { + "$id": "1985", + "kind": "string", + "type": { + "$ref": "589" + }, + "value": "" + }, + "properties": { + "$id": "1986", + "kind": "model", + "type": { + "$ref": "424" + }, + "value": { + "privateLinkServiceConnectionState": { + "$id": "1987", + "kind": "model", + "type": { + "$ref": "430" + }, + "value": { + "description": { + "$id": "1988", + "kind": "string", + "type": { + "$ref": "433" + }, + "value": "My name is Joe and I'm approving this." + }, + "status": { + "$id": "1989", + "kind": "string", + "type": { + "$ref": "94" + }, + "value": "Approved" + } + } + } + } + } + } + } + }, + { + "parameter": { + "$ref": "1970" + }, + "value": { + "$id": "1990", + "kind": "string", + "type": { + "$ref": "1971" + }, + "value": "sample-group" + } + }, + { + "parameter": { + "$ref": "1967" + }, + "value": { + "$id": "1991", + "kind": "string", + "type": { + "$ref": "1968" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + }, + { + "parameter": { + "$ref": "1972" + }, + "value": { + "$id": "1992", + "kind": "string", + "type": { + "$ref": "1973" + }, + "value": "sample-vault" + } + } + ], + "responses": [ + { + "response": { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "576" + }, + "headers": [ + { + "name": "retryAfter", + "nameInResponse": "Retry-After", + "doc": "The Retry-After header can indicate how long the client should wait before polling the operation status.", + "type": { + "$ref": "1979" + } + }, + { + "name": "azureAsyncOperation", + "nameInResponse": "Azure-AsyncOperation", + "doc": "(specified only if operation does not finish synchronously) The URI to poll for completion status. The response of this URI may be synchronous or asynchronous.", + "type": { + "$ref": "1980" + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + "statusCode": 200, + "bodyValue": { + "$id": "1993", + "kind": "model", + "type": { + "$ref": "576" + }, + "value": { + "name": { + "$id": "1994", + "kind": "string", + "type": { + "$ref": "583" + }, + "value": "sample-pec" + }, + "type": { + "$id": "1995", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/vaults/privateEndpointConnections" + }, + "etag": { + "$id": "1996", + "kind": "string", + "type": { + "$ref": "589" + }, + "value": "" + }, + "id": { + "$id": "1997", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault/privateEndpointConnections/sample-pec" + }, + "properties": { + "$id": "1998", + "kind": "model", + "type": { + "$ref": "424" + }, + "value": { + "privateEndpoint": { + "$id": "1999", + "kind": "model", + "type": { + "$ref": "426" + }, + "value": { + "id": { + "$id": "2000", + "kind": "string", + "type": { + "$ref": "428" + }, + "value": "/subscriptions/00000000-0000-0000-1234-000000000000/resourceGroups/sample-group/providers/Microsoft.Network/privateEndpoints/sample-pe" + } + } + }, + "privateLinkServiceConnectionState": { + "$id": "2001", + "kind": "model", + "type": { + "$ref": "430" + }, + "value": { + "description": { + "$id": "2002", + "kind": "string", + "type": { + "$ref": "433" + }, + "value": "My name is Joe and I'm approving this." + }, + "actionsRequired": { + "$id": "2003", + "kind": "string", + "type": { + "$ref": "100" + }, + "value": "None" + }, + "status": { + "$id": "2004", + "kind": "string", + "type": { + "$ref": "94" + }, + "value": "Approved" + } + } + }, + "provisioningState": { + "$id": "2005", + "kind": "string", + "type": { + "$ref": "103" + }, + "value": "Succeeded" + } + } + } + } + } + } + ] + } + ] + }, + "parameters": [ + { + "$id": "2006", + "kind": "method", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2007", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.put.resourceGroupName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2008", + "kind": "method", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "The name of the vault.", + "type": { + "$id": "2009", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.put.vaultName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2010", + "kind": "method", + "name": "privateEndpointConnectionName", + "serializedName": "privateEndpointConnectionName", + "doc": "Name of the private endpoint connection associated with the key vault.", + "type": { + "$id": "2011", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.put.privateEndpointConnectionName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2012", + "kind": "method", + "name": "properties", + "serializedName": "properties", + "doc": "The intended state of private endpoint connection.", + "type": { + "$ref": "576" + }, + "location": "Body", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.put.resource", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2013", + "kind": "method", + "name": "contentType", + "serializedName": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$ref": "244" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.put.contentType", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2014", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "246" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.put.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$ref": "576" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.put" + }, + { + "$id": "2015", + "kind": "lro", + "name": "delete", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "Deletes the specified private endpoint connection associated with the key vault.", + "operation": { + "$id": "2016", + "name": "delete", + "resourceName": "PrivateEndpointConnection", + "doc": "Deletes the specified private endpoint connection associated with the key vault.", + "accessibility": "public", + "parameters": [ + { + "$id": "2017", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "2018", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "2019", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.delete.apiVersion", + "readOnly": false + }, + { + "$id": "2020", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "2021", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "2022", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.delete.subscriptionId" + }, + { + "$id": "2023", + "kind": "path", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2024", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.delete.resourceGroupName" + }, + { + "$id": "2025", + "kind": "path", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "The name of the vault.", + "type": { + "$id": "2026", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.delete.vaultName" + }, + { + "$id": "2027", + "kind": "path", + "name": "privateEndpointConnectionName", + "serializedName": "privateEndpointConnectionName", + "doc": "Name of the private endpoint connection associated with the key vault.", + "type": { + "$id": "2028", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.delete.privateEndpointConnectionName" + }, + { + "$id": "2029", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "248" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.delete.accept" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "576" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + { + "statusCodes": [ + 202 + ], + "headers": [ + { + "name": "location", + "nameInResponse": "Location", + "doc": "The Location header contains the URL where the status of the long running operation can be checked.", + "type": { + "$id": "2030", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "name": "retryAfter", + "nameInResponse": "Retry-After", + "doc": "The Retry-After header can indicate how long the client should wait before polling the operation status.", + "type": { + "$id": "2031", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + } + } + ], + "isErrorResponse": false + }, + { + "statusCodes": [ + 204 + ], + "headers": [], + "isErrorResponse": false + } + ], + "httpMethod": "DELETE", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.delete", + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceDelete", + "arguments": {} + } + ], + "examples": [ + { + "$id": "2032", + "kind": "http", + "name": "KeyVaultDeletePrivateEndpointConnection", + "description": "KeyVaultDeletePrivateEndpointConnection", + "filePath": "2025-05-01/deletePrivateEndpointConnection.json", + "parameters": [ + { + "parameter": { + "$ref": "2017" + }, + "value": { + "$id": "2033", + "kind": "string", + "type": { + "$ref": "2018" + }, + "value": "2025-05-01" + } + }, + { + "parameter": { + "$ref": "2027" + }, + "value": { + "$id": "2034", + "kind": "string", + "type": { + "$ref": "2028" + }, + "value": "sample-pec" + } + }, + { + "parameter": { + "$ref": "2023" + }, + "value": { + "$id": "2035", + "kind": "string", + "type": { + "$ref": "2024" + }, + "value": "sample-group" + } + }, + { + "parameter": { + "$ref": "2020" + }, + "value": { + "$id": "2036", + "kind": "string", + "type": { + "$ref": "2021" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + }, + { + "parameter": { + "$ref": "2025" + }, + "value": { + "$id": "2037", + "kind": "string", + "type": { + "$ref": "2026" + }, + "value": "sample-vault" + } + } + ], + "responses": [ + { + "response": { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "576" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + "statusCode": 200, + "bodyValue": { + "$id": "2038", + "kind": "model", + "type": { + "$ref": "576" + }, + "value": { + "name": { + "$id": "2039", + "kind": "string", + "type": { + "$ref": "583" + }, + "value": "sample-pec" + }, + "type": { + "$id": "2040", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/vaults/privateEndpointConnections" + }, + "id": { + "$id": "2041", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault/privateEndpointConnections/sample-pec" + }, + "properties": { + "$id": "2042", + "kind": "model", + "type": { + "$ref": "424" + }, + "value": { + "provisioningState": { + "$id": "2043", + "kind": "string", + "type": { + "$ref": "103" + }, + "value": "Disconnected" + } + } + } + } + } + }, + { + "response": { + "statusCodes": [ + 202 + ], + "headers": [ + { + "name": "location", + "nameInResponse": "Location", + "doc": "The Location header contains the URL where the status of the long running operation can be checked.", + "type": { + "$ref": "2030" + } + }, + { + "name": "retryAfter", + "nameInResponse": "Retry-After", + "doc": "The Retry-After header can indicate how long the client should wait before polling the operation status.", + "type": { + "$ref": "2031" + } + } + ], + "isErrorResponse": false + }, + "statusCode": 202 + }, + { + "response": { + "statusCodes": [ + 204 + ], + "headers": [], + "isErrorResponse": false + }, + "statusCode": 204 + } + ] + } + ] + }, + "parameters": [ + { + "$id": "2044", + "kind": "method", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2045", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.delete.resourceGroupName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2046", + "kind": "method", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "The name of the vault.", + "type": { + "$id": "2047", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.delete.vaultName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2048", + "kind": "method", + "name": "privateEndpointConnectionName", + "serializedName": "privateEndpointConnectionName", + "doc": "Name of the private endpoint connection associated with the key vault.", + "type": { + "$id": "2049", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.delete.privateEndpointConnectionName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2050", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "250" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.delete.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$ref": "576" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.delete", + "lroMetadata": { + "finalStateVia": 1, + "finalResponse": { + "statusCodes": [ + 204 + ], + "bodyType": { + "$ref": "576" + } + } + } + }, + { + "$id": "2051", + "kind": "paging", + "name": "listByResource", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "The List operation gets information about the private endpoint connections associated with the vault.", + "operation": { + "$id": "2052", + "name": "listByResource", + "resourceName": "PrivateEndpointConnection", + "doc": "The List operation gets information about the private endpoint connections associated with the vault.", + "accessibility": "public", + "parameters": [ + { + "$id": "2053", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "2054", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "2055", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.listByResource.apiVersion", + "readOnly": false + }, + { + "$id": "2056", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "2057", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "2058", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.listByResource.subscriptionId" + }, + { + "$id": "2059", + "kind": "path", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2060", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.listByResource.resourceGroupName" + }, + { + "$id": "2061", + "kind": "path", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "The name of the vault.", + "type": { + "$id": "2062", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.listByResource.vaultName" + }, + { + "$id": "2063", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "252" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.listByResource.accept" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "591" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.listByResource", + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceList", + "arguments": {} + } + ], + "examples": [ + { + "$id": "2064", + "kind": "http", + "name": "KeyVaultListPrivateEndpointConnection", + "description": "KeyVaultListPrivateEndpointConnection", + "filePath": "2025-05-01/listPrivateEndpointConnection.json", + "parameters": [ + { + "parameter": { + "$ref": "2053" + }, + "value": { + "$id": "2065", + "kind": "string", + "type": { + "$ref": "2054" + }, + "value": "2025-05-01" + } + }, + { + "parameter": { + "$ref": "2059" + }, + "value": { + "$id": "2066", + "kind": "string", + "type": { + "$ref": "2060" + }, + "value": "sample-group" + } + }, + { + "parameter": { + "$ref": "2056" + }, + "value": { + "$id": "2067", + "kind": "string", + "type": { + "$ref": "2057" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + }, + { + "parameter": { + "$ref": "2061" + }, + "value": { + "$id": "2068", + "kind": "string", + "type": { + "$ref": "2062" + }, + "value": "sample-vault" + } + } + ], + "responses": [ + { + "response": { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "591" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + "statusCode": 200, + "bodyValue": { + "$id": "2069", + "kind": "model", + "type": { + "$ref": "591" + }, + "value": { + "value": { + "$id": "2070", + "kind": "array", + "type": { + "$ref": "593" + }, + "value": [ + { + "$id": "2071", + "kind": "model", + "type": { + "$ref": "576" + }, + "value": { + "name": { + "$id": "2072", + "kind": "string", + "type": { + "$ref": "583" + }, + "value": "sample-pec" + }, + "type": { + "$id": "2073", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/vaults/privateEndpointConnections" + }, + "etag": { + "$id": "2074", + "kind": "string", + "type": { + "$ref": "589" + }, + "value": "" + }, + "id": { + "$id": "2075", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault/privateEndpointConnections/sample-pec" + }, + "properties": { + "$id": "2076", + "kind": "model", + "type": { + "$ref": "424" + }, + "value": { + "privateEndpoint": { + "$id": "2077", + "kind": "model", + "type": { + "$ref": "426" + }, + "value": { + "id": { + "$id": "2078", + "kind": "string", + "type": { + "$ref": "428" + }, + "value": "/subscriptions/00000000-0000-0000-1234-000000000000/resourceGroups/sample-group/providers/Microsoft.Network/privateEndpoints/sample-pe" + } + } + }, + "privateLinkServiceConnectionState": { + "$id": "2079", + "kind": "model", + "type": { + "$ref": "430" + }, + "value": { + "description": { + "$id": "2080", + "kind": "string", + "type": { + "$ref": "433" + }, + "value": "This was automatically approved by user1234@contoso.com" + }, + "actionsRequired": { + "$id": "2081", + "kind": "string", + "type": { + "$ref": "100" + }, + "value": "None" + }, + "status": { + "$id": "2082", + "kind": "string", + "type": { + "$ref": "94" + }, + "value": "Approved" + } + } + }, + "provisioningState": { + "$id": "2083", + "kind": "string", + "type": { + "$ref": "103" + }, + "value": "Succeeded" + } + } + } + } + }, + { + "$id": "2084", + "kind": "model", + "type": { + "$ref": "576" + }, + "value": { + "name": { + "$id": "2085", + "kind": "string", + "type": { + "$ref": "583" + }, + "value": "sample-pec" + }, + "type": { + "$id": "2086", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/vaults/privateEndpointConnections" + }, + "etag": { + "$id": "2087", + "kind": "string", + "type": { + "$ref": "589" + }, + "value": "" + }, + "id": { + "$id": "2088", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault/privateEndpointConnections/sample-pec" + }, + "properties": { + "$id": "2089", + "kind": "model", + "type": { + "$ref": "424" + }, + "value": { + "privateEndpoint": { + "$id": "2090", + "kind": "model", + "type": { + "$ref": "426" + }, + "value": { + "id": { + "$id": "2091", + "kind": "string", + "type": { + "$ref": "428" + }, + "value": "/subscriptions/00000000-0000-0000-1234-000000000000/resourceGroups/sample-group/providers/Microsoft.Network/privateEndpoints/sample-pe" + } + } + }, + "privateLinkServiceConnectionState": { + "$id": "2092", + "kind": "model", + "type": { + "$ref": "430" + }, + "value": { + "description": { + "$id": "2093", + "kind": "string", + "type": { + "$ref": "433" + }, + "value": "This was automatically approved by user1234@contoso.com" + }, + "actionsRequired": { + "$id": "2094", + "kind": "string", + "type": { + "$ref": "100" + }, + "value": "None" + }, + "status": { + "$id": "2095", + "kind": "string", + "type": { + "$ref": "94" + }, + "value": "Approved" + } + } + }, + "provisioningState": { + "$id": "2096", + "kind": "string", + "type": { + "$ref": "103" + }, + "value": "Succeeded" + } + } + } + } + } + ] + } + } + } + } + ] + } + ] + }, + "parameters": [ + { + "$id": "2097", + "kind": "method", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2098", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.listByResource.resourceGroupName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2099", + "kind": "method", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "The name of the vault.", + "type": { + "$id": "2100", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.listByResource.vaultName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2101", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "252" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.listByResource.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$ref": "593" + }, + "resultSegments": [ + "value" + ] + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections.listByResource", + "pagingMetadata": { + "itemPropertySegments": [ + "value" + ], + "nextLink": { + "responseSegments": [ + "nextLink" + ], + "responseLocation": "Body" + } + } + } + ], + "parameters": [ + { + "$id": "2102", + "kind": "endpoint", + "name": "endpoint", + "serializedName": "endpoint", + "doc": "Service host", + "type": { + "$id": "2103", + "kind": "url", + "name": "endpoint", + "crossLanguageDefinitionId": "TypeSpec.url" + }, + "isApiVersion": false, + "optional": false, + "scope": "Client", + "isEndpoint": true, + "defaultValue": { + "type": { + "$id": "2104", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "https://management.azure.com" + }, + "serverUrlTemplate": "{endpoint}", + "skipUrlEncoding": false, + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.endpoint" + } + ], + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceOperations", + "arguments": {} + } + ], + "crossLanguageDefinitionId": "Microsoft.KeyVault.PrivateEndpointConnections", + "apiVersions": [ + "2025-05-01" + ], + "parent": { + "$ref": "884" + } + }, + { + "$id": "2105", + "kind": "client", + "name": "ManagedHsms", + "namespace": "Azure.ResourceManager.KeyVault", + "methods": [ + { + "$id": "2106", + "kind": "basic", + "name": "get", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "Gets the specified managed HSM Pool.", + "operation": { + "$id": "2107", + "name": "get", + "resourceName": "ManagedHsm", + "doc": "Gets the specified managed HSM Pool.", + "accessibility": "public", + "parameters": [ + { + "$id": "2108", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "2109", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "2110", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.get.apiVersion", + "readOnly": false + }, + { + "$id": "2111", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "2112", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "2113", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.get.subscriptionId" + }, + { + "$id": "2114", + "kind": "path", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2115", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.get.resourceGroupName" + }, + { + "$id": "2116", + "kind": "path", + "name": "name", + "serializedName": "name", + "doc": "The name of the managed HSM Pool.", + "type": { + "$id": "2117", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.get.name" + }, + { + "$id": "2118", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "254" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.get.accept" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "597" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + { + "statusCodes": [ + 204 + ], + "headers": [], + "isErrorResponse": false + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.get", + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceRead", + "arguments": {} + } + ], + "examples": [ + { + "$id": "2119", + "kind": "http", + "name": "Retrieve a managed HSM Pool", + "description": "Retrieve a managed HSM Pool", + "filePath": "2025-05-01/ManagedHsm_Get.json", + "parameters": [ + { + "parameter": { + "$ref": "2116" + }, + "value": { + "$id": "2120", + "kind": "string", + "type": { + "$ref": "2117" + }, + "value": "hsm1" + } + }, + { + "parameter": { + "$ref": "2108" + }, + "value": { + "$id": "2121", + "kind": "string", + "type": { + "$ref": "2109" + }, + "value": "2025-05-01" + } + }, + { + "parameter": { + "$ref": "2114" + }, + "value": { + "$id": "2122", + "kind": "string", + "type": { + "$ref": "2115" + }, + "value": "hsm-group" + } + }, + { + "parameter": { + "$ref": "2111" + }, + "value": { + "$id": "2123", + "kind": "string", + "type": { + "$ref": "2112" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + ], + "responses": [ + { + "response": { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "597" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + "statusCode": 200, + "bodyValue": { + "$id": "2124", + "kind": "model", + "type": { + "$ref": "597" + }, + "value": { + "name": { + "$id": "2125", + "kind": "string", + "type": { + "$ref": "688" + }, + "value": "hsm1" + }, + "type": { + "$id": "2126", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/managedHSMs" + }, + "id": { + "$id": "2127", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.KeyVault/managedHSMs/hsm1" + }, + "location": { + "$id": "2128", + "kind": "string", + "type": { + "$ref": "685" + }, + "value": "westus" + }, + "properties": { + "$id": "2129", + "kind": "model", + "type": { + "$ref": "607" + }, + "value": { + "enablePurgeProtection": { + "$id": "2130", + "kind": "boolean", + "type": { + "$ref": "619" + }, + "value": false + }, + "enableSoftDelete": { + "$id": "2131", + "kind": "boolean", + "type": { + "$ref": "615" + }, + "value": true + }, + "hsmUri": { + "$id": "2132", + "kind": "string", + "type": { + "$ref": "613" + }, + "value": "https://westus.hsm1.managedhsm.azure.net" + }, + "initialAdminObjectIds": { + "$id": "2133", + "kind": "array", + "type": { + "$ref": "547" + }, + "value": [ + { + "$id": "2134", + "kind": "string", + "type": { + "$ref": "548" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + ] + }, + "provisioningState": { + "$id": "2135", + "kind": "string", + "type": { + "$ref": "130" + }, + "value": "Succeeded" + }, + "softDeleteRetentionInDays": { + "$id": "2136", + "kind": "number", + "type": { + "$ref": "617" + }, + "value": 90 + }, + "statusMessage": { + "$id": "2137", + "kind": "string", + "type": { + "$ref": "622" + }, + "value": "ManagedHsm is functional." + }, + "tenantId": { + "$id": "2138", + "kind": "string", + "type": { + "$ref": "609" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + }, + "sku": { + "$id": "2139", + "kind": "model", + "type": { + "$ref": "690" + }, + "value": { + "name": { + "$id": "2140", + "kind": "string", + "type": { + "$ref": "187" + }, + "value": "Standard_B1" + }, + "family": { + "$id": "2141", + "kind": "string", + "type": { + "$ref": "183" + }, + "value": "B" + } + } + }, + "tags": { + "$id": "2142", + "kind": "dict", + "type": { + "$ref": "439" + }, + "value": { + "Dept": { + "$id": "2143", + "kind": "string", + "type": { + "$ref": "441" + }, + "value": "hsm" + }, + "Environment": { + "$id": "2144", + "kind": "string", + "type": { + "$ref": "441" + }, + "value": "dogfood" + } + } + } + } + } + }, + { + "response": { + "statusCodes": [ + 204 + ], + "headers": [], + "isErrorResponse": false + }, + "statusCode": 204 + } + ] + } + ] + }, + "parameters": [ + { + "$id": "2145", + "kind": "method", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2146", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.get.resourceGroupName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2147", + "kind": "method", + "name": "name", + "serializedName": "name", + "doc": "The name of the managed HSM Pool.", + "type": { + "$id": "2148", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.get.name", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2149", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "254" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.get.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$id": "2150", + "kind": "nullable", + "type": { + "$ref": "597" + }, + "namespace": "Azure.ResourceManager.KeyVault" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.get" + }, + { + "$id": "2151", + "kind": "lro", + "name": "createOrUpdate", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "Create or update a managed HSM Pool in the specified subscription.", + "operation": { + "$id": "2152", + "name": "createOrUpdate", + "resourceName": "ManagedHsm", + "doc": "Create or update a managed HSM Pool in the specified subscription.", + "accessibility": "public", + "parameters": [ + { + "$id": "2153", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "2154", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "2155", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.createOrUpdate.apiVersion", + "readOnly": false + }, + { + "$id": "2156", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "2157", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "2158", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.createOrUpdate.subscriptionId" + }, + { + "$id": "2159", + "kind": "path", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2160", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.createOrUpdate.resourceGroupName" + }, + { + "$id": "2161", + "kind": "path", + "name": "name", + "serializedName": "name", + "doc": "The name of the managed HSM Pool.", + "type": { + "$id": "2162", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.createOrUpdate.name" + }, + { + "$id": "2163", + "kind": "header", + "name": "contentType", + "serializedName": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$ref": "256" + }, + "isApiVersion": false, + "optional": false, + "isContentType": true, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.createOrUpdate.contentType" + }, + { + "$id": "2164", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "258" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.createOrUpdate.accept" + }, + { + "$id": "2165", + "kind": "body", + "name": "parameters", + "serializedName": "parameters", + "doc": "Parameters to create or update the managed HSM Pool", + "type": { + "$ref": "597" + }, + "isApiVersion": false, + "contentTypes": [ + "application/json" + ], + "defaultContentType": "application/json", + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.createOrUpdate.resource" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "597" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + { + "statusCodes": [ + 202 + ], + "bodyType": { + "$ref": "597" + }, + "headers": [ + { + "name": "location", + "nameInResponse": "Location", + "doc": "The Location header contains the URL where the status of the long running operation can be checked.", + "type": { + "$id": "2166", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "name": "retryAfter", + "nameInResponse": "Retry-After", + "doc": "The Retry-After header can indicate how long the client should wait before polling the operation status.", + "type": { + "$id": "2167", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "PUT", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.createOrUpdate", + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceCreateOrUpdate", + "arguments": {} + } + ], + "examples": [ + { + "$id": "2168", + "kind": "http", + "name": "Create a new managed HSM Pool or update an existing managed HSM Pool", + "description": "Create a new managed HSM Pool or update an existing managed HSM Pool", + "filePath": "2025-05-01/ManagedHsm_CreateOrUpdate.json", + "parameters": [ + { + "parameter": { + "$ref": "2161" + }, + "value": { + "$id": "2169", + "kind": "string", + "type": { + "$ref": "2162" + }, + "value": "hsm1" + } + }, + { + "parameter": { + "$ref": "2153" + }, + "value": { + "$id": "2170", + "kind": "string", + "type": { + "$ref": "2154" + }, + "value": "2025-05-01" + } + }, + { + "parameter": { + "$ref": "2165" + }, + "value": { + "$id": "2171", + "kind": "model", + "type": { + "$ref": "597" + }, + "value": { + "location": { + "$id": "2172", + "kind": "string", + "type": { + "$ref": "685" + }, + "value": "westus" + }, + "properties": { + "$id": "2173", + "kind": "model", + "type": { + "$ref": "607" + }, + "value": { + "enablePurgeProtection": { + "$id": "2174", + "kind": "boolean", + "type": { + "$ref": "619" + }, + "value": false + }, + "enableSoftDelete": { + "$id": "2175", + "kind": "boolean", + "type": { + "$ref": "615" + }, + "value": true + }, + "initialAdminObjectIds": { + "$id": "2176", + "kind": "array", + "type": { + "$ref": "547" + }, + "value": [ + { + "$id": "2177", + "kind": "string", + "type": { + "$ref": "548" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + ] + }, + "softDeleteRetentionInDays": { + "$id": "2178", + "kind": "number", + "type": { + "$ref": "617" + }, + "value": 90 + }, + "tenantId": { + "$id": "2179", + "kind": "string", + "type": { + "$ref": "609" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + }, + "sku": { + "$id": "2180", + "kind": "model", + "type": { + "$ref": "690" + }, + "value": { + "name": { + "$id": "2181", + "kind": "string", + "type": { + "$ref": "187" + }, + "value": "Standard_B1" + }, + "family": { + "$id": "2182", + "kind": "string", + "type": { + "$ref": "183" + }, + "value": "B" + } + } + }, + "tags": { + "$id": "2183", + "kind": "dict", + "type": { + "$ref": "439" + }, + "value": { + "Dept": { + "$id": "2184", + "kind": "string", + "type": { + "$ref": "441" + }, + "value": "hsm" + }, + "Environment": { + "$id": "2185", + "kind": "string", + "type": { + "$ref": "441" + }, + "value": "dogfood" + } + } + } + } + } + }, + { + "parameter": { + "$ref": "2159" + }, + "value": { + "$id": "2186", + "kind": "string", + "type": { + "$ref": "2160" + }, + "value": "hsm-group" + } + }, + { + "parameter": { + "$ref": "2156" + }, + "value": { + "$id": "2187", + "kind": "string", + "type": { + "$ref": "2157" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + ], + "responses": [ + { + "response": { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "597" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + "statusCode": 200, + "bodyValue": { + "$id": "2188", + "kind": "model", + "type": { + "$ref": "597" + }, + "value": { + "name": { + "$id": "2189", + "kind": "string", + "type": { + "$ref": "688" + }, + "value": "hsm1" + }, + "type": { + "$id": "2190", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/managedHSMs" + }, + "id": { + "$id": "2191", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.KeyVault/managedHSMs/hsm1" + }, + "location": { + "$id": "2192", + "kind": "string", + "type": { + "$ref": "685" + }, + "value": "westus" + }, + "properties": { + "$id": "2193", + "kind": "model", + "type": { + "$ref": "607" + }, + "value": { + "enablePurgeProtection": { + "$id": "2194", + "kind": "boolean", + "type": { + "$ref": "619" + }, + "value": false + }, + "enableSoftDelete": { + "$id": "2195", + "kind": "boolean", + "type": { + "$ref": "615" + }, + "value": true + }, + "hsmUri": { + "$id": "2196", + "kind": "string", + "type": { + "$ref": "613" + }, + "value": "https://westus.hsm1.managedhsm.azure.net" + }, + "initialAdminObjectIds": { + "$id": "2197", + "kind": "array", + "type": { + "$ref": "547" + }, + "value": [ + { + "$id": "2198", + "kind": "string", + "type": { + "$ref": "548" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + ] + }, + "provisioningState": { + "$id": "2199", + "kind": "string", + "type": { + "$ref": "130" + }, + "value": "Succeeded" + }, + "softDeleteRetentionInDays": { + "$id": "2200", + "kind": "number", + "type": { + "$ref": "617" + }, + "value": 90 + }, + "statusMessage": { + "$id": "2201", + "kind": "string", + "type": { + "$ref": "622" + }, + "value": "ManagedHsm is functional." + }, + "tenantId": { + "$id": "2202", + "kind": "string", + "type": { + "$ref": "609" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + }, + "sku": { + "$id": "2203", + "kind": "model", + "type": { + "$ref": "690" + }, + "value": { + "name": { + "$id": "2204", + "kind": "string", + "type": { + "$ref": "187" + }, + "value": "Standard_B1" + }, + "family": { + "$id": "2205", + "kind": "string", + "type": { + "$ref": "183" + }, + "value": "B" + } + } + }, + "tags": { + "$id": "2206", + "kind": "dict", + "type": { + "$ref": "439" + }, + "value": { + "Dept": { + "$id": "2207", + "kind": "string", + "type": { + "$ref": "441" + }, + "value": "hsm" + }, + "Environment": { + "$id": "2208", + "kind": "string", + "type": { + "$ref": "441" + }, + "value": "dogfood" + } + } + } + } + } + }, + { + "response": { + "statusCodes": [ + 202 + ], + "bodyType": { + "$ref": "597" + }, + "headers": [ + { + "name": "location", + "nameInResponse": "Location", + "doc": "The Location header contains the URL where the status of the long running operation can be checked.", + "type": { + "$ref": "2166" + } + }, + { + "name": "retryAfter", + "nameInResponse": "Retry-After", + "doc": "The Retry-After header can indicate how long the client should wait before polling the operation status.", + "type": { + "$ref": "2167" + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + "statusCode": 202, + "bodyValue": { + "$id": "2209", + "kind": "model", + "type": { + "$ref": "597" + }, + "value": { + "name": { + "$id": "2210", + "kind": "string", + "type": { + "$ref": "688" + }, + "value": "hsm1" + }, + "type": { + "$id": "2211", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/managedHSMs" + }, + "id": { + "$id": "2212", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.KeyVault/managedHSMs/hsm1" + }, + "location": { + "$id": "2213", + "kind": "string", + "type": { + "$ref": "685" + }, + "value": "westus" + }, + "properties": { + "$id": "2214", + "kind": "model", + "type": { + "$ref": "607" + }, + "value": { + "enablePurgeProtection": { + "$id": "2215", + "kind": "boolean", + "type": { + "$ref": "619" + }, + "value": false + }, + "enableSoftDelete": { + "$id": "2216", + "kind": "boolean", + "type": { + "$ref": "615" + }, + "value": true + }, + "initialAdminObjectIds": { + "$id": "2217", + "kind": "array", + "type": { + "$ref": "547" + }, + "value": [ + { + "$id": "2218", + "kind": "string", + "type": { + "$ref": "548" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + ] + }, + "provisioningState": { + "$id": "2219", + "kind": "string", + "type": { + "$ref": "130" + }, + "value": "Provisioning" + }, + "softDeleteRetentionInDays": { + "$id": "2220", + "kind": "number", + "type": { + "$ref": "617" + }, + "value": 90 + }, + "statusMessage": { + "$id": "2221", + "kind": "string", + "type": { + "$ref": "622" + }, + "value": "Allocating hardware" + }, + "tenantId": { + "$id": "2222", + "kind": "string", + "type": { + "$ref": "609" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + }, + "sku": { + "$id": "2223", + "kind": "model", + "type": { + "$ref": "690" + }, + "value": { + "name": { + "$id": "2224", + "kind": "string", + "type": { + "$ref": "187" + }, + "value": "Standard_B1" + }, + "family": { + "$id": "2225", + "kind": "string", + "type": { + "$ref": "183" + }, + "value": "B" + } + } + }, + "tags": { + "$id": "2226", + "kind": "dict", + "type": { + "$ref": "439" + }, + "value": { + "Dept": { + "$id": "2227", + "kind": "string", + "type": { + "$ref": "441" + }, + "value": "hsm" + }, + "Environment": { + "$id": "2228", + "kind": "string", + "type": { + "$ref": "441" + }, + "value": "dogfood" + } + } + } + } + } + } + ] + } + ] + }, + "parameters": [ + { + "$id": "2229", + "kind": "method", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2230", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.createOrUpdate.resourceGroupName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2231", + "kind": "method", + "name": "name", + "serializedName": "name", + "doc": "The name of the managed HSM Pool.", + "type": { + "$id": "2232", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.createOrUpdate.name", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2233", + "kind": "method", + "name": "parameters", + "serializedName": "parameters", + "doc": "Parameters to create or update the managed HSM Pool", + "type": { + "$ref": "597" + }, + "location": "Body", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.createOrUpdate.resource", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2234", + "kind": "method", + "name": "contentType", + "serializedName": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$ref": "260" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.createOrUpdate.contentType", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2235", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "262" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.createOrUpdate.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$ref": "597" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.createOrUpdate", + "lroMetadata": { + "finalStateVia": 1, + "finalResponse": { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "597" + } + } + } + }, + { + "$id": "2236", + "kind": "lro", + "name": "update", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "Update a managed HSM Pool in the specified subscription.", + "operation": { + "$id": "2237", + "name": "update", + "resourceName": "ManagedHsm", + "doc": "Update a managed HSM Pool in the specified subscription.", + "accessibility": "public", + "parameters": [ + { + "$id": "2238", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "2239", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "2240", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.update.apiVersion", + "readOnly": false + }, + { + "$id": "2241", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "2242", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "2243", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.update.subscriptionId" + }, + { + "$id": "2244", + "kind": "path", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2245", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.update.resourceGroupName" + }, + { + "$id": "2246", + "kind": "path", + "name": "name", + "serializedName": "name", + "doc": "The name of the managed HSM Pool.", + "type": { + "$id": "2247", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.update.name" + }, + { + "$id": "2248", + "kind": "header", + "name": "contentType", + "serializedName": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$ref": "264" + }, + "isApiVersion": false, + "optional": false, + "isContentType": true, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.update.contentType" + }, + { + "$id": "2249", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "266" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.update.accept" + }, + { + "$id": "2250", + "kind": "body", + "name": "parameters", + "serializedName": "parameters", + "doc": "Parameters to patch the managed HSM Pool", + "type": { + "$ref": "597" + }, + "isApiVersion": false, + "contentTypes": [ + "application/json" + ], + "defaultContentType": "application/json", + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.update.properties" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "597" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + { + "statusCodes": [ + 202 + ], + "bodyType": { + "$ref": "597" + }, + "headers": [ + { + "name": "location", + "nameInResponse": "Location", + "doc": "The Location header contains the URL where the status of the long running operation can be checked.", + "type": { + "$id": "2251", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "name": "retryAfter", + "nameInResponse": "Retry-After", + "doc": "The Retry-After header can indicate how long the client should wait before polling the operation status.", + "type": { + "$id": "2252", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "PATCH", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.update", + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceUpdate", + "arguments": {} + } + ], + "examples": [ + { + "$id": "2253", + "kind": "http", + "name": "Update an existing managed HSM Pool", + "description": "Update an existing managed HSM Pool", + "filePath": "2025-05-01/ManagedHsm_Update.json", + "parameters": [ + { + "parameter": { + "$ref": "2246" + }, + "value": { + "$id": "2254", + "kind": "string", + "type": { + "$ref": "2247" + }, + "value": "hsm1" + } + }, + { + "parameter": { + "$ref": "2238" + }, + "value": { + "$id": "2255", + "kind": "string", + "type": { + "$ref": "2239" + }, + "value": "2025-05-01" + } + }, + { + "parameter": { + "$ref": "2250" + }, + "value": { + "$id": "2256", + "kind": "model", + "type": { + "$ref": "597" + }, + "value": { + "tags": { + "$id": "2257", + "kind": "dict", + "type": { + "$ref": "439" + }, + "value": { + "Dept": { + "$id": "2258", + "kind": "string", + "type": { + "$ref": "441" + }, + "value": "hsm" + }, + "Environment": { + "$id": "2259", + "kind": "string", + "type": { + "$ref": "441" + }, + "value": "dogfood" + }, + "Slice": { + "$id": "2260", + "kind": "string", + "type": { + "$ref": "441" + }, + "value": "A" + } + } + } + } + } + }, + { + "parameter": { + "$ref": "2244" + }, + "value": { + "$id": "2261", + "kind": "string", + "type": { + "$ref": "2245" + }, + "value": "hsm-group" + } + }, + { + "parameter": { + "$ref": "2241" + }, + "value": { + "$id": "2262", + "kind": "string", + "type": { + "$ref": "2242" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + ], + "responses": [ + { + "response": { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "597" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + "statusCode": 200, + "bodyValue": { + "$id": "2263", + "kind": "model", + "type": { + "$ref": "597" + }, + "value": { + "name": { + "$id": "2264", + "kind": "string", + "type": { + "$ref": "688" + }, + "value": "hsm1" + }, + "type": { + "$id": "2265", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/managedHSMs" + }, + "id": { + "$id": "2266", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.KeyVault/managedHSMs/hsm1" + }, + "location": { + "$id": "2267", + "kind": "string", + "type": { + "$ref": "685" + }, + "value": "westus" + }, + "properties": { + "$id": "2268", + "kind": "model", + "type": { + "$ref": "607" + }, + "value": { + "enablePurgeProtection": { + "$id": "2269", + "kind": "boolean", + "type": { + "$ref": "619" + }, + "value": false + }, + "enableSoftDelete": { + "$id": "2270", + "kind": "boolean", + "type": { + "$ref": "615" + }, + "value": true + }, + "hsmUri": { + "$id": "2271", + "kind": "string", + "type": { + "$ref": "613" + }, + "value": "https://westus.hsm1.managedhsm.azure.net" + }, + "initialAdminObjectIds": { + "$id": "2272", + "kind": "array", + "type": { + "$ref": "547" + }, + "value": [ + { + "$id": "2273", + "kind": "string", + "type": { + "$ref": "548" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + ] + }, + "provisioningState": { + "$id": "2274", + "kind": "string", + "type": { + "$ref": "130" + }, + "value": "Succeeded" + }, + "softDeleteRetentionInDays": { + "$id": "2275", + "kind": "number", + "type": { + "$ref": "617" + }, + "value": 90 + }, + "statusMessage": { + "$id": "2276", + "kind": "string", + "type": { + "$ref": "622" + }, + "value": "ManagedHsm is functional." + }, + "tenantId": { + "$id": "2277", + "kind": "string", + "type": { + "$ref": "609" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + }, + "sku": { + "$id": "2278", + "kind": "model", + "type": { + "$ref": "690" + }, + "value": { + "name": { + "$id": "2279", + "kind": "string", + "type": { + "$ref": "187" + }, + "value": "Standard_B1" + }, + "family": { + "$id": "2280", + "kind": "string", + "type": { + "$ref": "183" + }, + "value": "B" + } + } + }, + "tags": { + "$id": "2281", + "kind": "dict", + "type": { + "$ref": "439" + }, + "value": { + "Dept": { + "$id": "2282", + "kind": "string", + "type": { + "$ref": "441" + }, + "value": "hsm" + }, + "Environment": { + "$id": "2283", + "kind": "string", + "type": { + "$ref": "441" + }, + "value": "dogfood" + }, + "Slice": { + "$id": "2284", + "kind": "string", + "type": { + "$ref": "441" + }, + "value": "A" + } + } + } + } + } + }, + { + "response": { + "statusCodes": [ + 202 + ], + "bodyType": { + "$ref": "597" + }, + "headers": [ + { + "name": "location", + "nameInResponse": "Location", + "doc": "The Location header contains the URL where the status of the long running operation can be checked.", + "type": { + "$ref": "2251" + } + }, + { + "name": "retryAfter", + "nameInResponse": "Retry-After", + "doc": "The Retry-After header can indicate how long the client should wait before polling the operation status.", + "type": { + "$ref": "2252" + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + "statusCode": 202, + "bodyValue": { + "$id": "2285", + "kind": "model", + "type": { + "$ref": "597" + }, + "value": { + "name": { + "$id": "2286", + "kind": "string", + "type": { + "$ref": "688" + }, + "value": "hsm1" + }, + "type": { + "$id": "2287", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/managedHSMs" + }, + "id": { + "$id": "2288", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.KeyVault/managedHSMs/hsm1" + }, + "location": { + "$id": "2289", + "kind": "string", + "type": { + "$ref": "685" + }, + "value": "westus" + }, + "properties": { + "$id": "2290", + "kind": "model", + "type": { + "$ref": "607" + }, + "value": { + "enablePurgeProtection": { + "$id": "2291", + "kind": "boolean", + "type": { + "$ref": "619" + }, + "value": false + }, + "enableSoftDelete": { + "$id": "2292", + "kind": "boolean", + "type": { + "$ref": "615" + }, + "value": true + }, + "hsmUri": { + "$id": "2293", + "kind": "string", + "type": { + "$ref": "613" + }, + "value": "https://westus.hsm1.managedhsm.azure.net" + }, + "initialAdminObjectIds": { + "$id": "2294", + "kind": "array", + "type": { + "$ref": "547" + }, + "value": [ + { + "$id": "2295", + "kind": "string", + "type": { + "$ref": "548" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + ] + }, + "provisioningState": { + "$id": "2296", + "kind": "string", + "type": { + "$ref": "130" + }, + "value": "Updating" + }, + "softDeleteRetentionInDays": { + "$id": "2297", + "kind": "number", + "type": { + "$ref": "617" + }, + "value": 90 + }, + "statusMessage": { + "$id": "2298", + "kind": "string", + "type": { + "$ref": "622" + }, + "value": "ManagedHsm is updating." + }, + "tenantId": { + "$id": "2299", + "kind": "string", + "type": { + "$ref": "609" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + }, + "sku": { + "$id": "2300", + "kind": "model", + "type": { + "$ref": "690" + }, + "value": { + "name": { + "$id": "2301", + "kind": "string", + "type": { + "$ref": "187" + }, + "value": "Standard_B1" + }, + "family": { + "$id": "2302", + "kind": "string", + "type": { + "$ref": "183" + }, + "value": "B" + } + } + }, + "tags": { + "$id": "2303", + "kind": "dict", + "type": { + "$ref": "439" + }, + "value": { + "Dept": { + "$id": "2304", + "kind": "string", + "type": { + "$ref": "441" + }, + "value": "hsm" + }, + "Environment": { + "$id": "2305", + "kind": "string", + "type": { + "$ref": "441" + }, + "value": "dogfood" + }, + "Slice": { + "$id": "2306", + "kind": "string", + "type": { + "$ref": "441" + }, + "value": "A" + } + } + } + } + } + } + ] + } + ] + }, + "parameters": [ + { + "$id": "2307", + "kind": "method", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2308", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.update.resourceGroupName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2309", + "kind": "method", + "name": "name", + "serializedName": "name", + "doc": "The name of the managed HSM Pool.", + "type": { + "$id": "2310", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.update.name", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2311", + "kind": "method", + "name": "parameters", + "serializedName": "parameters", + "doc": "Parameters to patch the managed HSM Pool", + "type": { + "$ref": "597" + }, + "location": "Body", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.update.properties", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2312", + "kind": "method", + "name": "contentType", + "serializedName": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$ref": "268" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.update.contentType", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2313", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "270" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.update.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$ref": "597" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.update", + "lroMetadata": { + "finalStateVia": 1, + "finalResponse": { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "597" + } + } + } + }, + { + "$id": "2314", + "kind": "lro", + "name": "delete", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "Deletes the specified managed HSM Pool.", + "operation": { + "$id": "2315", + "name": "delete", + "resourceName": "ManagedHsm", + "doc": "Deletes the specified managed HSM Pool.", + "accessibility": "public", + "parameters": [ + { + "$id": "2316", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "2317", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "2318", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.delete.apiVersion", + "readOnly": false + }, + { + "$id": "2319", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "2320", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "2321", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.delete.subscriptionId" + }, + { + "$id": "2322", + "kind": "path", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2323", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.delete.resourceGroupName" + }, + { + "$id": "2324", + "kind": "path", + "name": "name", + "serializedName": "name", + "doc": "The name of the managed HSM Pool.", + "type": { + "$id": "2325", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.delete.name" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "headers": [], + "isErrorResponse": false + }, + { + "statusCodes": [ + 202 + ], + "headers": [ + { + "name": "location", + "nameInResponse": "Location", + "doc": "The Location header contains the URL where the status of the long running operation can be checked.", + "type": { + "$id": "2326", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "name": "retryAfter", + "nameInResponse": "Retry-After", + "doc": "The Retry-After header can indicate how long the client should wait before polling the operation status.", + "type": { + "$id": "2327", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + } + } + ], + "isErrorResponse": false + }, + { + "statusCodes": [ + 204 + ], + "headers": [], + "isErrorResponse": false + } + ], + "httpMethod": "DELETE", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.delete", + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceDelete", + "arguments": {} + } + ], + "examples": [ + { + "$id": "2328", + "kind": "http", + "name": "Delete a managed HSM Pool", + "description": "Delete a managed HSM Pool", + "filePath": "2025-05-01/ManagedHsm_Delete.json", + "parameters": [ + { + "parameter": { + "$ref": "2324" + }, + "value": { + "$id": "2329", + "kind": "string", + "type": { + "$ref": "2325" + }, + "value": "hsm1" + } + }, + { + "parameter": { + "$ref": "2316" + }, + "value": { + "$id": "2330", + "kind": "string", + "type": { + "$ref": "2317" + }, + "value": "2025-05-01" + } + }, + { + "parameter": { + "$ref": "2322" + }, + "value": { + "$id": "2331", + "kind": "string", + "type": { + "$ref": "2323" + }, + "value": "hsm-group" + } + }, + { + "parameter": { + "$ref": "2319" + }, + "value": { + "$id": "2332", + "kind": "string", + "type": { + "$ref": "2320" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + ], + "responses": [ + { + "response": { + "statusCodes": [ + 200 + ], + "headers": [], + "isErrorResponse": false + }, + "statusCode": 200 + }, + { + "response": { + "statusCodes": [ + 202 + ], + "headers": [ + { + "name": "location", + "nameInResponse": "Location", + "doc": "The Location header contains the URL where the status of the long running operation can be checked.", + "type": { + "$ref": "2326" + } + }, + { + "name": "retryAfter", + "nameInResponse": "Retry-After", + "doc": "The Retry-After header can indicate how long the client should wait before polling the operation status.", + "type": { + "$ref": "2327" + } + } + ], + "isErrorResponse": false + }, + "statusCode": 202 + }, + { + "response": { + "statusCodes": [ + 204 + ], + "headers": [], + "isErrorResponse": false + }, + "statusCode": 204 + } + ] + } + ] + }, + "parameters": [ + { + "$id": "2333", + "kind": "method", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2334", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.delete.resourceGroupName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2335", + "kind": "method", + "name": "name", + "serializedName": "name", + "doc": "The name of the managed HSM Pool.", + "type": { + "$id": "2336", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.delete.name", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": {}, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.delete", + "lroMetadata": { + "finalStateVia": 1, + "finalResponse": { + "statusCodes": [ + 204 + ] + } + } + }, + { + "$id": "2337", + "kind": "paging", + "name": "listByResourceGroup", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "The List operation gets information about the managed HSM Pools associated with the subscription and within the specified resource group.", + "operation": { + "$id": "2338", + "name": "listByResourceGroup", + "resourceName": "ManagedHsm", + "doc": "The List operation gets information about the managed HSM Pools associated with the subscription and within the specified resource group.", + "accessibility": "public", + "parameters": [ + { + "$id": "2339", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "2340", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "2341", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listByResourceGroup.apiVersion", + "readOnly": false + }, + { + "$id": "2342", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "2343", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "2344", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listByResourceGroup.subscriptionId" + }, + { + "$id": "2345", + "kind": "path", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2346", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listByResourceGroup.resourceGroupName" + }, + { + "$id": "2347", + "kind": "query", + "name": "$top", + "serializedName": "$top", + "doc": "Maximum number of results to return.", + "type": { + "$id": "2348", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "optional": true, + "scope": "Method", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listByResourceGroup.$top", + "readOnly": false + }, + { + "$id": "2349", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "272" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listByResourceGroup.accept" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "721" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listByResourceGroup", + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceList", + "arguments": {} + } + ], + "examples": [ + { + "$id": "2350", + "kind": "http", + "name": "List managed HSM Pools in a resource group", + "description": "List managed HSM Pools in a resource group", + "filePath": "2025-05-01/ManagedHsm_ListByResourceGroup.json", + "parameters": [ + { + "parameter": { + "$ref": "2339" + }, + "value": { + "$id": "2351", + "kind": "string", + "type": { + "$ref": "2340" + }, + "value": "2025-05-01" + } + }, + { + "parameter": { + "$ref": "2345" + }, + "value": { + "$id": "2352", + "kind": "string", + "type": { + "$ref": "2346" + }, + "value": "hsm-group" + } + }, + { + "parameter": { + "$ref": "2342" + }, + "value": { + "$id": "2353", + "kind": "string", + "type": { + "$ref": "2343" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + ], + "responses": [ + { + "response": { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "721" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + "statusCode": 200, + "bodyValue": { + "$id": "2354", + "kind": "model", + "type": { + "$ref": "721" + }, + "value": { + "nextLink": { + "$id": "2355", + "kind": "string", + "type": { + "$ref": "725" + }, + "value": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.KeyVault/managedHSMs?api-version=2025-05-01&$skiptoken=dmF1bHQtcGVza3ktanVyeS03MzA3Ng==" + }, + "value": { + "$id": "2356", + "kind": "array", + "type": { + "$ref": "723" + }, + "value": [ + { + "$id": "2357", + "kind": "model", + "type": { + "$ref": "597" + }, + "value": { + "name": { + "$id": "2358", + "kind": "string", + "type": { + "$ref": "688" + }, + "value": "hsm1" + }, + "type": { + "$id": "2359", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/managedHSMs" + }, + "id": { + "$id": "2360", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.KeyVault/managedHSMs/hsm1" + }, + "location": { + "$id": "2361", + "kind": "string", + "type": { + "$ref": "685" + }, + "value": "westus" + }, + "properties": { + "$id": "2362", + "kind": "model", + "type": { + "$ref": "607" + }, + "value": { + "enablePurgeProtection": { + "$id": "2363", + "kind": "boolean", + "type": { + "$ref": "619" + }, + "value": false + }, + "enableSoftDelete": { + "$id": "2364", + "kind": "boolean", + "type": { + "$ref": "615" + }, + "value": true + }, + "hsmUri": { + "$id": "2365", + "kind": "string", + "type": { + "$ref": "613" + }, + "value": "https://westus.hsm1.managedhsm.azure.net" + }, + "initialAdminObjectIds": { + "$id": "2366", + "kind": "array", + "type": { + "$ref": "547" + }, + "value": [ + { + "$id": "2367", + "kind": "string", + "type": { + "$ref": "548" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + ] + }, + "provisioningState": { + "$id": "2368", + "kind": "string", + "type": { + "$ref": "130" + }, + "value": "Succeeded" + }, + "softDeleteRetentionInDays": { + "$id": "2369", + "kind": "number", + "type": { + "$ref": "617" + }, + "value": 90 + }, + "statusMessage": { + "$id": "2370", + "kind": "string", + "type": { + "$ref": "622" + }, + "value": "ManagedHsm is functional." + }, + "tenantId": { + "$id": "2371", + "kind": "string", + "type": { + "$ref": "609" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + }, + "sku": { + "$id": "2372", + "kind": "model", + "type": { + "$ref": "690" + }, + "value": { + "name": { + "$id": "2373", + "kind": "string", + "type": { + "$ref": "187" + }, + "value": "Standard_B1" + }, + "family": { + "$id": "2374", + "kind": "string", + "type": { + "$ref": "183" + }, + "value": "B" + } + } + }, + "tags": { + "$id": "2375", + "kind": "dict", + "type": { + "$ref": "439" + }, + "value": { + "Dept": { + "$id": "2376", + "kind": "string", + "type": { + "$ref": "441" + }, + "value": "hsm" + }, + "Environment": { + "$id": "2377", + "kind": "string", + "type": { + "$ref": "441" + }, + "value": "dogfood" + } + } + } + } + }, + { + "$id": "2378", + "kind": "model", + "type": { + "$ref": "597" + }, + "value": { + "name": { + "$id": "2379", + "kind": "string", + "type": { + "$ref": "688" + }, + "value": "hsm2" + }, + "type": { + "$id": "2380", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/managedHSMs" + }, + "id": { + "$id": "2381", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.KeyVault/managedHSMs/hsm2" + }, + "location": { + "$id": "2382", + "kind": "string", + "type": { + "$ref": "685" + }, + "value": "westus" + }, + "properties": { + "$id": "2383", + "kind": "model", + "type": { + "$ref": "607" + }, + "value": { + "enablePurgeProtection": { + "$id": "2384", + "kind": "boolean", + "type": { + "$ref": "619" + }, + "value": false + }, + "enableSoftDelete": { + "$id": "2385", + "kind": "boolean", + "type": { + "$ref": "615" + }, + "value": true + }, + "hsmUri": { + "$id": "2386", + "kind": "string", + "type": { + "$ref": "613" + }, + "value": "https://westus.hsm2.managedhsm.azure.net" + }, + "initialAdminObjectIds": { + "$id": "2387", + "kind": "array", + "type": { + "$ref": "547" + }, + "value": [ + { + "$id": "2388", + "kind": "string", + "type": { + "$ref": "548" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + ] + }, + "provisioningState": { + "$id": "2389", + "kind": "string", + "type": { + "$ref": "130" + }, + "value": "Succeeded" + }, + "softDeleteRetentionInDays": { + "$id": "2390", + "kind": "number", + "type": { + "$ref": "617" + }, + "value": 90 + }, + "statusMessage": { + "$id": "2391", + "kind": "string", + "type": { + "$ref": "622" + }, + "value": "ManagedHsm is functional." + }, + "tenantId": { + "$id": "2392", + "kind": "string", + "type": { + "$ref": "609" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + }, + "sku": { + "$id": "2393", + "kind": "model", + "type": { + "$ref": "690" + }, + "value": { + "name": { + "$id": "2394", + "kind": "string", + "type": { + "$ref": "187" + }, + "value": "Standard_B1" + }, + "family": { + "$id": "2395", + "kind": "string", + "type": { + "$ref": "183" + }, + "value": "B" + } + } + }, + "tags": { + "$id": "2396", + "kind": "dict", + "type": { + "$ref": "439" + }, + "value": { + "Dept": { + "$id": "2397", + "kind": "string", + "type": { + "$ref": "441" + }, + "value": "hsm" + }, + "Environment": { + "$id": "2398", + "kind": "string", + "type": { + "$ref": "441" + }, + "value": "production" + } + } + } + } + } + ] + } + } + } + } + ] + } + ] + }, + "parameters": [ + { + "$id": "2399", + "kind": "method", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2400", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listByResourceGroup.resourceGroupName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2401", + "kind": "method", + "name": "$top", + "serializedName": "$top", + "doc": "Maximum number of results to return.", + "type": { + "$id": "2402", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "optional": true, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listByResourceGroup.$top", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2403", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "272" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listByResourceGroup.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$ref": "723" + }, + "resultSegments": [ + "value" + ] + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listByResourceGroup", + "pagingMetadata": { + "itemPropertySegments": [ + "value" + ], + "nextLink": { + "responseSegments": [ + "nextLink" + ], + "responseLocation": "Body" + } + } + }, + { + "$id": "2404", + "kind": "paging", + "name": "listBySubscription", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "The List operation gets information about the managed HSM Pools associated with the subscription.", + "operation": { + "$id": "2405", + "name": "listBySubscription", + "resourceName": "ManagedHsm", + "doc": "The List operation gets information about the managed HSM Pools associated with the subscription.", + "accessibility": "public", + "parameters": [ + { + "$id": "2406", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "2407", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "2408", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listBySubscription.apiVersion", + "readOnly": false + }, + { + "$id": "2409", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "2410", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "2411", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listBySubscription.subscriptionId" + }, + { + "$id": "2412", + "kind": "query", + "name": "$top", + "serializedName": "$top", + "doc": "Maximum number of results to return.", + "type": { + "$id": "2413", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "optional": true, + "scope": "Method", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listBySubscription.$top", + "readOnly": false + }, + { + "$id": "2414", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "274" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listBySubscription.accept" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "721" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/managedHSMs", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listBySubscription", + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceList", + "arguments": {} + } + ], + "examples": [ + { + "$id": "2415", + "kind": "http", + "name": "List managed HSM Pools in a subscription", + "description": "List managed HSM Pools in a subscription", + "filePath": "2025-05-01/ManagedHsm_ListBySubscription.json", + "parameters": [ + { + "parameter": { + "$ref": "2406" + }, + "value": { + "$id": "2416", + "kind": "string", + "type": { + "$ref": "2407" + }, + "value": "2025-05-01" + } + }, + { + "parameter": { + "$ref": "2409" + }, + "value": { + "$id": "2417", + "kind": "string", + "type": { + "$ref": "2410" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + ], + "responses": [ + { + "response": { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "721" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + "statusCode": 200, + "bodyValue": { + "$id": "2418", + "kind": "model", + "type": { + "$ref": "721" + }, + "value": { + "nextLink": { + "$id": "2419", + "kind": "string", + "type": { + "$ref": "725" + }, + "value": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/managedHSMs?api-version=2025-05-01&$skiptoken=dmF1bHQtcGVza3ktanVyeS03MzA3Ng==" + }, + "value": { + "$id": "2420", + "kind": "array", + "type": { + "$ref": "723" + }, + "value": [ + { + "$id": "2421", + "kind": "model", + "type": { + "$ref": "597" + }, + "value": { + "name": { + "$id": "2422", + "kind": "string", + "type": { + "$ref": "688" + }, + "value": "hsm1" + }, + "type": { + "$id": "2423", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/managedHSMs" + }, + "id": { + "$id": "2424", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.KeyVault/managedHSMs/hsm1" + }, + "location": { + "$id": "2425", + "kind": "string", + "type": { + "$ref": "685" + }, + "value": "westus" + }, + "properties": { + "$id": "2426", + "kind": "model", + "type": { + "$ref": "607" + }, + "value": { + "enablePurgeProtection": { + "$id": "2427", + "kind": "boolean", + "type": { + "$ref": "619" + }, + "value": false + }, + "enableSoftDelete": { + "$id": "2428", + "kind": "boolean", + "type": { + "$ref": "615" + }, + "value": true + }, + "hsmUri": { + "$id": "2429", + "kind": "string", + "type": { + "$ref": "613" + }, + "value": "https://westus.hsm1.managedhsm.azure.net" + }, + "initialAdminObjectIds": { + "$id": "2430", + "kind": "array", + "type": { + "$ref": "547" + }, + "value": [ + { + "$id": "2431", + "kind": "string", + "type": { + "$ref": "548" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + ] + }, + "provisioningState": { + "$id": "2432", + "kind": "string", + "type": { + "$ref": "130" + }, + "value": "Succeeded" + }, + "softDeleteRetentionInDays": { + "$id": "2433", + "kind": "number", + "type": { + "$ref": "617" + }, + "value": 90 + }, + "statusMessage": { + "$id": "2434", + "kind": "string", + "type": { + "$ref": "622" + }, + "value": "ManagedHsm is functional." + }, + "tenantId": { + "$id": "2435", + "kind": "string", + "type": { + "$ref": "609" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + }, + "sku": { + "$id": "2436", + "kind": "model", + "type": { + "$ref": "690" + }, + "value": { + "name": { + "$id": "2437", + "kind": "string", + "type": { + "$ref": "187" + }, + "value": "Standard_B1" + }, + "family": { + "$id": "2438", + "kind": "string", + "type": { + "$ref": "183" + }, + "value": "B" + } + } + }, + "tags": { + "$id": "2439", + "kind": "dict", + "type": { + "$ref": "439" + }, + "value": { + "Dept": { + "$id": "2440", + "kind": "string", + "type": { + "$ref": "441" + }, + "value": "hsm" + }, + "Environment": { + "$id": "2441", + "kind": "string", + "type": { + "$ref": "441" + }, + "value": "dogfood" + } + } + } + } + }, + { + "$id": "2442", + "kind": "model", + "type": { + "$ref": "597" + }, + "value": { + "name": { + "$id": "2443", + "kind": "string", + "type": { + "$ref": "688" + }, + "value": "hsm2" + }, + "type": { + "$id": "2444", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/managedHSMs" + }, + "id": { + "$id": "2445", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.KeyVault/managedHSMs/hsm2" + }, + "location": { + "$id": "2446", + "kind": "string", + "type": { + "$ref": "685" + }, + "value": "westus" + }, + "properties": { + "$id": "2447", + "kind": "model", + "type": { + "$ref": "607" + }, + "value": { + "enablePurgeProtection": { + "$id": "2448", + "kind": "boolean", + "type": { + "$ref": "619" + }, + "value": false + }, + "enableSoftDelete": { + "$id": "2449", + "kind": "boolean", + "type": { + "$ref": "615" + }, + "value": true + }, + "hsmUri": { + "$id": "2450", + "kind": "string", + "type": { + "$ref": "613" + }, + "value": "https://westus.hsm2.managedhsm.azure.net" + }, + "initialAdminObjectIds": { + "$id": "2451", + "kind": "array", + "type": { + "$ref": "547" + }, + "value": [ + { + "$id": "2452", + "kind": "string", + "type": { + "$ref": "548" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + ] + }, + "provisioningState": { + "$id": "2453", + "kind": "string", + "type": { + "$ref": "130" + }, + "value": "Succeeded" + }, + "softDeleteRetentionInDays": { + "$id": "2454", + "kind": "number", + "type": { + "$ref": "617" + }, + "value": 90 + }, + "statusMessage": { + "$id": "2455", + "kind": "string", + "type": { + "$ref": "622" + }, + "value": "ManagedHsm is functional." + }, + "tenantId": { + "$id": "2456", + "kind": "string", + "type": { + "$ref": "609" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + }, + "sku": { + "$id": "2457", + "kind": "model", + "type": { + "$ref": "690" + }, + "value": { + "name": { + "$id": "2458", + "kind": "string", + "type": { + "$ref": "187" + }, + "value": "Standard_B1" + }, + "family": { + "$id": "2459", + "kind": "string", + "type": { + "$ref": "183" + }, + "value": "B" + } + } + }, + "tags": { + "$id": "2460", + "kind": "dict", + "type": { + "$ref": "439" + }, + "value": { + "Dept": { + "$id": "2461", + "kind": "string", + "type": { + "$ref": "441" + }, + "value": "hsm" + }, + "Environment": { + "$id": "2462", + "kind": "string", + "type": { + "$ref": "441" + }, + "value": "production" + } + } + } + } + } + ] + } + } + } + } + ] + } + ] + }, + "parameters": [ + { + "$id": "2463", + "kind": "method", + "name": "$top", + "serializedName": "$top", + "doc": "Maximum number of results to return.", + "type": { + "$id": "2464", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "optional": true, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listBySubscription.$top", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2465", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "274" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listBySubscription.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$ref": "723" + }, + "resultSegments": [ + "value" + ] + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listBySubscription", + "pagingMetadata": { + "itemPropertySegments": [ + "value" + ], + "nextLink": { + "responseSegments": [ + "nextLink" + ], + "responseLocation": "Body" + } + } + }, + { + "$id": "2466", + "kind": "basic", + "name": "GetPrivateLinkResources", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "Gets the private link resources supported for the managed hsm pool.", + "operation": { + "$id": "2467", + "name": "GetPrivateLinkResources", + "resourceName": "ManagedHsms", + "doc": "Gets the private link resources supported for the managed hsm pool.", + "accessibility": "public", + "parameters": [ + { + "$id": "2468", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "2469", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "2470", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listByMHSMResource.apiVersion", + "readOnly": false + }, + { + "$id": "2471", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "2472", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "2473", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listByMHSMResource.subscriptionId" + }, + { + "$id": "2474", + "kind": "path", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2475", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listByMHSMResource.resourceGroupName" + }, + { + "$id": "2476", + "kind": "path", + "name": "name", + "serializedName": "name", + "doc": "The name of the managed HSM Pool.", + "type": { + "$id": "2477", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listByMHSMResource.name" + }, + { + "$id": "2478", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "276" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listByMHSMResource.accept" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "727" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateLinkResources", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listByMHSMResource", + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceAction", + "arguments": {} + } + ] + }, + "parameters": [ + { + "$id": "2479", + "kind": "method", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2480", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listByMHSMResource.resourceGroupName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2481", + "kind": "method", + "name": "name", + "serializedName": "name", + "doc": "The name of the managed HSM Pool.", + "type": { + "$id": "2482", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listByMHSMResource.name", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2483", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "276" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listByMHSMResource.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$ref": "727" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listByMHSMResource" + }, + { + "$id": "2484", + "kind": "paging", + "name": "GetRegions", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "The List operation gets information about the regions associated with the managed HSM Pool.", + "operation": { + "$id": "2485", + "name": "GetRegions", + "resourceName": "ManagedHsms", + "doc": "The List operation gets information about the regions associated with the managed HSM Pool.", + "accessibility": "public", + "parameters": [ + { + "$id": "2486", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "2487", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "2488", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listByResource.apiVersion", + "readOnly": false + }, + { + "$id": "2489", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "2490", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "2491", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listByResource.subscriptionId" + }, + { + "$id": "2492", + "kind": "path", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2493", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listByResource.resourceGroupName" + }, + { + "$id": "2494", + "kind": "path", + "name": "name", + "serializedName": "name", + "doc": "The name of the managed HSM Pool.", + "type": { + "$id": "2495", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listByResource.name" + }, + { + "$id": "2496", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "278" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listByResource.accept" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "745" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/regions", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listByResource", + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceAction", + "arguments": {} + } + ] + }, + "parameters": [ + { + "$id": "2497", + "kind": "method", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2498", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listByResource.resourceGroupName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2499", + "kind": "method", + "name": "name", + "serializedName": "name", + "doc": "The name of the managed HSM Pool.", + "type": { + "$id": "2500", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listByResource.name", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2501", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "278" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listByResource.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$ref": "645" + }, + "resultSegments": [ + "value" + ] + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms.listByResource", + "pagingMetadata": { + "itemPropertySegments": [ + "value" + ], + "nextLink": { + "responseSegments": [ + "nextLink" + ], + "responseLocation": "Body" + } + } + } + ], + "parameters": [ + { + "$id": "2502", + "kind": "endpoint", + "name": "endpoint", + "serializedName": "endpoint", + "doc": "Service host", + "type": { + "$id": "2503", + "kind": "url", + "name": "endpoint", + "crossLanguageDefinitionId": "TypeSpec.url" + }, + "isApiVersion": false, + "optional": false, + "scope": "Client", + "isEndpoint": true, + "defaultValue": { + "type": { + "$id": "2504", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "https://management.azure.com" + }, + "serverUrlTemplate": "{endpoint}", + "skipUrlEncoding": false, + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.endpoint" + } + ], + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceOperations", + "arguments": {} + } + ], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsms", + "apiVersions": [ + "2025-05-01" + ], + "parent": { + "$ref": "884" + } + }, + { + "$id": "2505", + "kind": "client", + "name": "DeletedManagedHsms", + "namespace": "Azure.ResourceManager.KeyVault", + "methods": [ + { + "$id": "2506", + "kind": "basic", + "name": "getDeleted", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "Gets the specified deleted managed HSM.", + "operation": { + "$id": "2507", + "name": "getDeleted", + "resourceName": "DeletedManagedHsm", + "doc": "Gets the specified deleted managed HSM.", + "accessibility": "public", + "parameters": [ + { + "$id": "2508", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "2509", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "2510", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedManagedHsms.getDeleted.apiVersion", + "readOnly": false + }, + { + "$id": "2511", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "2512", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "2513", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedManagedHsms.getDeleted.subscriptionId" + }, + { + "$id": "2514", + "kind": "path", + "name": "location", + "serializedName": "location", + "doc": "The name of the Azure region.", + "type": { + "$id": "2515", + "kind": "string", + "name": "azureLocation", + "crossLanguageDefinitionId": "Azure.Core.azureLocation", + "baseType": { + "$id": "2516", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedManagedHsms.getDeleted.location" + }, + { + "$id": "2517", + "kind": "path", + "name": "name", + "serializedName": "name", + "doc": "The name of the deleted managed HSM.", + "type": { + "$id": "2518", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedManagedHsms.getDeleted.name" + }, + { + "$id": "2519", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "280" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedManagedHsms.getDeleted.accept" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "750" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedManagedHsms.getDeleted", + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceRead", + "arguments": {} + } + ] + }, + "parameters": [ + { + "$id": "2520", + "kind": "method", + "name": "location", + "serializedName": "location", + "doc": "The name of the Azure region.", + "type": { + "$id": "2521", + "kind": "string", + "name": "azureLocation", + "crossLanguageDefinitionId": "Azure.Core.azureLocation", + "baseType": { + "$id": "2522", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedManagedHsms.getDeleted.location", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2523", + "kind": "method", + "name": "name", + "serializedName": "name", + "doc": "The name of the deleted managed HSM.", + "type": { + "$id": "2524", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedManagedHsms.getDeleted.name", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2525", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "280" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedManagedHsms.getDeleted.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$ref": "750" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedManagedHsms.getDeleted" + }, + { + "$id": "2526", + "kind": "lro", + "name": "purgeDeleted", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "Permanently deletes the specified managed HSM.", + "operation": { + "$id": "2527", + "name": "purgeDeleted", + "resourceName": "DeletedManagedHsms", + "doc": "Permanently deletes the specified managed HSM.", + "accessibility": "public", + "parameters": [ + { + "$id": "2528", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "2529", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "2530", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedManagedHsms.purgeDeleted.apiVersion", + "readOnly": false + }, + { + "$id": "2531", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "2532", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "2533", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedManagedHsms.purgeDeleted.subscriptionId" + }, + { + "$id": "2534", + "kind": "path", + "name": "location", + "serializedName": "location", + "doc": "The name of the Azure region.", + "type": { + "$id": "2535", + "kind": "string", + "name": "azureLocation", + "crossLanguageDefinitionId": "Azure.Core.azureLocation", + "baseType": { + "$id": "2536", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedManagedHsms.purgeDeleted.location" + }, + { + "$id": "2537", + "kind": "path", + "name": "name", + "serializedName": "name", + "doc": "The name of the deleted managed HSM.", + "type": { + "$id": "2538", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedManagedHsms.purgeDeleted.name" + } + ], + "responses": [ + { + "statusCodes": [ + 202 + ], + "headers": [ + { + "name": "location", + "nameInResponse": "Location", + "doc": "The Location header contains the URL where the status of the long running operation can be checked.", + "type": { + "$id": "2539", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "name": "retryAfter", + "nameInResponse": "Retry-After", + "doc": "The Retry-After header can indicate how long the client should wait before polling the operation status.", + "type": { + "$id": "2540", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + } + } + ], + "isErrorResponse": false + } + ], + "httpMethod": "POST", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}/purge", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedManagedHsms.purgeDeleted", + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceAction", + "arguments": {} + } + ] + }, + "parameters": [ + { + "$id": "2541", + "kind": "method", + "name": "location", + "serializedName": "location", + "doc": "The name of the Azure region.", + "type": { + "$id": "2542", + "kind": "string", + "name": "azureLocation", + "crossLanguageDefinitionId": "Azure.Core.azureLocation", + "baseType": { + "$id": "2543", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedManagedHsms.purgeDeleted.location", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2544", + "kind": "method", + "name": "name", + "serializedName": "name", + "doc": "The name of the deleted managed HSM.", + "type": { + "$id": "2545", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedManagedHsms.purgeDeleted.name", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": {}, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedManagedHsms.purgeDeleted", + "lroMetadata": { + "finalStateVia": 1, + "finalResponse": { + "statusCodes": [ + 200 + ] + } + } + } + ], + "parameters": [ + { + "$id": "2546", + "kind": "endpoint", + "name": "endpoint", + "serializedName": "endpoint", + "doc": "Service host", + "type": { + "$id": "2547", + "kind": "url", + "name": "endpoint", + "crossLanguageDefinitionId": "TypeSpec.url" + }, + "isApiVersion": false, + "optional": false, + "scope": "Client", + "isEndpoint": true, + "defaultValue": { + "type": { + "$id": "2548", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "https://management.azure.com" + }, + "serverUrlTemplate": "{endpoint}", + "skipUrlEncoding": false, + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.endpoint" + } + ], + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceOperations", + "arguments": {} + } + ], + "crossLanguageDefinitionId": "Microsoft.KeyVault.DeletedManagedHsms", + "apiVersions": [ + "2025-05-01" + ], + "parent": { + "$ref": "884" + } + }, + { + "$id": "2549", + "kind": "client", + "name": "MhsmPrivateEndpointConnections", + "namespace": "Azure.ResourceManager.KeyVault", + "methods": [ + { + "$id": "2550", + "kind": "basic", + "name": "get", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "Gets the specified private endpoint connection associated with the managed HSM Pool.", + "operation": { + "$id": "2551", + "name": "get", + "resourceName": "MhsmPrivateEndpointConnection", + "doc": "Gets the specified private endpoint connection associated with the managed HSM Pool.", + "accessibility": "public", + "parameters": [ + { + "$id": "2552", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "2553", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "2554", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.get.apiVersion", + "readOnly": false + }, + { + "$id": "2555", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "2556", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "2557", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.get.subscriptionId" + }, + { + "$id": "2558", + "kind": "path", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2559", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.get.resourceGroupName" + }, + { + "$id": "2560", + "kind": "path", + "name": "name", + "serializedName": "name", + "doc": "The name of the managed HSM Pool.", + "type": { + "$id": "2561", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.get.name" + }, + { + "$id": "2562", + "kind": "path", + "name": "privateEndpointConnectionName", + "serializedName": "privateEndpointConnectionName", + "doc": "Name of the private endpoint connection associated with the managed hsm pool.", + "type": { + "$id": "2563", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.get.privateEndpointConnectionName" + }, + { + "$id": "2564", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "282" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.get.accept" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "772" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.get", + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceRead", + "arguments": {} + } + ], + "examples": [ + { + "$id": "2565", + "kind": "http", + "name": "ManagedHsmGetPrivateEndpointConnection", + "description": "ManagedHsmGetPrivateEndpointConnection", + "filePath": "2025-05-01/ManagedHsm_getPrivateEndpointConnection.json", + "parameters": [ + { + "parameter": { + "$ref": "2560" + }, + "value": { + "$id": "2566", + "kind": "string", + "type": { + "$ref": "2561" + }, + "value": "sample-mhsm" + } + }, + { + "parameter": { + "$ref": "2552" + }, + "value": { + "$id": "2567", + "kind": "string", + "type": { + "$ref": "2553" + }, + "value": "2025-05-01" + } + }, + { + "parameter": { + "$ref": "2562" + }, + "value": { + "$id": "2568", + "kind": "string", + "type": { + "$ref": "2563" + }, + "value": "sample-pec" + } + }, + { + "parameter": { + "$ref": "2558" + }, + "value": { + "$id": "2569", + "kind": "string", + "type": { + "$ref": "2559" + }, + "value": "sample-group" + } + }, + { + "parameter": { + "$ref": "2555" + }, + "value": { + "$id": "2570", + "kind": "string", + "type": { + "$ref": "2556" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + ], + "responses": [ + { + "response": { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "772" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + "statusCode": 200, + "bodyValue": { + "$id": "2571", + "kind": "model", + "type": { + "$ref": "772" + }, + "value": { + "name": { + "$id": "2572", + "kind": "string", + "type": { + "$ref": "783" + }, + "value": "sample-pec" + }, + "type": { + "$id": "2573", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/managedhsms/privateEndpointConnections" + }, + "etag": { + "$id": "2574", + "kind": "string", + "type": { + "$ref": "787" + }, + "value": "" + }, + "id": { + "$id": "2575", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/managedhsms/sample-mhsm/privateEndpointConnections/sample-pec" + }, + "properties": { + "$id": "2576", + "kind": "model", + "type": { + "$ref": "662" + }, + "value": { + "privateEndpoint": { + "$id": "2577", + "kind": "model", + "type": { + "$ref": "664" + }, + "value": { + "id": { + "$id": "2578", + "kind": "string", + "type": { + "$ref": "666" + }, + "value": "/subscriptions/00000000-0000-0000-1234-000000000000/resourceGroups/sample-group/providers/Microsoft.Network/privateEndpoints/sample-pe" + } + } + }, + "privateLinkServiceConnectionState": { + "$id": "2579", + "kind": "model", + "type": { + "$ref": "668" + }, + "value": { + "description": { + "$id": "2580", + "kind": "string", + "type": { + "$ref": "671" + }, + "value": "This was automatically approved by user1234@contoso.com" + }, + "actionsRequired": { + "$id": "2581", + "kind": "string", + "type": { + "$ref": "162" + }, + "value": "None" + }, + "status": { + "$id": "2582", + "kind": "string", + "type": { + "$ref": "156" + }, + "value": "Approved" + } + } + }, + "provisioningState": { + "$id": "2583", + "kind": "string", + "type": { + "$ref": "165" + }, + "value": "Succeeded" + } + } + } + } + } + } + ] + } + ] + }, + "parameters": [ + { + "$id": "2584", + "kind": "method", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2585", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.get.resourceGroupName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2586", + "kind": "method", + "name": "name", + "serializedName": "name", + "doc": "The name of the managed HSM Pool.", + "type": { + "$id": "2587", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.get.name", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2588", + "kind": "method", + "name": "privateEndpointConnectionName", + "serializedName": "privateEndpointConnectionName", + "doc": "Name of the private endpoint connection associated with the managed hsm pool.", + "type": { + "$id": "2589", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.get.privateEndpointConnectionName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2590", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "282" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.get.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$ref": "772" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.get" + }, + { + "$id": "2591", + "kind": "basic", + "name": "put", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "Updates the specified private endpoint connection associated with the managed hsm pool.", + "operation": { + "$id": "2592", + "name": "put", + "resourceName": "MhsmPrivateEndpointConnection", + "doc": "Updates the specified private endpoint connection associated with the managed hsm pool.", + "accessibility": "public", + "parameters": [ + { + "$id": "2593", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "2594", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "2595", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.put.apiVersion", + "readOnly": false + }, + { + "$id": "2596", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "2597", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "2598", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.put.subscriptionId" + }, + { + "$id": "2599", + "kind": "path", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2600", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.put.resourceGroupName" + }, + { + "$id": "2601", + "kind": "path", + "name": "name", + "serializedName": "name", + "doc": "The name of the managed HSM Pool.", + "type": { + "$id": "2602", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.put.name" + }, + { + "$id": "2603", + "kind": "path", + "name": "privateEndpointConnectionName", + "serializedName": "privateEndpointConnectionName", + "doc": "Name of the private endpoint connection associated with the managed hsm pool.", + "type": { + "$id": "2604", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.put.privateEndpointConnectionName" + }, + { + "$id": "2605", + "kind": "header", + "name": "contentType", + "serializedName": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$ref": "284" + }, + "isApiVersion": false, + "optional": false, + "isContentType": true, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.put.contentType" + }, + { + "$id": "2606", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "286" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.put.accept" + }, + { + "$id": "2607", + "kind": "body", + "name": "properties", + "serializedName": "properties", + "doc": "The intended state of private endpoint connection.", + "type": { + "$ref": "772" + }, + "isApiVersion": false, + "contentTypes": [ + "application/json" + ], + "defaultContentType": "application/json", + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.put.resource" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "772" + }, + "headers": [ + { + "name": "retryAfter", + "nameInResponse": "Retry-After", + "doc": "The Retry-After header can indicate how long the client should wait before polling the operation status.", + "type": { + "$id": "2608", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + } + }, + { + "name": "azureAsyncOperation", + "nameInResponse": "Azure-AsyncOperation", + "doc": "(specified only if operation does not finish synchronously) The URI to poll for completion status. The response of this URI may be synchronous or asynchronous.", + "type": { + "$id": "2609", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "PUT", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.put", + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceCreateOrUpdate", + "arguments": {} + } + ], + "examples": [ + { + "$id": "2610", + "kind": "http", + "name": "ManagedHsmPutPrivateEndpointConnection", + "description": "ManagedHsmPutPrivateEndpointConnection", + "filePath": "2025-05-01/ManagedHsm_putPrivateEndpointConnection.json", + "parameters": [ + { + "parameter": { + "$ref": "2601" + }, + "value": { + "$id": "2611", + "kind": "string", + "type": { + "$ref": "2602" + }, + "value": "sample-mhsm" + } + }, + { + "parameter": { + "$ref": "2593" + }, + "value": { + "$id": "2612", + "kind": "string", + "type": { + "$ref": "2594" + }, + "value": "2025-05-01" + } + }, + { + "parameter": { + "$ref": "2603" + }, + "value": { + "$id": "2613", + "kind": "string", + "type": { + "$ref": "2604" + }, + "value": "sample-pec" + } + }, + { + "parameter": { + "$ref": "2607" + }, + "value": { + "$id": "2614", + "kind": "model", + "type": { + "$ref": "772" + }, + "value": { + "properties": { + "$id": "2615", + "kind": "model", + "type": { + "$ref": "662" + }, + "value": { + "privateLinkServiceConnectionState": { + "$id": "2616", + "kind": "model", + "type": { + "$ref": "668" + }, + "value": { + "description": { + "$id": "2617", + "kind": "string", + "type": { + "$ref": "671" + }, + "value": "My name is Joe and I'm approving this." + }, + "status": { + "$id": "2618", + "kind": "string", + "type": { + "$ref": "156" + }, + "value": "Approved" + } + } + } + } + } + } + } + }, + { + "parameter": { + "$ref": "2599" + }, + "value": { + "$id": "2619", + "kind": "string", + "type": { + "$ref": "2600" + }, + "value": "sample-group" + } + }, + { + "parameter": { + "$ref": "2596" + }, + "value": { + "$id": "2620", + "kind": "string", + "type": { + "$ref": "2597" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + ], + "responses": [ + { + "response": { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "772" + }, + "headers": [ + { + "name": "retryAfter", + "nameInResponse": "Retry-After", + "doc": "The Retry-After header can indicate how long the client should wait before polling the operation status.", + "type": { + "$ref": "2608" + } + }, + { + "name": "azureAsyncOperation", + "nameInResponse": "Azure-AsyncOperation", + "doc": "(specified only if operation does not finish synchronously) The URI to poll for completion status. The response of this URI may be synchronous or asynchronous.", + "type": { + "$ref": "2609" + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + "statusCode": 200, + "bodyValue": { + "$id": "2621", + "kind": "model", + "type": { + "$ref": "772" + }, + "value": { + "name": { + "$id": "2622", + "kind": "string", + "type": { + "$ref": "783" + }, + "value": "sample-pec" + }, + "type": { + "$id": "2623", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/managedhsms/privateEndpointConnections" + }, + "id": { + "$id": "2624", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/managedhsms/sample-mhsm/privateEndpointConnections/sample-pec" + }, + "properties": { + "$id": "2625", + "kind": "model", + "type": { + "$ref": "662" + }, + "value": { + "privateEndpoint": { + "$id": "2626", + "kind": "model", + "type": { + "$ref": "664" + }, + "value": { + "id": { + "$id": "2627", + "kind": "string", + "type": { + "$ref": "666" + }, + "value": "/subscriptions/00000000-0000-0000-1234-000000000000/resourceGroups/sample-group/providers/Microsoft.Network/privateEndpoints/sample-pe" + } + } + }, + "privateLinkServiceConnectionState": { + "$id": "2628", + "kind": "model", + "type": { + "$ref": "668" + }, + "value": { + "description": { + "$id": "2629", + "kind": "string", + "type": { + "$ref": "671" + }, + "value": "My name is Joe and I'm approving this." + }, + "actionsRequired": { + "$id": "2630", + "kind": "string", + "type": { + "$ref": "162" + }, + "value": "None" + }, + "status": { + "$id": "2631", + "kind": "string", + "type": { + "$ref": "156" + }, + "value": "Approved" + } + } + }, + "provisioningState": { + "$id": "2632", + "kind": "string", + "type": { + "$ref": "165" + }, + "value": "Succeeded" + } + } + } + } + } + } + ] + } + ] + }, + "parameters": [ + { + "$id": "2633", + "kind": "method", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2634", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.put.resourceGroupName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2635", + "kind": "method", + "name": "name", + "serializedName": "name", + "doc": "The name of the managed HSM Pool.", + "type": { + "$id": "2636", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.put.name", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2637", + "kind": "method", + "name": "privateEndpointConnectionName", + "serializedName": "privateEndpointConnectionName", + "doc": "Name of the private endpoint connection associated with the managed hsm pool.", + "type": { + "$id": "2638", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.put.privateEndpointConnectionName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2639", + "kind": "method", + "name": "properties", + "serializedName": "properties", + "doc": "The intended state of private endpoint connection.", + "type": { + "$ref": "772" + }, + "location": "Body", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.put.resource", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2640", + "kind": "method", + "name": "contentType", + "serializedName": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$ref": "284" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.put.contentType", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2641", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "286" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.put.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$ref": "772" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.put" + }, + { + "$id": "2642", + "kind": "lro", + "name": "delete", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "Deletes the specified private endpoint connection associated with the managed hsm pool.", + "operation": { + "$id": "2643", + "name": "delete", + "resourceName": "MhsmPrivateEndpointConnection", + "doc": "Deletes the specified private endpoint connection associated with the managed hsm pool.", + "accessibility": "public", + "parameters": [ + { + "$id": "2644", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "2645", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "2646", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.delete.apiVersion", + "readOnly": false + }, + { + "$id": "2647", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "2648", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "2649", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.delete.subscriptionId" + }, + { + "$id": "2650", + "kind": "path", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2651", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.delete.resourceGroupName" + }, + { + "$id": "2652", + "kind": "path", + "name": "name", + "serializedName": "name", + "doc": "The name of the managed HSM Pool.", + "type": { + "$id": "2653", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.delete.name" + }, + { + "$id": "2654", + "kind": "path", + "name": "privateEndpointConnectionName", + "serializedName": "privateEndpointConnectionName", + "doc": "Name of the private endpoint connection associated with the managed hsm pool.", + "type": { + "$id": "2655", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.delete.privateEndpointConnectionName" + }, + { + "$id": "2656", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "288" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.delete.accept" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "772" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + { + "statusCodes": [ + 202 + ], + "headers": [ + { + "name": "location", + "nameInResponse": "Location", + "doc": "The Location header contains the URL where the status of the long running operation can be checked.", + "type": { + "$id": "2657", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + } + }, + { + "name": "retryAfter", + "nameInResponse": "Retry-After", + "doc": "The Retry-After header can indicate how long the client should wait before polling the operation status.", + "type": { + "$id": "2658", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + } + } + ], + "isErrorResponse": false + }, + { + "statusCodes": [ + 204 + ], + "headers": [], + "isErrorResponse": false + } + ], + "httpMethod": "DELETE", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.delete", + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceDelete", + "arguments": {} + } + ], + "examples": [ + { + "$id": "2659", + "kind": "http", + "name": "ManagedHsmDeletePrivateEndpointConnection", + "description": "ManagedHsmDeletePrivateEndpointConnection", + "filePath": "2025-05-01/ManagedHsm_deletePrivateEndpointConnection.json", + "parameters": [ + { + "parameter": { + "$ref": "2652" + }, + "value": { + "$id": "2660", + "kind": "string", + "type": { + "$ref": "2653" + }, + "value": "sample-mhsm" + } + }, + { + "parameter": { + "$ref": "2644" + }, + "value": { + "$id": "2661", + "kind": "string", + "type": { + "$ref": "2645" + }, + "value": "2025-05-01" + } + }, + { + "parameter": { + "$ref": "2654" + }, + "value": { + "$id": "2662", + "kind": "string", + "type": { + "$ref": "2655" + }, + "value": "sample-pec" + } + }, + { + "parameter": { + "$ref": "2650" + }, + "value": { + "$id": "2663", + "kind": "string", + "type": { + "$ref": "2651" + }, + "value": "sample-group" + } + }, + { + "parameter": { + "$ref": "2647" + }, + "value": { + "$id": "2664", + "kind": "string", + "type": { + "$ref": "2648" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + ], + "responses": [ + { + "response": { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "772" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + "statusCode": 200, + "bodyValue": { + "$id": "2665", + "kind": "model", + "type": { + "$ref": "772" + }, + "value": { + "name": { + "$id": "2666", + "kind": "string", + "type": { + "$ref": "783" + }, + "value": "sample-pec" + }, + "type": { + "$id": "2667", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/managedhsms/privateEndpointConnections" + }, + "id": { + "$id": "2668", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/managedhsms/sample-vault/privateEndpointConnections/sample-pec" + }, + "properties": { + "$id": "2669", + "kind": "model", + "type": { + "$ref": "662" + }, + "value": { + "provisioningState": { + "$id": "2670", + "kind": "string", + "type": { + "$ref": "165" + }, + "value": "Disconnected" + } + } + } + } + } + }, + { + "response": { + "statusCodes": [ + 202 + ], + "headers": [ + { + "name": "location", + "nameInResponse": "Location", + "doc": "The Location header contains the URL where the status of the long running operation can be checked.", + "type": { + "$ref": "2657" + } + }, + { + "name": "retryAfter", + "nameInResponse": "Retry-After", + "doc": "The Retry-After header can indicate how long the client should wait before polling the operation status.", + "type": { + "$ref": "2658" + } + } + ], + "isErrorResponse": false + }, + "statusCode": 202 + }, + { + "response": { + "statusCodes": [ + 204 + ], + "headers": [], + "isErrorResponse": false + }, + "statusCode": 204 + } + ] + } + ] + }, + "parameters": [ + { + "$id": "2671", + "kind": "method", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2672", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.delete.resourceGroupName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2673", + "kind": "method", + "name": "name", + "serializedName": "name", + "doc": "The name of the managed HSM Pool.", + "type": { + "$id": "2674", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.delete.name", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2675", + "kind": "method", + "name": "privateEndpointConnectionName", + "serializedName": "privateEndpointConnectionName", + "doc": "Name of the private endpoint connection associated with the managed hsm pool.", + "type": { + "$id": "2676", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.delete.privateEndpointConnectionName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2677", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "290" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.delete.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$ref": "772" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.delete", + "lroMetadata": { + "finalStateVia": 1, + "finalResponse": { + "statusCodes": [ + 204 + ], + "bodyType": { + "$ref": "772" + } + } + } + }, + { + "$id": "2678", + "kind": "paging", + "name": "listByResource", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "The List operation gets information about the private endpoint connections associated with the managed HSM Pool.", + "operation": { + "$id": "2679", + "name": "listByResource", + "resourceName": "MhsmPrivateEndpointConnection", + "doc": "The List operation gets information about the private endpoint connections associated with the managed HSM Pool.", + "accessibility": "public", + "parameters": [ + { + "$id": "2680", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "2681", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "2682", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.listByResource.apiVersion", + "readOnly": false + }, + { + "$id": "2683", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "2684", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "2685", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.listByResource.subscriptionId" + }, + { + "$id": "2686", + "kind": "path", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2687", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.listByResource.resourceGroupName" + }, + { + "$id": "2688", + "kind": "path", + "name": "name", + "serializedName": "name", + "doc": "The name of the managed HSM Pool.", + "type": { + "$id": "2689", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.listByResource.name" + }, + { + "$id": "2690", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "292" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.listByResource.accept" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "789" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.listByResource", + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceList", + "arguments": {} + } + ], + "examples": [ + { + "$id": "2691", + "kind": "http", + "name": "List managed HSM Pools in a subscription", + "description": "List managed HSM Pools in a subscription", + "filePath": "2025-05-01/ManagedHsm_ListPrivateEndpointConnectionsByResource.json", + "parameters": [ + { + "parameter": { + "$ref": "2688" + }, + "value": { + "$id": "2692", + "kind": "string", + "type": { + "$ref": "2689" + }, + "value": "sample-mhsm" + } + }, + { + "parameter": { + "$ref": "2680" + }, + "value": { + "$id": "2693", + "kind": "string", + "type": { + "$ref": "2681" + }, + "value": "2025-05-01" + } + }, + { + "parameter": { + "$ref": "2686" + }, + "value": { + "$id": "2694", + "kind": "string", + "type": { + "$ref": "2687" + }, + "value": "sample-group" + } + }, + { + "parameter": { + "$ref": "2683" + }, + "value": { + "$id": "2695", + "kind": "string", + "type": { + "$ref": "2684" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + } + ], + "responses": [ + { + "response": { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "789" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + "statusCode": 200, + "bodyValue": { + "$id": "2696", + "kind": "model", + "type": { + "$ref": "789" + }, + "value": { + "value": { + "$id": "2697", + "kind": "array", + "type": { + "$ref": "791" + }, + "value": [ + { + "$id": "2698", + "kind": "model", + "type": { + "$ref": "772" + }, + "value": { + "name": { + "$id": "2699", + "kind": "string", + "type": { + "$ref": "783" + }, + "value": "sample-pec1" + }, + "type": { + "$id": "2700", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/managedhsms/privateEndpointConnections" + }, + "etag": { + "$id": "2701", + "kind": "string", + "type": { + "$ref": "787" + }, + "value": "" + }, + "id": { + "$id": "2702", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/managedhsms/sample-mhsm/privateEndpointConnections/sample-pec1" + }, + "properties": { + "$id": "2703", + "kind": "model", + "type": { + "$ref": "662" + }, + "value": { + "privateEndpoint": { + "$id": "2704", + "kind": "model", + "type": { + "$ref": "664" + }, + "value": { + "id": { + "$id": "2705", + "kind": "string", + "type": { + "$ref": "666" + }, + "value": "/subscriptions/00000000-0000-0000-1234-000000000000/resourceGroups/sample-group/providers/Microsoft.Network/privateEndpoints/sample-pe1" + } + } + }, + "privateLinkServiceConnectionState": { + "$id": "2706", + "kind": "model", + "type": { + "$ref": "668" + }, + "value": { + "description": { + "$id": "2707", + "kind": "string", + "type": { + "$ref": "671" + }, + "value": "This was automatically approved by user1234@contoso.com" + }, + "actionsRequired": { + "$id": "2708", + "kind": "string", + "type": { + "$ref": "162" + }, + "value": "None" + }, + "status": { + "$id": "2709", + "kind": "string", + "type": { + "$ref": "156" + }, + "value": "Approved" + } + } + }, + "provisioningState": { + "$id": "2710", + "kind": "string", + "type": { + "$ref": "165" + }, + "value": "Succeeded" + } + } + } + } + }, + { + "$id": "2711", + "kind": "model", + "type": { + "$ref": "772" + }, + "value": { + "name": { + "$id": "2712", + "kind": "string", + "type": { + "$ref": "783" + }, + "value": "sample-pec2" + }, + "type": { + "$id": "2713", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/managedhsms/privateEndpointConnections" + }, + "etag": { + "$id": "2714", + "kind": "string", + "type": { + "$ref": "787" + }, + "value": "" + }, + "id": { + "$id": "2715", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/managedhsms/sample-mhsm/privateEndpointConnections/sample-pec2" + }, + "properties": { + "$id": "2716", + "kind": "model", + "type": { + "$ref": "662" + }, + "value": { + "privateEndpoint": { + "$id": "2717", + "kind": "model", + "type": { + "$ref": "664" + }, + "value": { + "id": { + "$id": "2718", + "kind": "string", + "type": { + "$ref": "666" + }, + "value": "/subscriptions/00000000-0000-0000-1234-000000000000/resourceGroups/sample-group/providers/Microsoft.Network/privateEndpoints/sample-pe2" + } + } + }, + "privateLinkServiceConnectionState": { + "$id": "2719", + "kind": "model", + "type": { + "$ref": "668" + }, + "value": { + "description": { + "$id": "2720", + "kind": "string", + "type": { + "$ref": "671" + }, + "value": "This was automatically approved by user1234@contoso.com" + }, + "actionsRequired": { + "$id": "2721", + "kind": "string", + "type": { + "$ref": "162" + }, + "value": "None" + }, + "status": { + "$id": "2722", + "kind": "string", + "type": { + "$ref": "156" + }, + "value": "Approved" + } + } + }, + "provisioningState": { + "$id": "2723", + "kind": "string", + "type": { + "$ref": "165" + }, + "value": "Succeeded" + } + } + } + } + } + ] + } + } + } + } + ] + } + ] + }, + "parameters": [ + { + "$id": "2724", + "kind": "method", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2725", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.listByResource.resourceGroupName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2726", + "kind": "method", + "name": "name", + "serializedName": "name", + "doc": "The name of the managed HSM Pool.", + "type": { + "$id": "2727", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.listByResource.name", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2728", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "292" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.listByResource.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$ref": "791" + }, + "resultSegments": [ + "value" + ] + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections.listByResource", + "pagingMetadata": { + "itemPropertySegments": [ + "value" + ], + "nextLink": { + "responseSegments": [ + "nextLink" + ], + "responseLocation": "Body" + } + } + } + ], + "parameters": [ + { + "$id": "2729", + "kind": "endpoint", + "name": "endpoint", + "serializedName": "endpoint", + "doc": "Service host", + "type": { + "$id": "2730", + "kind": "url", + "name": "endpoint", + "crossLanguageDefinitionId": "TypeSpec.url" + }, + "isApiVersion": false, + "optional": false, + "scope": "Client", + "isEndpoint": true, + "defaultValue": { + "type": { + "$id": "2731", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "https://management.azure.com" + }, + "serverUrlTemplate": "{endpoint}", + "skipUrlEncoding": false, + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.endpoint" + } + ], + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceOperations", + "arguments": {} + } + ], + "crossLanguageDefinitionId": "Microsoft.KeyVault.MhsmPrivateEndpointConnections", + "apiVersions": [ + "2025-05-01" + ], + "parent": { + "$ref": "884" + } + }, + { + "$id": "2732", + "kind": "client", + "name": "Secrets", + "namespace": "Azure.ResourceManager.KeyVault", + "methods": [ + { + "$id": "2733", + "kind": "basic", + "name": "get", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets.", + "operation": { + "$id": "2734", + "name": "get", + "resourceName": "Secret", + "doc": "Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets.", + "accessibility": "public", + "parameters": [ + { + "$id": "2735", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "2736", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "2737", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.get.apiVersion", + "readOnly": false + }, + { + "$id": "2738", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "2739", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "2740", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.get.subscriptionId" + }, + { + "$id": "2741", + "kind": "path", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2742", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.get.resourceGroupName" + }, + { + "$id": "2743", + "kind": "path", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "The name of the vault.", + "type": { + "$id": "2744", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.get.vaultName" + }, + { + "$id": "2745", + "kind": "path", + "name": "secretName", + "serializedName": "secretName", + "doc": "The name of the secret.", + "type": { + "$id": "2746", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.get.secretName" + }, + { + "$id": "2747", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "294" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.get.accept" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "795" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.get", + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceRead", + "arguments": {} + } + ], + "examples": [ + { + "$id": "2748", + "kind": "http", + "name": "Get a secret", + "description": "Get a secret", + "filePath": "2025-05-01/getSecret.json", + "parameters": [ + { + "parameter": { + "$ref": "2735" + }, + "value": { + "$id": "2749", + "kind": "string", + "type": { + "$ref": "2736" + }, + "value": "2025-05-01" + } + }, + { + "parameter": { + "$ref": "2741" + }, + "value": { + "$id": "2750", + "kind": "string", + "type": { + "$ref": "2742" + }, + "value": "sample-group" + } + }, + { + "parameter": { + "$ref": "2745" + }, + "value": { + "$id": "2751", + "kind": "string", + "type": { + "$ref": "2746" + }, + "value": "secret-name" + } + }, + { + "parameter": { + "$ref": "2738" + }, + "value": { + "$id": "2752", + "kind": "string", + "type": { + "$ref": "2739" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + }, + { + "parameter": { + "$ref": "2743" + }, + "value": { + "$id": "2753", + "kind": "string", + "type": { + "$ref": "2744" + }, + "value": "sample-vault" + } + } + ], + "responses": [ + { + "response": { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "795" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + "statusCode": 200, + "bodyValue": { + "$id": "2754", + "kind": "model", + "type": { + "$ref": "795" + }, + "value": { + "name": { + "$id": "2755", + "kind": "string", + "type": { + "$ref": "828" + }, + "value": "secret-name" + }, + "type": { + "$id": "2756", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/vaults/secrets" + }, + "id": { + "$id": "2757", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault/secrets/secret-name" + }, + "location": { + "$id": "2758", + "kind": "string", + "type": { + "$ref": "830" + }, + "value": "westus" + }, + "properties": { + "$id": "2759", + "kind": "model", + "type": { + "$ref": "801" + }, + "value": { + "attributes": { + "$id": "2760", + "kind": "model", + "type": { + "$ref": "807" + }, + "value": { + "created": { + "$id": "2761", + "kind": "number", + "type": { + "$ref": "818" + }, + "value": 1514940950 + }, + "enabled": { + "$id": "2762", + "kind": "boolean", + "type": { + "$ref": "810" + }, + "value": true + }, + "updated": { + "$id": "2763", + "kind": "number", + "type": { + "$ref": "821" + }, + "value": 1514940950 + } + } + }, + "secretUri": { + "$id": "2764", + "kind": "string", + "type": { + "$ref": "824" + }, + "value": "https://sample-vault.vault.azure.net/secrets/secret-name" + }, + "secretUriWithVersion": { + "$id": "2765", + "kind": "string", + "type": { + "$ref": "826" + }, + "value": "https://sample-vault.vault.azure.net/secrets/secret-name/77445834f7de41bab81d0723bf996860" + } + } + } + } + } + } + ] + } + ] + }, + "parameters": [ + { + "$id": "2766", + "kind": "method", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2767", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.get.resourceGroupName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2768", + "kind": "method", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "The name of the vault.", + "type": { + "$id": "2769", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.get.vaultName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2770", + "kind": "method", + "name": "secretName", + "serializedName": "secretName", + "doc": "The name of the secret.", + "type": { + "$id": "2771", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.get.secretName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2772", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "294" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.get.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$ref": "795" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.get" + }, + { + "$id": "2773", + "kind": "basic", + "name": "createOrUpdate", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "Create or update a secret in a key vault in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets.", + "operation": { + "$id": "2774", + "name": "createOrUpdate", + "resourceName": "Secret", + "doc": "Create or update a secret in a key vault in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets.", + "accessibility": "public", + "parameters": [ + { + "$id": "2775", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "2776", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "2777", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.createOrUpdate.apiVersion", + "readOnly": false + }, + { + "$id": "2778", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "2779", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "2780", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.createOrUpdate.subscriptionId" + }, + { + "$id": "2781", + "kind": "path", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2782", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.createOrUpdate.resourceGroupName" + }, + { + "$id": "2783", + "kind": "path", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "The name of the vault.", + "type": { + "$id": "2784", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.createOrUpdate.vaultName" + }, + { + "$id": "2785", + "kind": "path", + "name": "secretName", + "serializedName": "secretName", + "doc": "The name of the secret.", + "type": { + "$id": "2786", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.createOrUpdate.secretName" + }, + { + "$id": "2787", + "kind": "header", + "name": "contentType", + "serializedName": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$ref": "296" + }, + "isApiVersion": false, + "optional": false, + "isContentType": true, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.createOrUpdate.contentType" + }, + { + "$id": "2788", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "298" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.createOrUpdate.accept" + }, + { + "$id": "2789", + "kind": "body", + "name": "parameters", + "serializedName": "parameters", + "doc": "Parameters to create or update the secret", + "type": { + "$ref": "833" + }, + "isApiVersion": false, + "contentTypes": [ + "application/json" + ], + "defaultContentType": "application/json", + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.createOrUpdate.resource" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "795" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + { + "statusCodes": [ + 201 + ], + "bodyType": { + "$ref": "795" + }, + "headers": [ + { + "name": "retryAfter", + "nameInResponse": "Retry-After", + "doc": "The Retry-After header can indicate how long the client should wait before polling the operation status.", + "type": { + "$id": "2790", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "PUT", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.createOrUpdate", + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceCreateOrUpdate", + "arguments": {} + } + ], + "examples": [ + { + "$id": "2791", + "kind": "http", + "name": "Create a secret", + "description": "Create a secret", + "filePath": "2025-05-01/createSecret.json", + "parameters": [ + { + "parameter": { + "$ref": "2775" + }, + "value": { + "$id": "2792", + "kind": "string", + "type": { + "$ref": "2776" + }, + "value": "2025-05-01" + } + }, + { + "parameter": { + "$ref": "2789" + }, + "value": { + "$id": "2793", + "kind": "model", + "type": { + "$ref": "833" + }, + "value": { + "properties": { + "$id": "2794", + "kind": "model", + "type": { + "$ref": "801" + }, + "value": { + "value": { + "$id": "2795", + "kind": "string", + "type": { + "$ref": "803" + }, + "value": "secret-value" + } + } + } + } + } + }, + { + "parameter": { + "$ref": "2781" + }, + "value": { + "$id": "2796", + "kind": "string", + "type": { + "$ref": "2782" + }, + "value": "sample-group" + } + }, + { + "parameter": { + "$ref": "2785" + }, + "value": { + "$id": "2797", + "kind": "string", + "type": { + "$ref": "2786" + }, + "value": "secret-name" + } + }, + { + "parameter": { + "$ref": "2778" + }, + "value": { + "$id": "2798", + "kind": "string", + "type": { + "$ref": "2779" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + }, + { + "parameter": { + "$ref": "2783" + }, + "value": { + "$id": "2799", + "kind": "string", + "type": { + "$ref": "2784" + }, + "value": "sample-vault" + } + } + ], + "responses": [ + { + "response": { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "795" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + "statusCode": 200, + "bodyValue": { + "$id": "2800", + "kind": "model", + "type": { + "$ref": "795" + }, + "value": { + "name": { + "$id": "2801", + "kind": "string", + "type": { + "$ref": "828" + }, + "value": "secret-name" + }, + "type": { + "$id": "2802", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/vaults/secrets" + }, + "id": { + "$id": "2803", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault/secrets/secret-name" + }, + "location": { + "$id": "2804", + "kind": "string", + "type": { + "$ref": "830" + }, + "value": "westus" + }, + "properties": { + "$id": "2805", + "kind": "model", + "type": { + "$ref": "801" + }, + "value": { + "attributes": { + "$id": "2806", + "kind": "model", + "type": { + "$ref": "807" + }, + "value": { + "created": { + "$id": "2807", + "kind": "number", + "type": { + "$ref": "818" + }, + "value": 1514938738 + }, + "enabled": { + "$id": "2808", + "kind": "boolean", + "type": { + "$ref": "810" + }, + "value": true + }, + "updated": { + "$id": "2809", + "kind": "number", + "type": { + "$ref": "821" + }, + "value": 1514938738 + } + } + }, + "secretUri": { + "$id": "2810", + "kind": "string", + "type": { + "$ref": "824" + }, + "value": "https://sample-vault.vault.azure.net/secrets/secret-name" + }, + "secretUriWithVersion": { + "$id": "2811", + "kind": "string", + "type": { + "$ref": "826" + }, + "value": "https:/sample-vault.vault.azure.net/secrets/secret-name/baf6de32c4774c7c81345f6476cf90a4" + } + } + } + } + } + }, + { + "response": { + "statusCodes": [ + 201 + ], + "bodyType": { + "$ref": "795" + }, + "headers": [ + { + "name": "retryAfter", + "nameInResponse": "Retry-After", + "doc": "The Retry-After header can indicate how long the client should wait before polling the operation status.", + "type": { + "$ref": "2790" + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + "statusCode": 201, + "bodyValue": { + "$id": "2812", + "kind": "model", + "type": { + "$ref": "795" + }, + "value": { + "name": { + "$id": "2813", + "kind": "string", + "type": { + "$ref": "828" + }, + "value": "secret-name" + }, + "type": { + "$id": "2814", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/vaults/secrets" + }, + "id": { + "$id": "2815", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault/secrets/secret-name" + }, + "location": { + "$id": "2816", + "kind": "string", + "type": { + "$ref": "830" + }, + "value": "westus" + }, + "properties": { + "$id": "2817", + "kind": "model", + "type": { + "$ref": "801" + }, + "value": { + "attributes": { + "$id": "2818", + "kind": "model", + "type": { + "$ref": "807" + }, + "value": { + "created": { + "$id": "2819", + "kind": "number", + "type": { + "$ref": "818" + }, + "value": 1514938738 + }, + "enabled": { + "$id": "2820", + "kind": "boolean", + "type": { + "$ref": "810" + }, + "value": true + }, + "updated": { + "$id": "2821", + "kind": "number", + "type": { + "$ref": "821" + }, + "value": 1514938738 + } + } + }, + "secretUri": { + "$id": "2822", + "kind": "string", + "type": { + "$ref": "824" + }, + "value": "https://sample-vault.vault.azure.net/secrets/secret-name" + }, + "secretUriWithVersion": { + "$id": "2823", + "kind": "string", + "type": { + "$ref": "826" + }, + "value": "https:/sample-vault.vault.azure.net/secrets/secret-name/baf6de32c4774c7c81345f6476cf90a4" + } + } + } + } + } + } + ] + } + ] + }, + "parameters": [ + { + "$id": "2824", + "kind": "method", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2825", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.createOrUpdate.resourceGroupName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2826", + "kind": "method", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "The name of the vault.", + "type": { + "$id": "2827", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.createOrUpdate.vaultName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2828", + "kind": "method", + "name": "secretName", + "serializedName": "secretName", + "doc": "The name of the secret.", + "type": { + "$id": "2829", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.createOrUpdate.secretName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2830", + "kind": "method", + "name": "parameters", + "serializedName": "parameters", + "doc": "Parameters to create or update the secret", + "type": { + "$ref": "833" + }, + "location": "Body", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.createOrUpdate.resource", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2831", + "kind": "method", + "name": "contentType", + "serializedName": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$ref": "296" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.createOrUpdate.contentType", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2832", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "298" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.createOrUpdate.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$ref": "795" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.createOrUpdate" + }, + { + "$id": "2833", + "kind": "basic", + "name": "update", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "Update a secret in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets.", + "operation": { + "$id": "2834", + "name": "update", + "resourceName": "Secret", + "doc": "Update a secret in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets.", + "accessibility": "public", + "parameters": [ + { + "$id": "2835", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "2836", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "2837", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.update.apiVersion", + "readOnly": false + }, + { + "$id": "2838", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "2839", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "2840", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.update.subscriptionId" + }, + { + "$id": "2841", + "kind": "path", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2842", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.update.resourceGroupName" + }, + { + "$id": "2843", + "kind": "path", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "The name of the vault.", + "type": { + "$id": "2844", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.update.vaultName" + }, + { + "$id": "2845", + "kind": "path", + "name": "secretName", + "serializedName": "secretName", + "doc": "The name of the secret.", + "type": { + "$id": "2846", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.update.secretName" + }, + { + "$id": "2847", + "kind": "header", + "name": "contentType", + "serializedName": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$ref": "300" + }, + "isApiVersion": false, + "optional": false, + "isContentType": true, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.update.contentType" + }, + { + "$id": "2848", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "302" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.update.accept" + }, + { + "$id": "2849", + "kind": "body", + "name": "parameters", + "serializedName": "parameters", + "doc": "Parameters to patch the secret", + "type": { + "$ref": "836" + }, + "isApiVersion": false, + "contentTypes": [ + "application/json" + ], + "defaultContentType": "application/json", + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.update.properties" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "795" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + { + "statusCodes": [ + 201 + ], + "bodyType": { + "$ref": "795" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "PATCH", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.update", + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceUpdate", + "arguments": {} + } + ], + "examples": [ + { + "$id": "2850", + "kind": "http", + "name": "Update a secret", + "description": "Update a secret", + "filePath": "2025-05-01/updateSecret.json", + "parameters": [ + { + "parameter": { + "$ref": "2835" + }, + "value": { + "$id": "2851", + "kind": "string", + "type": { + "$ref": "2836" + }, + "value": "2025-05-01" + } + }, + { + "parameter": { + "$ref": "2849" + }, + "value": { + "$id": "2852", + "kind": "model", + "type": { + "$ref": "836" + }, + "value": { + "properties": { + "$id": "2853", + "kind": "model", + "type": { + "$ref": "839" + }, + "value": { + "value": { + "$id": "2854", + "kind": "string", + "type": { + "$ref": "841" + }, + "value": "secret-value2" + } + } + } + } + } + }, + { + "parameter": { + "$ref": "2841" + }, + "value": { + "$id": "2855", + "kind": "string", + "type": { + "$ref": "2842" + }, + "value": "sample-group" + } + }, + { + "parameter": { + "$ref": "2845" + }, + "value": { + "$id": "2856", + "kind": "string", + "type": { + "$ref": "2846" + }, + "value": "secret-name" + } + }, + { + "parameter": { + "$ref": "2838" + }, + "value": { + "$id": "2857", + "kind": "string", + "type": { + "$ref": "2839" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + }, + { + "parameter": { + "$ref": "2843" + }, + "value": { + "$id": "2858", + "kind": "string", + "type": { + "$ref": "2844" + }, + "value": "sample-vault" + } + } + ], + "responses": [ + { + "response": { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "795" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + "statusCode": 200, + "bodyValue": { + "$id": "2859", + "kind": "model", + "type": { + "$ref": "795" + }, + "value": { + "name": { + "$id": "2860", + "kind": "string", + "type": { + "$ref": "828" + }, + "value": "secret-name" + }, + "type": { + "$id": "2861", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/vaults/secrets" + }, + "id": { + "$id": "2862", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault/secrets/secret-name" + }, + "location": { + "$id": "2863", + "kind": "string", + "type": { + "$ref": "830" + }, + "value": "westus" + }, + "properties": { + "$id": "2864", + "kind": "model", + "type": { + "$ref": "801" + }, + "value": { + "attributes": { + "$id": "2865", + "kind": "model", + "type": { + "$ref": "807" + }, + "value": { + "created": { + "$id": "2866", + "kind": "number", + "type": { + "$ref": "818" + }, + "value": 1514940684 + }, + "enabled": { + "$id": "2867", + "kind": "boolean", + "type": { + "$ref": "810" + }, + "value": true + }, + "updated": { + "$id": "2868", + "kind": "number", + "type": { + "$ref": "821" + }, + "value": 1514940698 + } + } + }, + "secretUri": { + "$id": "2869", + "kind": "string", + "type": { + "$ref": "824" + }, + "value": "https://sample-vault.vault.azure.net/secrets/secret-name" + }, + "secretUriWithVersion": { + "$id": "2870", + "kind": "string", + "type": { + "$ref": "826" + }, + "value": "https://sample-vault.vault.azure.net/secrets/secret-name/b8c802f549764f2d97885d152f92ee9d" + } + } + } + } + } + }, + { + "response": { + "statusCodes": [ + 201 + ], + "bodyType": { + "$ref": "795" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + "statusCode": 201, + "bodyValue": { + "$id": "2871", + "kind": "model", + "type": { + "$ref": "795" + }, + "value": { + "name": { + "$id": "2872", + "kind": "string", + "type": { + "$ref": "828" + }, + "value": "secret-name" + }, + "type": { + "$id": "2873", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/vaults/secrets" + }, + "id": { + "$id": "2874", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault/secrets/secret-name" + }, + "location": { + "$id": "2875", + "kind": "string", + "type": { + "$ref": "830" + }, + "value": "westus" + }, + "properties": { + "$id": "2876", + "kind": "model", + "type": { + "$ref": "801" + }, + "value": { + "attributes": { + "$id": "2877", + "kind": "model", + "type": { + "$ref": "807" + }, + "value": { + "created": { + "$id": "2878", + "kind": "number", + "type": { + "$ref": "818" + }, + "value": 1514940684 + }, + "enabled": { + "$id": "2879", + "kind": "boolean", + "type": { + "$ref": "810" + }, + "value": true + }, + "updated": { + "$id": "2880", + "kind": "number", + "type": { + "$ref": "821" + }, + "value": 1514940698 + } + } + }, + "secretUri": { + "$id": "2881", + "kind": "string", + "type": { + "$ref": "824" + }, + "value": "https://sample-vault.vault.azure.net/secrets/secret-name" + }, + "secretUriWithVersion": { + "$id": "2882", + "kind": "string", + "type": { + "$ref": "826" + }, + "value": "https://sample-vault.vault.azure.net/secrets/secret-name/b8c802f549764f2d97885d152f92ee9d" + } + } + } + } + } + } + ] + } + ] + }, + "parameters": [ + { + "$id": "2883", + "kind": "method", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2884", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.update.resourceGroupName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2885", + "kind": "method", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "The name of the vault.", + "type": { + "$id": "2886", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.update.vaultName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2887", + "kind": "method", + "name": "secretName", + "serializedName": "secretName", + "doc": "The name of the secret.", + "type": { + "$id": "2888", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.update.secretName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2889", + "kind": "method", + "name": "parameters", + "serializedName": "parameters", + "doc": "Parameters to patch the secret", + "type": { + "$ref": "836" + }, + "location": "Body", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.update.properties", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2890", + "kind": "method", + "name": "contentType", + "serializedName": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$ref": "300" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.update.contentType", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2891", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "302" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.update.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$ref": "795" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.update" + }, + { + "$id": "2892", + "kind": "paging", + "name": "list", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets.", + "operation": { + "$id": "2893", + "name": "list", + "resourceName": "Secret", + "doc": "The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets.", + "accessibility": "public", + "parameters": [ + { + "$id": "2894", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "2895", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "2896", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.list.apiVersion", + "readOnly": false + }, + { + "$id": "2897", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "2898", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "2899", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.list.subscriptionId" + }, + { + "$id": "2900", + "kind": "path", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2901", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.list.resourceGroupName" + }, + { + "$id": "2902", + "kind": "path", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "The name of the vault.", + "type": { + "$id": "2903", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.list.vaultName" + }, + { + "$id": "2904", + "kind": "query", + "name": "$top", + "serializedName": "$top", + "doc": "Maximum number of results to return.", + "type": { + "$id": "2905", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "optional": true, + "scope": "Method", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.list.$top", + "readOnly": false + }, + { + "$id": "2906", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "304" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.list.accept" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "845" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.list", + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceList", + "arguments": {} + } + ], + "examples": [ + { + "$id": "2907", + "kind": "http", + "name": "List secrets in the vault", + "description": "List secrets in the vault", + "filePath": "2025-05-01/listSecrets.json", + "parameters": [ + { + "parameter": { + "$ref": "2894" + }, + "value": { + "$id": "2908", + "kind": "string", + "type": { + "$ref": "2895" + }, + "value": "2025-05-01" + } + }, + { + "parameter": { + "$ref": "2900" + }, + "value": { + "$id": "2909", + "kind": "string", + "type": { + "$ref": "2901" + }, + "value": "sample-group" + } + }, + { + "parameter": { + "$ref": "2897" + }, + "value": { + "$id": "2910", + "kind": "string", + "type": { + "$ref": "2898" + }, + "value": "00000000-0000-0000-0000-000000000000" + } + }, + { + "parameter": { + "$ref": "2902" + }, + "value": { + "$id": "2911", + "kind": "string", + "type": { + "$ref": "2903" + }, + "value": "sample-vault" + } + } + ], + "responses": [ + { + "response": { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "845" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + }, + "statusCode": 200, + "bodyValue": { + "$id": "2912", + "kind": "model", + "type": { + "$ref": "845" + }, + "value": { + "value": { + "$id": "2913", + "kind": "array", + "type": { + "$ref": "847" + }, + "value": [ + { + "$id": "2914", + "kind": "model", + "type": { + "$ref": "795" + }, + "value": { + "name": { + "$id": "2915", + "kind": "string", + "type": { + "$ref": "828" + }, + "value": "secret-name" + }, + "type": { + "$id": "2916", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/vaults/secrets" + }, + "id": { + "$id": "2917", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault/secrets/secret-name" + }, + "location": { + "$id": "2918", + "kind": "string", + "type": { + "$ref": "830" + }, + "value": "westus" + }, + "properties": { + "$id": "2919", + "kind": "model", + "type": { + "$ref": "801" + }, + "value": { + "attributes": { + "$id": "2920", + "kind": "model", + "type": { + "$ref": "807" + }, + "value": { + "created": { + "$id": "2921", + "kind": "number", + "type": { + "$ref": "818" + }, + "value": 1514941476 + }, + "enabled": { + "$id": "2922", + "kind": "boolean", + "type": { + "$ref": "810" + }, + "value": true + }, + "updated": { + "$id": "2923", + "kind": "number", + "type": { + "$ref": "821" + }, + "value": 1514941476 + } + } + }, + "secretUri": { + "$id": "2924", + "kind": "string", + "type": { + "$ref": "824" + }, + "value": "https://sample-vault.vault.azure.net/secrets/secret-name" + }, + "secretUriWithVersion": { + "$id": "2925", + "kind": "string", + "type": { + "$ref": "826" + }, + "value": "https://sample-vault.vault.azure.net/secrets/secret-name/40af42fbc10047f8a756a73211492f56" + } + } + } + } + }, + { + "$id": "2926", + "kind": "model", + "type": { + "$ref": "795" + }, + "value": { + "name": { + "$id": "2927", + "kind": "string", + "type": { + "$ref": "828" + }, + "value": "secret-name2" + }, + "type": { + "$id": "2928", + "kind": "string", + "type": { + "$ref": "333" + }, + "value": "Microsoft.KeyVault/vaults/secrets" + }, + "id": { + "$id": "2929", + "kind": "string", + "type": { + "$ref": "328" + }, + "value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sample-group/providers/Microsoft.KeyVault/vaults/sample-vault/secrets/secret-name2" + }, + "location": { + "$id": "2930", + "kind": "string", + "type": { + "$ref": "830" + }, + "value": "westus" + }, + "properties": { + "$id": "2931", + "kind": "model", + "type": { + "$ref": "801" + }, + "value": { + "attributes": { + "$id": "2932", + "kind": "model", + "type": { + "$ref": "807" + }, + "value": { + "created": { + "$id": "2933", + "kind": "number", + "type": { + "$ref": "818" + }, + "value": 1514941476 + }, + "enabled": { + "$id": "2934", + "kind": "boolean", + "type": { + "$ref": "810" + }, + "value": true + }, + "updated": { + "$id": "2935", + "kind": "number", + "type": { + "$ref": "821" + }, + "value": 1514941476 + } + } + }, + "secretUri": { + "$id": "2936", + "kind": "string", + "type": { + "$ref": "824" + }, + "value": "https://sample-vault.vault.azure.net/secrets/secret-name2" + }, + "secretUriWithVersion": { + "$id": "2937", + "kind": "string", + "type": { + "$ref": "826" + }, + "value": "https://sample-vault.vault.azure.net/secrets/secret-name2/cd7264a6f56c44d1b594423c80609aae" + } + } + } + } + } + ] + } + } + } + } + ] + } + ] + }, + "parameters": [ + { + "$id": "2938", + "kind": "method", + "name": "resourceGroupName", + "serializedName": "resourceGroupName", + "doc": "The name of the resource group. The name is case insensitive.", + "type": { + "$id": "2939", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.list.resourceGroupName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2940", + "kind": "method", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "The name of the vault.", + "type": { + "$id": "2941", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.list.vaultName", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2942", + "kind": "method", + "name": "$top", + "serializedName": "$top", + "doc": "Maximum number of results to return.", + "type": { + "$id": "2943", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "optional": true, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.list.$top", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2944", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "304" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.list.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$ref": "847" + }, + "resultSegments": [ + "value" + ] + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets.list", + "pagingMetadata": { + "itemPropertySegments": [ + "value" + ], + "nextLink": { + "responseSegments": [ + "nextLink" + ], + "responseLocation": "Body" + } + } + } + ], + "parameters": [ + { + "$id": "2945", + "kind": "endpoint", + "name": "endpoint", + "serializedName": "endpoint", + "doc": "Service host", + "type": { + "$id": "2946", + "kind": "url", + "name": "endpoint", + "crossLanguageDefinitionId": "TypeSpec.url" + }, + "isApiVersion": false, + "optional": false, + "scope": "Client", + "isEndpoint": true, + "defaultValue": { + "type": { + "$id": "2947", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "https://management.azure.com" + }, + "serverUrlTemplate": "{endpoint}", + "skipUrlEncoding": false, + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.endpoint" + } + ], + "decorators": [ + { + "name": "Azure.ResourceManager.@armResourceOperations", + "arguments": {} + } + ], + "crossLanguageDefinitionId": "Microsoft.KeyVault.Secrets", + "apiVersions": [ + "2025-05-01" + ], + "parent": { + "$ref": "884" + } + }, + { + "$id": "2948", + "kind": "client", + "name": "VaultsOperationGroup", + "namespace": "Azure.ResourceManager.KeyVault", + "methods": [ + { + "$id": "2949", + "kind": "paging", + "name": "GetDeletedKeyVaults", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "Gets information about the deleted vaults in a subscription.", + "operation": { + "$id": "2950", + "name": "GetDeletedKeyVaults", + "resourceName": "VaultsOperationGroup", + "doc": "Gets information about the deleted vaults in a subscription.", + "accessibility": "public", + "parameters": [ + { + "$id": "2951", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "2952", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "2953", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultsOperationGroup.listDeleted.apiVersion", + "readOnly": false + }, + { + "$id": "2954", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "2955", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "2956", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultsOperationGroup.listDeleted.subscriptionId" + }, + { + "$id": "2957", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "306" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultsOperationGroup.listDeleted.accept" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "851" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultsOperationGroup.listDeleted", + "decorators": [] + }, + "parameters": [ + { + "$id": "2958", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "306" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultsOperationGroup.listDeleted.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$ref": "853" + }, + "resultSegments": [ + "value" + ] + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultsOperationGroup.listDeleted", + "pagingMetadata": { + "itemPropertySegments": [ + "value" + ], + "nextLink": { + "responseSegments": [ + "nextLink" + ], + "responseLocation": "Body" + } + } + }, + { + "$id": "2959", + "kind": "basic", + "name": "CheckKeyVaultNameAvailability", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "Checks that the vault name is valid and is not already in use.", + "operation": { + "$id": "2960", + "name": "CheckKeyVaultNameAvailability", + "resourceName": "VaultsOperationGroup", + "doc": "Checks that the vault name is valid and is not already in use.", + "accessibility": "public", + "parameters": [ + { + "$id": "2961", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "2962", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "2963", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultsOperationGroup.checkNameAvailability.apiVersion", + "readOnly": false + }, + { + "$id": "2964", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "2965", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "2966", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultsOperationGroup.checkNameAvailability.subscriptionId" + }, + { + "$id": "2967", + "kind": "header", + "name": "contentType", + "serializedName": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$ref": "308" + }, + "isApiVersion": false, + "optional": false, + "isContentType": true, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultsOperationGroup.checkNameAvailability.contentType" + }, + { + "$id": "2968", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "310" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultsOperationGroup.checkNameAvailability.accept" + }, + { + "$id": "2969", + "kind": "body", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "The name of the vault.", + "type": { + "$ref": "857" + }, + "isApiVersion": false, + "contentTypes": [ + "application/json" + ], + "defaultContentType": "application/json", + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultsOperationGroup.checkNameAvailability.body" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "863" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "POST", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultsOperationGroup.checkNameAvailability", + "decorators": [] + }, + "parameters": [ + { + "$id": "2970", + "kind": "method", + "name": "vaultName", + "serializedName": "vaultName", + "doc": "The name of the vault.", + "type": { + "$ref": "857" + }, + "location": "Body", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultsOperationGroup.checkNameAvailability.body", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2971", + "kind": "method", + "name": "contentType", + "serializedName": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$ref": "308" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultsOperationGroup.checkNameAvailability.contentType", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2972", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "310" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultsOperationGroup.checkNameAvailability.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$ref": "863" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultsOperationGroup.checkNameAvailability" + } + ], + "parameters": [ + { + "$id": "2973", + "kind": "endpoint", + "name": "endpoint", + "serializedName": "endpoint", + "doc": "Service host", + "type": { + "$id": "2974", + "kind": "url", + "name": "endpoint", + "crossLanguageDefinitionId": "TypeSpec.url" + }, + "isApiVersion": false, + "optional": false, + "scope": "Client", + "isEndpoint": true, + "defaultValue": { + "type": { + "$id": "2975", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "https://management.azure.com" + }, + "serverUrlTemplate": "{endpoint}", + "skipUrlEncoding": false, + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.endpoint" + } + ], + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.VaultsOperationGroup", + "apiVersions": [ + "2025-05-01" + ], + "parent": { + "$ref": "884" + } + }, + { + "$id": "2976", + "kind": "client", + "name": "ManagedHsmsOperationGroup", + "namespace": "Azure.ResourceManager.KeyVault", + "methods": [ + { + "$id": "2977", + "kind": "paging", + "name": "GetDeletedManagedHsms", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "The List operation gets information about the deleted managed HSMs associated with the subscription.", + "operation": { + "$id": "2978", + "name": "GetDeletedManagedHsms", + "resourceName": "ManagedHsmsOperationGroup", + "doc": "The List operation gets information about the deleted managed HSMs associated with the subscription.", + "accessibility": "public", + "parameters": [ + { + "$id": "2979", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "2980", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "2981", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmsOperationGroup.listDeleted.apiVersion", + "readOnly": false + }, + { + "$id": "2982", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "2983", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "2984", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmsOperationGroup.listDeleted.subscriptionId" + }, + { + "$id": "2985", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "312" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmsOperationGroup.listDeleted.accept" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "869" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedManagedHSMs", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmsOperationGroup.listDeleted", + "decorators": [] + }, + "parameters": [ + { + "$id": "2986", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "312" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmsOperationGroup.listDeleted.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$ref": "871" + }, + "resultSegments": [ + "value" + ] + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmsOperationGroup.listDeleted", + "pagingMetadata": { + "itemPropertySegments": [ + "value" + ], + "nextLink": { + "responseSegments": [ + "nextLink" + ], + "responseLocation": "Body" + } + } + }, + { + "$id": "2987", + "kind": "basic", + "name": "CheckManagedHsmNameAvailability", + "accessibility": "public", + "apiVersions": [ + "2025-05-01" + ], + "doc": "Checks that the managed hsm name is valid and is not already in use.", + "operation": { + "$id": "2988", + "name": "CheckManagedHsmNameAvailability", + "resourceName": "ManagedHsmsOperationGroup", + "doc": "Checks that the managed hsm name is valid and is not already in use.", + "accessibility": "public", + "parameters": [ + { + "$id": "2989", + "kind": "query", + "name": "apiVersion", + "serializedName": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "2990", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "isApiVersion": true, + "explode": false, + "defaultValue": { + "type": { + "$id": "2991", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-05-01" + }, + "optional": false, + "scope": "Client", + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmsOperationGroup.checkMhsmNameAvailability.apiVersion", + "readOnly": false + }, + { + "$id": "2992", + "kind": "path", + "name": "subscriptionId", + "serializedName": "subscriptionId", + "doc": "The ID of the target subscription. The value must be an UUID.", + "type": { + "$id": "2993", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "2994", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "isApiVersion": false, + "explode": false, + "style": "simple", + "allowReserved": false, + "skipUrlEncoding": false, + "optional": false, + "scope": "Client", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmsOperationGroup.checkMhsmNameAvailability.subscriptionId" + }, + { + "$id": "2995", + "kind": "header", + "name": "contentType", + "serializedName": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$ref": "314" + }, + "isApiVersion": false, + "optional": false, + "isContentType": true, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmsOperationGroup.checkMhsmNameAvailability.contentType" + }, + { + "$id": "2996", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "316" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmsOperationGroup.checkMhsmNameAvailability.accept" + }, + { + "$id": "2997", + "kind": "body", + "name": "mhsmName", + "serializedName": "mhsmName", + "doc": "The request body", + "type": { + "$ref": "875" + }, + "isApiVersion": false, + "contentTypes": [ + "application/json" + ], + "defaultContentType": "application/json", + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmsOperationGroup.checkMhsmNameAvailability.body" + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "878" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "POST", + "uri": "{endpoint}", + "path": "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkMhsmNameAvailability", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmsOperationGroup.checkMhsmNameAvailability", + "decorators": [] + }, + "parameters": [ + { + "$id": "2998", + "kind": "method", + "name": "mhsmName", + "serializedName": "mhsmName", + "doc": "The request body", + "type": { + "$ref": "875" + }, + "location": "Body", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmsOperationGroup.checkMhsmNameAvailability.body", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "2999", + "kind": "method", + "name": "contentType", + "serializedName": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$ref": "314" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmsOperationGroup.checkMhsmNameAvailability.contentType", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "3000", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "316" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmsOperationGroup.checkMhsmNameAvailability.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ], + "response": { + "type": { + "$ref": "878" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmsOperationGroup.checkMhsmNameAvailability" + } + ], + "parameters": [ + { + "$id": "3001", + "kind": "endpoint", + "name": "endpoint", + "serializedName": "endpoint", + "doc": "Service host", + "type": { + "$id": "3002", + "kind": "url", + "name": "endpoint", + "crossLanguageDefinitionId": "TypeSpec.url" + }, + "isApiVersion": false, + "optional": false, + "scope": "Client", + "isEndpoint": true, + "defaultValue": { + "type": { + "$id": "3003", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "https://management.azure.com" + }, + "serverUrlTemplate": "{endpoint}", + "skipUrlEncoding": false, + "readOnly": false, + "crossLanguageDefinitionId": "Microsoft.KeyVault.endpoint" + } + ], + "decorators": [], + "crossLanguageDefinitionId": "Microsoft.KeyVault.ManagedHsmsOperationGroup", + "apiVersions": [ + "2025-05-01" + ], + "parent": { + "$ref": "884" + } + } + ] + } + ], + "auth": { + "oAuth2": { + "flows": [ + { + "scopes": [ + "user_impersonation" + ], + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize" + } + ] + } + } +}