diff --git a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/AzureNetAppFilesManagementClient.cs b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/AzureNetAppFilesManagementClient.cs index 255ee670336e..4d5efc6b4151 100644 --- a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/AzureNetAppFilesManagementClient.cs +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/AzureNetAppFilesManagementClient.cs @@ -131,6 +131,11 @@ public partial class AzureNetAppFilesManagementClient : ServiceClient public virtual IBackupPoliciesOperations BackupPolicies { get; private set; } + /// + /// Gets the IVolumeQuotaRulesOperations. + /// + public virtual IVolumeQuotaRulesOperations VolumeQuotaRules { get; private set; } + /// /// Gets the IVaultsOperations. /// @@ -398,11 +403,12 @@ private void Initialize() Backups = new BackupsOperations(this); AccountBackups = new AccountBackupsOperations(this); BackupPolicies = new BackupPoliciesOperations(this); + VolumeQuotaRules = new VolumeQuotaRulesOperations(this); Vaults = new VaultsOperations(this); VolumeGroups = new VolumeGroupsOperations(this); Subvolumes = new SubvolumesOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2021-10-01"; + ApiVersion = "2022-01-01"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/IAzureNetAppFilesManagementClient.cs b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/IAzureNetAppFilesManagementClient.cs index b785b45f3494..282de7671eb4 100644 --- a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/IAzureNetAppFilesManagementClient.cs +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/IAzureNetAppFilesManagementClient.cs @@ -126,6 +126,11 @@ public partial interface IAzureNetAppFilesManagementClient : System.IDisposable /// IBackupPoliciesOperations BackupPolicies { get; } + /// + /// Gets the IVolumeQuotaRulesOperations. + /// + IVolumeQuotaRulesOperations VolumeQuotaRules { get; } + /// /// Gets the IVaultsOperations. /// diff --git a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/INetAppResourceOperations.cs b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/INetAppResourceOperations.cs index 3b526ee9a1c9..635c4b33b730 100644 --- a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/INetAppResourceOperations.cs +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/INetAppResourceOperations.cs @@ -131,5 +131,31 @@ public partial interface INetAppResourceOperations /// Thrown when a required parameter is null /// Task> CheckQuotaAvailabilityWithHttpMessagesAsync(string location, string name, string type, string resourceGroup, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Describes region specific information. + /// + /// + /// Provides storage to network proximity and logical zone mapping + /// information. + /// + /// + /// The location + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> QueryRegionInfoWithHttpMessagesAsync(string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/IVolumeQuotaRulesOperations.cs b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/IVolumeQuotaRulesOperations.cs new file mode 100644 index 000000000000..e16841796922 --- /dev/null +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/IVolumeQuotaRulesOperations.cs @@ -0,0 +1,326 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.NetApp +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VolumeQuotaRulesOperations operations. + /// + public partial interface IVolumeQuotaRulesOperations + { + /// + /// Get all quota rules for a volume + /// + /// + /// List all quota rules associated with the volume + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByVolumeWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Describe a quota rule + /// + /// + /// Get details of the specified quota rule + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The name of volume quota rule + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create a quota rule + /// + /// + /// Create the specified quota rule within the given volume + /// + /// + /// Quota rule object supplied in the body of the operation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The name of volume quota rule + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(VolumeQuotaRule body, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a quota rule + /// + /// + /// Patch a quota rule + /// + /// + /// Quota rule object supplied in the body of the operation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The name of volume quota rule + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(VolumeQuotaRule body, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a quota rule + /// + /// + /// Delete quota rule + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The name of volume quota rule + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create a quota rule + /// + /// + /// Create the specified quota rule within the given volume + /// + /// + /// Quota rule object supplied in the body of the operation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The name of volume quota rule + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateWithHttpMessagesAsync(VolumeQuotaRule body, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a quota rule + /// + /// + /// Patch a quota rule + /// + /// + /// Quota rule object supplied in the body of the operation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The name of volume quota rule + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(VolumeQuotaRule body, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a quota rule + /// + /// + /// Delete quota rule + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The name of volume quota rule + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/IVolumesOperations.cs b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/IVolumesOperations.cs index b824ac54833e..ca2ce48f26b6 100644 --- a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/IVolumesOperations.cs +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/IVolumesOperations.cs @@ -233,6 +233,37 @@ public partial interface IVolumesOperations /// Task RevertWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, VolumeRevert body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Reset cifs password + /// + /// + /// Reset cifs password from volume + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task ResetCifsPasswordWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Break volume replication /// /// @@ -301,6 +332,40 @@ public partial interface IVolumesOperations /// Task> ReplicationStatusMethodWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// List replications for volume + /// + /// + /// List all replications for a specified volume + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListReplicationsMethodWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Resync volume replication /// /// @@ -465,6 +530,101 @@ public partial interface IVolumesOperations /// Task PoolChangeWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, PoolChangeRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Relocate volume + /// + /// + /// Relocates volume to a new stamp + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task RelocateWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Finalize volume relocation + /// + /// + /// Finalizes the relocation of the volume and cleans up the old + /// volume. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task FinalizeRelocationWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Revert volume relocation + /// + /// + /// Reverts the volume relocation process, cleans up the new volume and + /// starts using the former-existing volume. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task RevertRelocationWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Create or Update a volume /// /// @@ -609,6 +769,37 @@ public partial interface IVolumesOperations /// Task BeginRevertWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, VolumeRevert body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Reset cifs password + /// + /// + /// Reset cifs password from volume + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginResetCifsPasswordWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Break volume replication /// /// @@ -807,6 +998,101 @@ public partial interface IVolumesOperations /// Task BeginPoolChangeWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, PoolChangeRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Relocate volume + /// + /// + /// Relocates volume to a new stamp + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginRelocateWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Finalize volume relocation + /// + /// + /// Finalizes the relocation of the volume and cleans up the old + /// volume. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginFinalizeRelocationWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Revert volume relocation + /// + /// + /// Reverts the volume relocation process, cleans up the new volume and + /// starts using the former-existing volume. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginRevertRelocationWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Describe all volumes /// /// diff --git a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/ListReplications.cs b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/ListReplications.cs new file mode 100644 index 000000000000..325bd76ef366 --- /dev/null +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/ListReplications.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.NetApp.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// List Replications + /// + public partial class ListReplications + { + /// + /// Initializes a new instance of the ListReplications class. + /// + public ListReplications() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ListReplications class. + /// + /// A list of replications + public ListReplications(IList value = default(IList)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a list of replications + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/RegionInfo.cs b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/RegionInfo.cs new file mode 100644 index 000000000000..c57abc688ce9 --- /dev/null +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/RegionInfo.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.NetApp.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Provides region specific information. + /// + public partial class RegionInfo + { + /// + /// Initializes a new instance of the RegionInfo class. + /// + public RegionInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RegionInfo class. + /// + /// Storage to Network + /// Proximity + /// Logical availability zone + /// mappings. + public RegionInfo(string storageToNetworkProximity = default(string), IList availabilityZoneMappings = default(IList)) + { + StorageToNetworkProximity = storageToNetworkProximity; + AvailabilityZoneMappings = availabilityZoneMappings; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets storage to Network Proximity + /// + /// + /// Provides storage to network proximity information in the region. + /// Possible values include: 'Default', 'T1', 'T2', 'T1AndT2' + /// + [JsonProperty(PropertyName = "storageToNetworkProximity")] + public string StorageToNetworkProximity { get; set; } + + /// + /// Gets or sets logical availability zone mappings. + /// + /// + /// Provides logical availability zone mappings for the subscription + /// for a region. + /// + [JsonProperty(PropertyName = "availabilityZoneMappings")] + public IList AvailabilityZoneMappings { get; set; } + + } +} diff --git a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/RegionInfoAvailabilityZoneMappingsItem.cs b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/RegionInfoAvailabilityZoneMappingsItem.cs new file mode 100644 index 000000000000..8708134fef71 --- /dev/null +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/RegionInfoAvailabilityZoneMappingsItem.cs @@ -0,0 +1,58 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.NetApp.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class RegionInfoAvailabilityZoneMappingsItem + { + /// + /// Initializes a new instance of the + /// RegionInfoAvailabilityZoneMappingsItem class. + /// + public RegionInfoAvailabilityZoneMappingsItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// RegionInfoAvailabilityZoneMappingsItem class. + /// + /// Logical availability zone. + /// Available availability zone + public RegionInfoAvailabilityZoneMappingsItem(string availabilityZone = default(string), bool? isAvailable = default(bool?)) + { + AvailabilityZone = availabilityZone; + IsAvailable = isAvailable; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets logical availability zone. + /// + [JsonProperty(PropertyName = "availabilityZone")] + public string AvailabilityZone { get; set; } + + /// + /// Gets or sets available availability zone + /// + [JsonProperty(PropertyName = "isAvailable")] + public bool? IsAvailable { get; set; } + + } +} diff --git a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/RegionStorageToNetworkProximity.cs b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/RegionStorageToNetworkProximity.cs new file mode 100644 index 000000000000..13cb221a931d --- /dev/null +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/RegionStorageToNetworkProximity.cs @@ -0,0 +1,36 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.NetApp.Models +{ + + /// + /// Defines values for RegionStorageToNetworkProximity. + /// + public static class RegionStorageToNetworkProximity + { + /// + /// Basic network connectivity. + /// + public const string Default = "Default"; + /// + /// Standard T1 network connectivity. + /// + public const string T1 = "T1"; + /// + /// Standard T2 network connectivity. + /// + public const string T2 = "T2"; + /// + /// Standard T1 and T2 network connectivity. + /// + public const string T1AndT2 = "T1AndT2"; + } +} diff --git a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/Replication.cs b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/Replication.cs new file mode 100644 index 000000000000..24031f63bbe3 --- /dev/null +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/Replication.cs @@ -0,0 +1,98 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.NetApp.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Replication properties + /// + public partial class Replication + { + /// + /// Initializes a new instance of the Replication class. + /// + public Replication() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Replication class. + /// + /// The resource ID of the remote + /// volume. + /// Indicates whether the local volume is + /// the source or destination for the Volume Replication. Possible + /// values include: 'src', 'dst' + /// Schedule. Possible values + /// include: '_10minutely', 'hourly', 'daily' + /// The remote region for the other + /// end of the Volume Replication. + public Replication(string remoteVolumeResourceId, string endpointType = default(string), string replicationSchedule = default(string), string remoteVolumeRegion = default(string)) + { + EndpointType = endpointType; + ReplicationSchedule = replicationSchedule; + RemoteVolumeResourceId = remoteVolumeResourceId; + RemoteVolumeRegion = remoteVolumeRegion; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates whether the local volume is the source or + /// destination for the Volume Replication. Possible values include: + /// 'src', 'dst' + /// + [JsonProperty(PropertyName = "endpointType")] + public string EndpointType { get; set; } + + /// + /// Gets or sets schedule. Possible values include: '_10minutely', + /// 'hourly', 'daily' + /// + [JsonProperty(PropertyName = "replicationSchedule")] + public string ReplicationSchedule { get; set; } + + /// + /// Gets or sets the resource ID of the remote volume. + /// + [JsonProperty(PropertyName = "remoteVolumeResourceId")] + public string RemoteVolumeResourceId { get; set; } + + /// + /// Gets or sets the remote region for the other end of the Volume + /// Replication. + /// + [JsonProperty(PropertyName = "remoteVolumeRegion")] + public string RemoteVolumeRegion { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (RemoteVolumeResourceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RemoteVolumeResourceId"); + } + } + } +} diff --git a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/Type.cs b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/Type.cs new file mode 100644 index 000000000000..4f04f83ff300 --- /dev/null +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/Type.cs @@ -0,0 +1,36 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.NetApp.Models +{ + + /// + /// Defines values for Type. + /// + public static class Type + { + /// + /// Default user quota + /// + public const string DefaultUserQuota = "DefaultUserQuota"; + /// + /// Default group quota + /// + public const string DefaultGroupQuota = "DefaultGroupQuota"; + /// + /// Individual user quota + /// + public const string IndividualUserQuota = "IndividualUserQuota"; + /// + /// Individual group quota + /// + public const string IndividualGroupQuota = "IndividualGroupQuota"; + } +} diff --git a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/Volume.cs b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/Volume.cs index 1251748664d9..0ebf45744039 100644 --- a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/Volume.cs +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/Volume.cs @@ -46,6 +46,7 @@ public Volume() /// the resource is updated. /// Resource type /// Resource tags + /// Availability Zone /// FileSystem ID /// serviceLevel /// exportPolicy @@ -124,13 +125,16 @@ public Volume() /// Volume spec name is the application /// specific designation or identifier for the particular volume in a /// volume group for e.g. data, log + /// Specifies if the volume is encrypted or + /// not. Only available on volumes created or updated after + /// 2022-01-01. /// Volume placement rules /// Flag indicating whether subvolume /// operations are enabled on the volume. Possible values include: /// 'Enabled', 'Disabled' /// The system meta data relating to this /// resource. - public Volume(string location, string creationToken, long usageThreshold, string subnetId, string id = default(string), string name = default(string), string etag = default(string), string type = default(string), IDictionary tags = default(IDictionary), string fileSystemId = default(string), string serviceLevel = default(string), VolumePropertiesExportPolicy exportPolicy = default(VolumePropertiesExportPolicy), IList protocolTypes = default(IList), string provisioningState = default(string), string snapshotId = default(string), string backupId = default(string), string baremetalTenantId = default(string), string networkFeatures = default(string), string networkSiblingSetId = default(string), string storageToNetworkProximity = default(string), IList mountTargets = default(IList), string volumeType = default(string), VolumePropertiesDataProtection dataProtection = default(VolumePropertiesDataProtection), bool? isRestoring = default(bool?), bool? snapshotDirectoryVisible = default(bool?), bool? kerberosEnabled = default(bool?), string securityStyle = default(string), bool? smbEncryption = default(bool?), bool? smbContinuouslyAvailable = default(bool?), double? throughputMibps = default(double?), string encryptionKeySource = default(string), bool? ldapEnabled = default(bool?), bool? coolAccess = default(bool?), int? coolnessPeriod = default(int?), string unixPermissions = default(string), int? cloneProgress = default(int?), string avsDataStore = default(string), bool? isDefaultQuotaEnabled = default(bool?), long? defaultUserQuotaInKiBs = default(long?), long? defaultGroupQuotaInKiBs = default(long?), long? maximumNumberOfFiles = default(long?), string volumeGroupName = default(string), string capacityPoolResourceId = default(string), string proximityPlacementGroup = default(string), string t2Network = default(string), string volumeSpecName = default(string), IList placementRules = default(IList), string enableSubvolumes = default(string), SystemData systemData = default(SystemData)) + public Volume(string location, string creationToken, long usageThreshold, string subnetId, string id = default(string), string name = default(string), string etag = default(string), string type = default(string), IDictionary tags = default(IDictionary), IList zones = default(IList), string fileSystemId = default(string), string serviceLevel = default(string), VolumePropertiesExportPolicy exportPolicy = default(VolumePropertiesExportPolicy), IList protocolTypes = default(IList), string provisioningState = default(string), string snapshotId = default(string), string backupId = default(string), string baremetalTenantId = default(string), string networkFeatures = default(string), string networkSiblingSetId = default(string), string storageToNetworkProximity = default(string), IList mountTargets = default(IList), string volumeType = default(string), VolumePropertiesDataProtection dataProtection = default(VolumePropertiesDataProtection), bool? isRestoring = default(bool?), bool? snapshotDirectoryVisible = default(bool?), bool? kerberosEnabled = default(bool?), string securityStyle = default(string), bool? smbEncryption = default(bool?), bool? smbContinuouslyAvailable = default(bool?), double? throughputMibps = default(double?), string encryptionKeySource = default(string), bool? ldapEnabled = default(bool?), bool? coolAccess = default(bool?), int? coolnessPeriod = default(int?), string unixPermissions = default(string), int? cloneProgress = default(int?), string avsDataStore = default(string), bool? isDefaultQuotaEnabled = default(bool?), long? defaultUserQuotaInKiBs = default(long?), long? defaultGroupQuotaInKiBs = default(long?), long? maximumNumberOfFiles = default(long?), string volumeGroupName = default(string), string capacityPoolResourceId = default(string), string proximityPlacementGroup = default(string), string t2Network = default(string), string volumeSpecName = default(string), bool? encrypted = default(bool?), IList placementRules = default(IList), string enableSubvolumes = default(string), SystemData systemData = default(SystemData)) { Location = location; Id = id; @@ -138,6 +142,7 @@ public Volume() Etag = etag; Type = type; Tags = tags; + Zones = zones; FileSystemId = fileSystemId; CreationToken = creationToken; ServiceLevel = serviceLevel; @@ -178,6 +183,7 @@ public Volume() ProximityPlacementGroup = proximityPlacementGroup; T2Network = t2Network; VolumeSpecName = volumeSpecName; + Encrypted = encrypted; PlacementRules = placementRules; EnableSubvolumes = enableSubvolumes; SystemData = systemData; @@ -226,6 +232,12 @@ public Volume() [JsonProperty(PropertyName = "tags")] public IDictionary Tags { get; set; } + /// + /// Gets or sets availability Zone + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; set; } + /// /// Gets fileSystem ID /// @@ -553,6 +565,13 @@ public Volume() [JsonProperty(PropertyName = "properties.volumeSpecName")] public string VolumeSpecName { get; set; } + /// + /// Gets specifies if the volume is encrypted or not. Only available on + /// volumes created or updated after 2022-01-01. + /// + [JsonProperty(PropertyName = "properties.encrypted")] + public bool? Encrypted { get; private set; } + /// /// Gets or sets volume placement rules /// @@ -693,16 +712,13 @@ public virtual void Validate() { DataProtection.Validate(); } - if (CoolnessPeriod != null) + if (CoolnessPeriod > 63) { - if (CoolnessPeriod > 63) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "CoolnessPeriod", 63); - } - if (CoolnessPeriod < 7) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "CoolnessPeriod", 7); - } + throw new ValidationException(ValidationRules.InclusiveMaximum, "CoolnessPeriod", 63); + } + if (CoolnessPeriod < 7) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "CoolnessPeriod", 7); } if (UnixPermissions != null) { diff --git a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/VolumeGroupVolumeProperties.cs b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/VolumeGroupVolumeProperties.cs index 53b840eaf49a..9480468d01df 100644 --- a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/VolumeGroupVolumeProperties.cs +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/VolumeGroupVolumeProperties.cs @@ -123,11 +123,14 @@ public VolumeGroupVolumeProperties() /// Volume spec name is the application /// specific designation or identifier for the particular volume in a /// volume group for e.g. data, log + /// Specifies if the volume is encrypted or + /// not. Only available on volumes created or updated after + /// 2022-01-01. /// Volume placement rules /// Flag indicating whether subvolume /// operations are enabled on the volume. Possible values include: /// 'Enabled', 'Disabled' - public VolumeGroupVolumeProperties(string creationToken, long usageThreshold, string subnetId, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string fileSystemId = default(string), string serviceLevel = default(string), VolumePropertiesExportPolicy exportPolicy = default(VolumePropertiesExportPolicy), IList protocolTypes = default(IList), string provisioningState = default(string), string snapshotId = default(string), string backupId = default(string), string baremetalTenantId = default(string), string networkFeatures = default(string), string networkSiblingSetId = default(string), string storageToNetworkProximity = default(string), IList mountTargets = default(IList), string volumeType = default(string), VolumePropertiesDataProtection dataProtection = default(VolumePropertiesDataProtection), bool? isRestoring = default(bool?), bool? snapshotDirectoryVisible = default(bool?), bool? kerberosEnabled = default(bool?), string securityStyle = default(string), bool? smbEncryption = default(bool?), bool? smbContinuouslyAvailable = default(bool?), double? throughputMibps = default(double?), string encryptionKeySource = default(string), bool? ldapEnabled = default(bool?), bool? coolAccess = default(bool?), int? coolnessPeriod = default(int?), string unixPermissions = default(string), int? cloneProgress = default(int?), string avsDataStore = default(string), bool? isDefaultQuotaEnabled = default(bool?), long? defaultUserQuotaInKiBs = default(long?), long? defaultGroupQuotaInKiBs = default(long?), long? maximumNumberOfFiles = default(long?), string volumeGroupName = default(string), string capacityPoolResourceId = default(string), string proximityPlacementGroup = default(string), string t2Network = default(string), string volumeSpecName = default(string), IList placementRules = default(IList), string enableSubvolumes = default(string)) + public VolumeGroupVolumeProperties(string creationToken, long usageThreshold, string subnetId, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string fileSystemId = default(string), string serviceLevel = default(string), VolumePropertiesExportPolicy exportPolicy = default(VolumePropertiesExportPolicy), IList protocolTypes = default(IList), string provisioningState = default(string), string snapshotId = default(string), string backupId = default(string), string baremetalTenantId = default(string), string networkFeatures = default(string), string networkSiblingSetId = default(string), string storageToNetworkProximity = default(string), IList mountTargets = default(IList), string volumeType = default(string), VolumePropertiesDataProtection dataProtection = default(VolumePropertiesDataProtection), bool? isRestoring = default(bool?), bool? snapshotDirectoryVisible = default(bool?), bool? kerberosEnabled = default(bool?), string securityStyle = default(string), bool? smbEncryption = default(bool?), bool? smbContinuouslyAvailable = default(bool?), double? throughputMibps = default(double?), string encryptionKeySource = default(string), bool? ldapEnabled = default(bool?), bool? coolAccess = default(bool?), int? coolnessPeriod = default(int?), string unixPermissions = default(string), int? cloneProgress = default(int?), string avsDataStore = default(string), bool? isDefaultQuotaEnabled = default(bool?), long? defaultUserQuotaInKiBs = default(long?), long? defaultGroupQuotaInKiBs = default(long?), long? maximumNumberOfFiles = default(long?), string volumeGroupName = default(string), string capacityPoolResourceId = default(string), string proximityPlacementGroup = default(string), string t2Network = default(string), string volumeSpecName = default(string), bool? encrypted = default(bool?), IList placementRules = default(IList), string enableSubvolumes = default(string)) { Id = id; Name = name; @@ -173,6 +176,7 @@ public VolumeGroupVolumeProperties() ProximityPlacementGroup = proximityPlacementGroup; T2Network = t2Network; VolumeSpecName = volumeSpecName; + Encrypted = encrypted; PlacementRules = placementRules; EnableSubvolumes = enableSubvolumes; CustomInit(); @@ -534,6 +538,13 @@ public VolumeGroupVolumeProperties() [JsonProperty(PropertyName = "properties.volumeSpecName")] public string VolumeSpecName { get; set; } + /// + /// Gets specifies if the volume is encrypted or not. Only available on + /// volumes created or updated after 2022-01-01. + /// + [JsonProperty(PropertyName = "properties.encrypted")] + public bool? Encrypted { get; private set; } + /// /// Gets or sets volume placement rules /// @@ -664,16 +675,13 @@ public virtual void Validate() { DataProtection.Validate(); } - if (CoolnessPeriod != null) + if (CoolnessPeriod > 63) { - if (CoolnessPeriod > 63) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "CoolnessPeriod", 63); - } - if (CoolnessPeriod < 7) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "CoolnessPeriod", 7); - } + throw new ValidationException(ValidationRules.InclusiveMaximum, "CoolnessPeriod", 63); + } + if (CoolnessPeriod < 7) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "CoolnessPeriod", 7); } if (UnixPermissions != null) { diff --git a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/VolumePatch.cs b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/VolumePatch.cs index 5b79a43b59e5..2910f2374f5f 100644 --- a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/VolumePatch.cs +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/VolumePatch.cs @@ -205,16 +205,13 @@ public VolumePatch() /// public virtual void Validate() { - if (UsageThreshold != null) + if (UsageThreshold > 109951162777600) { - if (UsageThreshold > 109951162777600) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "UsageThreshold", 109951162777600); - } - if (UsageThreshold < 107374182400) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "UsageThreshold", 107374182400); - } + throw new ValidationException(ValidationRules.InclusiveMaximum, "UsageThreshold", 109951162777600); + } + if (UsageThreshold < 107374182400) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "UsageThreshold", 107374182400); } if (UnixPermissions != null) { diff --git a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/VolumeQuotaRule.cs b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/VolumeQuotaRule.cs new file mode 100644 index 000000000000..456517e2ecce --- /dev/null +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/VolumeQuotaRule.cs @@ -0,0 +1,151 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.NetApp.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Quota Rule of a Volume + /// + [Rest.Serialization.JsonTransformation] + public partial class VolumeQuotaRule : IResource + { + /// + /// Initializes a new instance of the VolumeQuotaRule class. + /// + public VolumeQuotaRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VolumeQuotaRule class. + /// + /// Resource location + /// Resource Id + /// Resource name + /// A unique read-only string that changes whenever + /// the resource is updated. + /// Resource type + /// Resource tags + /// Azure lifecycle management + /// Size of quota + /// quotaType + /// UserID/GroupID/SID based on the quota + /// target type. UserID and groupID can be found by running ‘id’ or + /// ‘getent’ command for the user or group and SID can be found by + /// running <wmic useraccount where name='user-name' get + /// sid> + /// The system meta data relating to this + /// resource. + public VolumeQuotaRule(string location = default(string), string id = default(string), string name = default(string), string etag = default(string), string type = default(string), IDictionary tags = default(IDictionary), string provisioningState = default(string), long? quotaSizeInKiBs = default(long?), string quotaType = default(string), string quotaTarget = default(string), SystemData systemData = default(SystemData)) + { + Location = location; + Id = id; + Name = name; + Etag = etag; + Type = type; + Tags = tags; + ProvisioningState = provisioningState; + QuotaSizeInKiBs = quotaSizeInKiBs; + QuotaType = quotaType; + QuotaTarget = quotaTarget; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource location + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets a unique read-only string that changes whenever the resource + /// is updated. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + + /// + /// Gets resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets azure lifecycle management + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets size of quota + /// + [JsonProperty(PropertyName = "properties.quotaSizeInKiBs")] + public long? QuotaSizeInKiBs { get; set; } + + /// + /// Gets or sets quotaType + /// + /// + /// Type of quota. Possible values include: 'DefaultUserQuota', + /// 'DefaultGroupQuota', 'IndividualUserQuota', 'IndividualGroupQuota' + /// + [JsonProperty(PropertyName = "properties.quotaType")] + public string QuotaType { get; set; } + + /// + /// Gets or sets userID/GroupID/SID based on the quota target type. + /// UserID and groupID can be found by running ‘id’ or ‘getent’ command + /// for the user or group and SID can be found by running &lt;wmic + /// useraccount where name='user-name' get sid&gt; + /// + [JsonProperty(PropertyName = "properties.quotaTarget")] + public string QuotaTarget { get; set; } + + /// + /// Gets the system meta data relating to this resource. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + } +} diff --git a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/VolumeRelocationProperties.cs b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/VolumeRelocationProperties.cs new file mode 100644 index 000000000000..f0728d848f56 --- /dev/null +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/VolumeRelocationProperties.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.NetApp.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Volume relocation properties + /// + public partial class VolumeRelocationProperties + { + /// + /// Initializes a new instance of the VolumeRelocationProperties class. + /// + public VolumeRelocationProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VolumeRelocationProperties class. + /// + /// The id of the old volume that is being + /// relocated + /// The id of the bare metal tenant + /// owned by the existing volume + /// Has relocation been requested for + /// this volume + public VolumeRelocationProperties(string oldVolumeId = default(string), string oldBareMetalTenantId = default(string), bool? relocationRequested = default(bool?)) + { + OldVolumeId = oldVolumeId; + OldBareMetalTenantId = oldBareMetalTenantId; + RelocationRequested = relocationRequested; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the id of the old volume that is being relocated + /// + [JsonProperty(PropertyName = "oldVolumeId")] + public string OldVolumeId { get; set; } + + /// + /// Gets or sets the id of the bare metal tenant owned by the existing + /// volume + /// + [JsonProperty(PropertyName = "oldBareMetalTenantId")] + public string OldBareMetalTenantId { get; set; } + + /// + /// Gets or sets has relocation been requested for this volume + /// + [JsonProperty(PropertyName = "relocationRequested")] + public bool? RelocationRequested { get; set; } + + } +} diff --git a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/NetAppResourceOperations.cs b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/NetAppResourceOperations.cs index 88b9e7cdbad4..8cfa9c5ae2b0 100644 --- a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/NetAppResourceOperations.cs +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/NetAppResourceOperations.cs @@ -747,5 +747,202 @@ internal NetAppResourceOperations(AzureNetAppFilesManagementClient client) return _result; } + /// + /// Describes region specific information. + /// + /// + /// Provides storage to network proximity and logical zone mapping information. + /// + /// + /// The location + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> QueryRegionInfoWithHttpMessagesAsync(string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "QueryRegionInfo", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfo").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + } } diff --git a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/NetAppResourceOperationsExtensions.cs b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/NetAppResourceOperationsExtensions.cs index 03af5547ccc3..ed59bfe50d9d 100644 --- a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/NetAppResourceOperationsExtensions.cs +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/NetAppResourceOperationsExtensions.cs @@ -207,5 +207,45 @@ public static CheckAvailabilityResponse CheckQuotaAvailability(this INetAppResou } } + /// + /// Describes region specific information. + /// + /// + /// Provides storage to network proximity and logical zone mapping information. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location + /// + public static RegionInfo QueryRegionInfo(this INetAppResourceOperations operations, string location) + { + return operations.QueryRegionInfoAsync(location).GetAwaiter().GetResult(); + } + + /// + /// Describes region specific information. + /// + /// + /// Provides storage to network proximity and logical zone mapping information. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location + /// + /// + /// The cancellation token. + /// + public static async Task QueryRegionInfoAsync(this INetAppResourceOperations operations, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.QueryRegionInfoWithHttpMessagesAsync(location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } } diff --git a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/SdkInfo_NetAppManagementClient.cs b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/SdkInfo_NetAppManagementClient.cs index b442e42dd1eb..1d38c41f86c8 100644 --- a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/SdkInfo_NetAppManagementClient.cs +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/SdkInfo_NetAppManagementClient.cs @@ -19,33 +19,23 @@ public static IEnumerable> ApiInfo_NetAppManagemen { return new Tuple[] { - new Tuple("NetApp", "AccountBackups", "2021-10-01"), - new Tuple("NetApp", "Accounts", "2021-10-01"), - new Tuple("NetApp", "BackupPolicies", "2021-10-01"), - new Tuple("NetApp", "Backups", "2021-10-01"), - new Tuple("NetApp", "NetAppResource", "2021-10-01"), - new Tuple("NetApp", "NetAppResourceQuotaLimits", "2021-10-01"), - new Tuple("NetApp", "Operations", "2021-10-01"), - new Tuple("NetApp", "Pools", "2021-10-01"), - new Tuple("NetApp", "SnapshotPolicies", "2021-10-01"), - new Tuple("NetApp", "Snapshots", "2021-10-01"), - new Tuple("NetApp", "Subvolumes", "2021-10-01"), - new Tuple("NetApp", "Vaults", "2021-10-01"), - new Tuple("NetApp", "VolumeGroups", "2021-10-01"), - new Tuple("NetApp", "Volumes", "2021-10-01"), + new Tuple("NetApp", "AccountBackups", "2022-01-01"), + new Tuple("NetApp", "Accounts", "2022-01-01"), + new Tuple("NetApp", "BackupPolicies", "2022-01-01"), + new Tuple("NetApp", "Backups", "2022-01-01"), + new Tuple("NetApp", "NetAppResource", "2022-01-01"), + new Tuple("NetApp", "NetAppResourceQuotaLimits", "2022-01-01"), + new Tuple("NetApp", "Operations", "2022-01-01"), + new Tuple("NetApp", "Pools", "2022-01-01"), + new Tuple("NetApp", "SnapshotPolicies", "2022-01-01"), + new Tuple("NetApp", "Snapshots", "2022-01-01"), + new Tuple("NetApp", "Subvolumes", "2022-01-01"), + new Tuple("NetApp", "Vaults", "2022-01-01"), + new Tuple("NetApp", "VolumeGroups", "2022-01-01"), + new Tuple("NetApp", "VolumeQuotaRules", "2022-01-01"), + new Tuple("NetApp", "Volumes", "2022-01-01"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "v2"; - public static readonly String AutoRestBootStrapperVersion = "autorest@3.5.1"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/main/specification/netapp/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --use:@microsoft.azure/autorest.csharp@2.3.90 --csharp-sdks-folder=C:\\Users\\audunn\\Source\\repos\\azure\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "main"; - public static readonly String GithubCommidId = "4c50e693e709f9a88ed342abfdb54a67ed901ba5"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/VolumeQuotaRulesOperations.cs b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/VolumeQuotaRulesOperations.cs new file mode 100644 index 000000000000..b00491458c57 --- /dev/null +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/VolumeQuotaRulesOperations.cs @@ -0,0 +1,1550 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.NetApp +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VolumeQuotaRulesOperations operations. + /// + internal partial class VolumeQuotaRulesOperations : IServiceOperations, IVolumeQuotaRulesOperations + { + /// + /// Initializes a new instance of the VolumeQuotaRulesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VolumeQuotaRulesOperations(AzureNetAppFilesManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureNetAppFilesManagementClient + /// + public AzureNetAppFilesManagementClient Client { get; private set; } + + /// + /// Get all quota rules for a volume + /// + /// + /// List all quota rules associated with the volume + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByVolumeWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (poolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "poolName"); + } + if (poolName != null) + { + if (poolName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "poolName", 64); + } + if (poolName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "poolName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(poolName, "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,63}$")) + { + throw new ValidationException(ValidationRules.Pattern, "poolName", "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,63}$"); + } + } + if (volumeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "volumeName"); + } + if (volumeName != null) + { + if (volumeName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "volumeName", 64); + } + if (volumeName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "volumeName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(volumeName, "^[a-zA-Z][a-zA-Z0-9\\-_]{0,63}$")) + { + throw new ValidationException(ValidationRules.Pattern, "volumeName", "^[a-zA-Z][a-zA-Z0-9\\-_]{0,63}$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("poolName", poolName); + tracingParameters.Add("volumeName", volumeName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByVolume", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{poolName}", System.Uri.EscapeDataString(poolName)); + _url = _url.Replace("{volumeName}", System.Uri.EscapeDataString(volumeName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Describe a quota rule + /// + /// + /// Get details of the specified quota rule + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The name of volume quota rule + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (poolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "poolName"); + } + if (poolName != null) + { + if (poolName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "poolName", 64); + } + if (poolName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "poolName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(poolName, "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,63}$")) + { + throw new ValidationException(ValidationRules.Pattern, "poolName", "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,63}$"); + } + } + if (volumeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "volumeName"); + } + if (volumeName != null) + { + if (volumeName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "volumeName", 64); + } + if (volumeName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "volumeName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(volumeName, "^[a-zA-Z][a-zA-Z0-9\\-_]{0,63}$")) + { + throw new ValidationException(ValidationRules.Pattern, "volumeName", "^[a-zA-Z][a-zA-Z0-9\\-_]{0,63}$"); + } + } + if (volumeQuotaRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "volumeQuotaRuleName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("poolName", poolName); + tracingParameters.Add("volumeName", volumeName); + tracingParameters.Add("volumeQuotaRuleName", volumeQuotaRuleName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{poolName}", System.Uri.EscapeDataString(poolName)); + _url = _url.Replace("{volumeName}", System.Uri.EscapeDataString(volumeName)); + _url = _url.Replace("{volumeQuotaRuleName}", System.Uri.EscapeDataString(volumeQuotaRuleName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create a quota rule + /// + /// + /// Create the specified quota rule within the given volume + /// + /// + /// Quota rule object supplied in the body of the operation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The name of volume quota rule + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(VolumeQuotaRule body, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(body, resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update a quota rule + /// + /// + /// Patch a quota rule + /// + /// + /// Quota rule object supplied in the body of the operation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The name of volume quota rule + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(VolumeQuotaRule body, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(body, resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete a quota rule + /// + /// + /// Delete quota rule + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The name of volume quota rule + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create a quota rule + /// + /// + /// Create the specified quota rule within the given volume + /// + /// + /// Quota rule object supplied in the body of the operation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The name of volume quota rule + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateWithHttpMessagesAsync(VolumeQuotaRule body, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (poolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "poolName"); + } + if (poolName != null) + { + if (poolName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "poolName", 64); + } + if (poolName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "poolName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(poolName, "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,63}$")) + { + throw new ValidationException(ValidationRules.Pattern, "poolName", "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,63}$"); + } + } + if (volumeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "volumeName"); + } + if (volumeName != null) + { + if (volumeName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "volumeName", 64); + } + if (volumeName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "volumeName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(volumeName, "^[a-zA-Z][a-zA-Z0-9\\-_]{0,63}$")) + { + throw new ValidationException(ValidationRules.Pattern, "volumeName", "^[a-zA-Z][a-zA-Z0-9\\-_]{0,63}$"); + } + } + if (volumeQuotaRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "volumeQuotaRuleName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("poolName", poolName); + tracingParameters.Add("volumeName", volumeName); + tracingParameters.Add("volumeQuotaRuleName", volumeQuotaRuleName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{poolName}", System.Uri.EscapeDataString(poolName)); + _url = _url.Replace("{volumeName}", System.Uri.EscapeDataString(volumeName)); + _url = _url.Replace("{volumeQuotaRuleName}", System.Uri.EscapeDataString(volumeQuotaRuleName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 201 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update a quota rule + /// + /// + /// Patch a quota rule + /// + /// + /// Quota rule object supplied in the body of the operation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The name of volume quota rule + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(VolumeQuotaRule body, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (poolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "poolName"); + } + if (poolName != null) + { + if (poolName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "poolName", 64); + } + if (poolName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "poolName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(poolName, "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,63}$")) + { + throw new ValidationException(ValidationRules.Pattern, "poolName", "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,63}$"); + } + } + if (volumeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "volumeName"); + } + if (volumeName != null) + { + if (volumeName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "volumeName", 64); + } + if (volumeName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "volumeName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(volumeName, "^[a-zA-Z][a-zA-Z0-9\\-_]{0,63}$")) + { + throw new ValidationException(ValidationRules.Pattern, "volumeName", "^[a-zA-Z][a-zA-Z0-9\\-_]{0,63}$"); + } + } + if (volumeQuotaRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "volumeQuotaRuleName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("poolName", poolName); + tracingParameters.Add("volumeName", volumeName); + tracingParameters.Add("volumeQuotaRuleName", volumeQuotaRuleName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{poolName}", System.Uri.EscapeDataString(poolName)); + _url = _url.Replace("{volumeName}", System.Uri.EscapeDataString(volumeName)); + _url = _url.Replace("{volumeQuotaRuleName}", System.Uri.EscapeDataString(volumeQuotaRuleName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete a quota rule + /// + /// + /// Delete quota rule + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The name of volume quota rule + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (poolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "poolName"); + } + if (poolName != null) + { + if (poolName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "poolName", 64); + } + if (poolName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "poolName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(poolName, "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,63}$")) + { + throw new ValidationException(ValidationRules.Pattern, "poolName", "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,63}$"); + } + } + if (volumeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "volumeName"); + } + if (volumeName != null) + { + if (volumeName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "volumeName", 64); + } + if (volumeName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "volumeName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(volumeName, "^[a-zA-Z][a-zA-Z0-9\\-_]{0,63}$")) + { + throw new ValidationException(ValidationRules.Pattern, "volumeName", "^[a-zA-Z][a-zA-Z0-9\\-_]{0,63}$"); + } + } + if (volumeQuotaRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "volumeQuotaRuleName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("poolName", poolName); + tracingParameters.Add("volumeName", volumeName); + tracingParameters.Add("volumeQuotaRuleName", volumeQuotaRuleName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{poolName}", System.Uri.EscapeDataString(poolName)); + _url = _url.Replace("{volumeName}", System.Uri.EscapeDataString(volumeName)); + _url = _url.Replace("{volumeQuotaRuleName}", System.Uri.EscapeDataString(volumeQuotaRuleName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/VolumeQuotaRulesOperationsExtensions.cs b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/VolumeQuotaRulesOperationsExtensions.cs new file mode 100644 index 000000000000..2f7049457db8 --- /dev/null +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/VolumeQuotaRulesOperationsExtensions.cs @@ -0,0 +1,551 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.NetApp +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for VolumeQuotaRulesOperations. + /// + public static partial class VolumeQuotaRulesOperationsExtensions + { + /// + /// Get all quota rules for a volume + /// + /// + /// List all quota rules associated with the volume + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + public static IEnumerable ListByVolume(this IVolumeQuotaRulesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName) + { + return operations.ListByVolumeAsync(resourceGroupName, accountName, poolName, volumeName).GetAwaiter().GetResult(); + } + + /// + /// Get all quota rules for a volume + /// + /// + /// List all quota rules associated with the volume + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The cancellation token. + /// + public static async Task> ListByVolumeAsync(this IVolumeQuotaRulesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByVolumeWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Describe a quota rule + /// + /// + /// Get details of the specified quota rule + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The name of volume quota rule + /// + public static VolumeQuotaRule Get(this IVolumeQuotaRulesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName) + { + return operations.GetAsync(resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName).GetAwaiter().GetResult(); + } + + /// + /// Describe a quota rule + /// + /// + /// Get details of the specified quota rule + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The name of volume quota rule + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IVolumeQuotaRulesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create a quota rule + /// + /// + /// Create the specified quota rule within the given volume + /// + /// + /// The operations group for this extension method. + /// + /// + /// Quota rule object supplied in the body of the operation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The name of volume quota rule + /// + public static VolumeQuotaRule Create(this IVolumeQuotaRulesOperations operations, VolumeQuotaRule body, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName) + { + return operations.CreateAsync(body, resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName).GetAwaiter().GetResult(); + } + + /// + /// Create a quota rule + /// + /// + /// Create the specified quota rule within the given volume + /// + /// + /// The operations group for this extension method. + /// + /// + /// Quota rule object supplied in the body of the operation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The name of volume quota rule + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IVolumeQuotaRulesOperations operations, VolumeQuotaRule body, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(body, resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a quota rule + /// + /// + /// Patch a quota rule + /// + /// + /// The operations group for this extension method. + /// + /// + /// Quota rule object supplied in the body of the operation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The name of volume quota rule + /// + public static VolumeQuotaRule Update(this IVolumeQuotaRulesOperations operations, VolumeQuotaRule body, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName) + { + return operations.UpdateAsync(body, resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName).GetAwaiter().GetResult(); + } + + /// + /// Update a quota rule + /// + /// + /// Patch a quota rule + /// + /// + /// The operations group for this extension method. + /// + /// + /// Quota rule object supplied in the body of the operation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The name of volume quota rule + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IVolumeQuotaRulesOperations operations, VolumeQuotaRule body, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(body, resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a quota rule + /// + /// + /// Delete quota rule + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The name of volume quota rule + /// + public static void Delete(this IVolumeQuotaRulesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName) + { + operations.DeleteAsync(resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName).GetAwaiter().GetResult(); + } + + /// + /// Delete a quota rule + /// + /// + /// Delete quota rule + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The name of volume quota rule + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IVolumeQuotaRulesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Create a quota rule + /// + /// + /// Create the specified quota rule within the given volume + /// + /// + /// The operations group for this extension method. + /// + /// + /// Quota rule object supplied in the body of the operation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The name of volume quota rule + /// + public static VolumeQuotaRule BeginCreate(this IVolumeQuotaRulesOperations operations, VolumeQuotaRule body, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName) + { + return operations.BeginCreateAsync(body, resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName).GetAwaiter().GetResult(); + } + + /// + /// Create a quota rule + /// + /// + /// Create the specified quota rule within the given volume + /// + /// + /// The operations group for this extension method. + /// + /// + /// Quota rule object supplied in the body of the operation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The name of volume quota rule + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this IVolumeQuotaRulesOperations operations, VolumeQuotaRule body, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(body, resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a quota rule + /// + /// + /// Patch a quota rule + /// + /// + /// The operations group for this extension method. + /// + /// + /// Quota rule object supplied in the body of the operation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The name of volume quota rule + /// + public static VolumeQuotaRule BeginUpdate(this IVolumeQuotaRulesOperations operations, VolumeQuotaRule body, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName) + { + return operations.BeginUpdateAsync(body, resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName).GetAwaiter().GetResult(); + } + + /// + /// Update a quota rule + /// + /// + /// Patch a quota rule + /// + /// + /// The operations group for this extension method. + /// + /// + /// Quota rule object supplied in the body of the operation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The name of volume quota rule + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IVolumeQuotaRulesOperations operations, VolumeQuotaRule body, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(body, resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a quota rule + /// + /// + /// Delete quota rule + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The name of volume quota rule + /// + public static void BeginDelete(this IVolumeQuotaRulesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName) + { + operations.BeginDeleteAsync(resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName).GetAwaiter().GetResult(); + } + + /// + /// Delete a quota rule + /// + /// + /// Delete quota rule + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The name of volume quota rule + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IVolumeQuotaRulesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/VolumesOperations.cs b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/VolumesOperations.cs index 15916d521f8c..a3887dcf50e4 100644 --- a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/VolumesOperations.cs +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/VolumesOperations.cs @@ -701,6 +701,37 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } + /// + /// Reset cifs password + /// + /// + /// Reset cifs password from volume + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ResetCifsPasswordWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginResetCifsPasswordWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + /// /// Break volume replication /// @@ -1005,178 +1036,11 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) } /// - /// Resync volume replication - /// - /// - /// Resync the connection on the destination volume. If the operation is ran on - /// the source volume it will reverse-resync the connection and sync from - /// destination to source. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the NetApp account - /// - /// - /// The name of the capacity pool - /// - /// - /// The name of the volume - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task ResyncReplicationWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginResyncReplicationWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Delete volume replication - /// - /// - /// Delete the replication connection on the destination volume, and send - /// release to the source replication - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the NetApp account - /// - /// - /// The name of the capacity pool - /// - /// - /// The name of the volume - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task DeleteReplicationWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginDeleteReplicationWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Authorize source volume replication - /// - /// - /// Authorize the replication connection on the source volume - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the NetApp account - /// - /// - /// The name of the capacity pool - /// - /// - /// The name of the volume - /// - /// - /// Authorize request object supplied in the body of the operation. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task AuthorizeReplicationWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, AuthorizeRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginAuthorizeReplicationWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, body, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// ReInitialize volume replication - /// - /// - /// Re-Initializes the replication connection on the destination volume - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the NetApp account - /// - /// - /// The name of the capacity pool - /// - /// - /// The name of the volume - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task ReInitializeReplicationWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginReInitializeReplicationWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Change pool for volume - /// - /// - /// Moves volume to another pool - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the NetApp account - /// - /// - /// The name of the capacity pool - /// - /// - /// The name of the volume - /// - /// - /// Move volume to the pool supplied in the body of the operation. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task PoolChangeWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, PoolChangeRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginPoolChangeWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, body, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Create or Update a volume + /// List replications for volume /// /// - /// Create or update the specified volume within the capacity pool + /// List all replications for a specified volume /// - /// - /// Volume object supplied in the body of the operation. - /// /// /// The name of the resource group. /// @@ -1210,16 +1074,1639 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(Volume body, string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListReplicationsMethodWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (body == null) + if (Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "body"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (body != null) + if (resourceGroupName == null) { - body.Validate(); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); } + if (poolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "poolName"); + } + if (poolName != null) + { + if (poolName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "poolName", 64); + } + if (poolName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "poolName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(poolName, "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,63}$")) + { + throw new ValidationException(ValidationRules.Pattern, "poolName", "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,63}$"); + } + } + if (volumeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "volumeName"); + } + if (volumeName != null) + { + if (volumeName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "volumeName", 64); + } + if (volumeName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "volumeName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(volumeName, "^[a-zA-Z][a-zA-Z0-9\\-_]{0,63}$")) + { + throw new ValidationException(ValidationRules.Pattern, "volumeName", "^[a-zA-Z][a-zA-Z0-9\\-_]{0,63}$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("poolName", poolName); + tracingParameters.Add("volumeName", volumeName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListReplicationsMethod", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/listReplications").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{poolName}", System.Uri.EscapeDataString(poolName)); + _url = _url.Replace("{volumeName}", System.Uri.EscapeDataString(volumeName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Resync volume replication + /// + /// + /// Resync the connection on the destination volume. If the operation is ran on + /// the source volume it will reverse-resync the connection and sync from + /// destination to source. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ResyncReplicationWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginResyncReplicationWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete volume replication + /// + /// + /// Delete the replication connection on the destination volume, and send + /// release to the source replication + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteReplicationWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteReplicationWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Authorize source volume replication + /// + /// + /// Authorize the replication connection on the source volume + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// Authorize request object supplied in the body of the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task AuthorizeReplicationWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, AuthorizeRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginAuthorizeReplicationWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// ReInitialize volume replication + /// + /// + /// Re-Initializes the replication connection on the destination volume + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ReInitializeReplicationWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginReInitializeReplicationWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Change pool for volume + /// + /// + /// Moves volume to another pool + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// Move volume to the pool supplied in the body of the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task PoolChangeWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, PoolChangeRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginPoolChangeWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Relocate volume + /// + /// + /// Relocates volume to a new stamp + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RelocateWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRelocateWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Finalize volume relocation + /// + /// + /// Finalizes the relocation of the volume and cleans up the old volume. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task FinalizeRelocationWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginFinalizeRelocationWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Revert volume relocation + /// + /// + /// Reverts the volume relocation process, cleans up the new volume and starts + /// using the former-existing volume. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RevertRelocationWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRevertRelocationWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create or Update a volume + /// + /// + /// Create or update the specified volume within the capacity pool + /// + /// + /// Volume object supplied in the body of the operation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(Volume body, string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (poolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "poolName"); + } + if (poolName != null) + { + if (poolName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "poolName", 64); + } + if (poolName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "poolName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(poolName, "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,63}$")) + { + throw new ValidationException(ValidationRules.Pattern, "poolName", "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,63}$"); + } + } + if (volumeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "volumeName"); + } + if (volumeName != null) + { + if (volumeName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "volumeName", 64); + } + if (volumeName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "volumeName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(volumeName, "^[a-zA-Z][a-zA-Z0-9\\-_]{0,63}$")) + { + throw new ValidationException(ValidationRules.Pattern, "volumeName", "^[a-zA-Z][a-zA-Z0-9\\-_]{0,63}$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("poolName", poolName); + tracingParameters.Add("volumeName", volumeName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{poolName}", System.Uri.EscapeDataString(poolName)); + _url = _url.Replace("{volumeName}", System.Uri.EscapeDataString(volumeName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update a volume + /// + /// + /// Patch the specified volume + /// + /// + /// Volume object supplied in the body of the operation. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(VolumePatch body, string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (poolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "poolName"); + } + if (poolName != null) + { + if (poolName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "poolName", 64); + } + if (poolName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "poolName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(poolName, "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,63}$")) + { + throw new ValidationException(ValidationRules.Pattern, "poolName", "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,63}$"); + } + } + if (volumeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "volumeName"); + } + if (volumeName != null) + { + if (volumeName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "volumeName", 64); + } + if (volumeName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "volumeName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(volumeName, "^[a-zA-Z][a-zA-Z0-9\\-_]{0,63}$")) + { + throw new ValidationException(ValidationRules.Pattern, "volumeName", "^[a-zA-Z][a-zA-Z0-9\\-_]{0,63}$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("body", body); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("poolName", poolName); + tracingParameters.Add("volumeName", volumeName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{poolName}", System.Uri.EscapeDataString(poolName)); + _url = _url.Replace("{volumeName}", System.Uri.EscapeDataString(volumeName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete a volume + /// + /// + /// Delete the specified volume + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// An option to force delete the volume. Will cleanup resources connected to + /// the particular volume + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, bool? forceDelete = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (poolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "poolName"); + } + if (poolName != null) + { + if (poolName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "poolName", 64); + } + if (poolName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "poolName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(poolName, "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,63}$")) + { + throw new ValidationException(ValidationRules.Pattern, "poolName", "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,63}$"); + } + } + if (volumeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "volumeName"); + } + if (volumeName != null) + { + if (volumeName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "volumeName", 64); + } + if (volumeName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "volumeName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(volumeName, "^[a-zA-Z][a-zA-Z0-9\\-_]{0,63}$")) + { + throw new ValidationException(ValidationRules.Pattern, "volumeName", "^[a-zA-Z][a-zA-Z0-9\\-_]{0,63}$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("poolName", poolName); + tracingParameters.Add("volumeName", volumeName); + tracingParameters.Add("forceDelete", forceDelete); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{poolName}", System.Uri.EscapeDataString(poolName)); + _url = _url.Replace("{volumeName}", System.Uri.EscapeDataString(volumeName)); + List _queryParameters = new List(); + if (forceDelete != null) + { + _queryParameters.Add(string.Format("forceDelete={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(forceDelete, Client.SerializationSettings).Trim('"')))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Revert a volume to one of its snapshots + /// + /// + /// Revert a volume to the snapshot specified in the body + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// Object for snapshot to revert supplied in the body of the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginRevertWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, VolumeRevert body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (poolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "poolName"); + } + if (poolName != null) + { + if (poolName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "poolName", 64); + } + if (poolName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "poolName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(poolName, "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,63}$")) + { + throw new ValidationException(ValidationRules.Pattern, "poolName", "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,63}$"); + } + } + if (volumeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "volumeName"); + } + if (volumeName != null) + { + if (volumeName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "volumeName", 64); + } + if (volumeName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "volumeName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(volumeName, "^[a-zA-Z][a-zA-Z0-9\\-_]{0,63}$")) + { + throw new ValidationException(ValidationRules.Pattern, "volumeName", "^[a-zA-Z][a-zA-Z0-9\\-_]{0,63}$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("poolName", poolName); + tracingParameters.Add("volumeName", volumeName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRevert", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revert").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{poolName}", System.Uri.EscapeDataString(poolName)); + _url = _url.Replace("{volumeName}", System.Uri.EscapeDataString(volumeName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Reset cifs password + /// + /// + /// Reset cifs password from volume + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginResetCifsPasswordWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -1303,17 +2790,16 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("body", body); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("accountName", accountName); tracingParameters.Add("poolName", poolName); tracingParameters.Add("volumeName", volumeName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginResetCifsPassword", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resetCifsPassword").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); @@ -1331,7 +2817,7 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1362,12 +2848,6 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) // Serialize Request string _requestContent = null; - if(body != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -1388,7 +2868,7 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1423,49 +2903,13 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -1474,14 +2918,11 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) } /// - /// Update a volume + /// Break volume replication /// /// - /// Patch the specified volume + /// Break the replication connection on the destination volume /// - /// - /// Volume object supplied in the body of the operation. - /// /// /// The name of the resource group. /// @@ -1494,6 +2935,9 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) /// /// The name of the volume /// + /// + /// Optional body to force break the replication. + /// /// /// Headers that will be added to request. /// @@ -1503,9 +2947,6 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// @@ -1515,12 +2956,8 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginUpdateWithHttpMessagesAsync(VolumePatch body, string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginBreakReplicationWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, BreakReplicationRequest body = default(BreakReplicationRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (body == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "body"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -1604,17 +3041,17 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("body", body); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("accountName", accountName); tracingParameters.Add("poolName", poolName); tracingParameters.Add("volumeName", volumeName); + tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginBreakReplication", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/breakReplication").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); @@ -1632,7 +3069,7 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1724,31 +3161,13 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -1757,10 +3176,12 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) } /// - /// Delete a volume + /// Resync volume replication /// /// - /// Delete the specified volume + /// Resync the connection on the destination volume. If the operation is ran on + /// the source volume it will reverse-resync the connection and sync from + /// destination to source. /// /// /// The name of the resource group. @@ -1774,10 +3195,6 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) /// /// The name of the volume /// - /// - /// An option to force delete the volume. Will cleanup resources connected to - /// the particular volume - /// /// /// Headers that will be added to request. /// @@ -1796,7 +3213,7 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, bool? forceDelete = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginResyncReplicationWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -1885,23 +3302,18 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) tracingParameters.Add("accountName", accountName); tracingParameters.Add("poolName", poolName); tracingParameters.Add("volumeName", volumeName); - tracingParameters.Add("forceDelete", forceDelete); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginResyncReplication", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resyncReplication").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); _url = _url.Replace("{poolName}", System.Uri.EscapeDataString(poolName)); _url = _url.Replace("{volumeName}", System.Uri.EscapeDataString(volumeName)); List _queryParameters = new List(); - if (forceDelete != null) - { - _queryParameters.Add(string.Format("forceDelete={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(forceDelete, Client.SerializationSettings).Trim('"')))); - } if (Client.ApiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); @@ -1913,7 +3325,7 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1964,7 +3376,7 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 202 && (int)_statusCode != 204) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -2014,10 +3426,11 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) } /// - /// Revert a volume to one of its snapshots + /// Delete volume replication /// /// - /// Revert a volume to the snapshot specified in the body + /// Delete the replication connection on the destination volume, and send + /// release to the source replication /// /// /// The name of the resource group. @@ -2031,9 +3444,6 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) /// /// The name of the volume /// - /// - /// Object for snapshot to revert supplied in the body of the operation. - /// /// /// Headers that will be added to request. /// @@ -2052,7 +3462,7 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginRevertWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, VolumeRevert body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginDeleteReplicationWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -2130,10 +3540,6 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); } } - if (body == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "body"); - } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2145,13 +3551,12 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) tracingParameters.Add("accountName", accountName); tracingParameters.Add("poolName", poolName); tracingParameters.Add("volumeName", volumeName); - tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginRevert", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginDeleteReplication", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revert").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/deleteReplication").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); @@ -2200,12 +3605,6 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) // Serialize Request string _requestContent = null; - if(body != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -2276,10 +3675,10 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) } /// - /// Break volume replication + /// Authorize source volume replication /// /// - /// Break the replication connection on the destination volume + /// Authorize the replication connection on the source volume /// /// /// The name of the resource group. @@ -2294,7 +3693,7 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) /// The name of the volume /// /// - /// Optional body to force break the replication. + /// Authorize request object supplied in the body of the operation. /// /// /// Headers that will be added to request. @@ -2314,7 +3713,7 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginBreakReplicationWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, BreakReplicationRequest body = default(BreakReplicationRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginAuthorizeReplicationWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, AuthorizeRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -2392,6 +3791,10 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); } } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2405,11 +3808,11 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) tracingParameters.Add("volumeName", volumeName); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginBreakReplication", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginAuthorizeReplication", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/breakReplication").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/authorizeReplication").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); @@ -2534,12 +3937,10 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) } /// - /// Resync volume replication + /// ReInitialize volume replication /// /// - /// Resync the connection on the destination volume. If the operation is ran on - /// the source volume it will reverse-resync the connection and sync from - /// destination to source. + /// Re-Initializes the replication connection on the destination volume /// /// /// The name of the resource group. @@ -2571,7 +3972,7 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginResyncReplicationWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginReInitializeReplicationWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -2661,11 +4062,11 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) tracingParameters.Add("poolName", poolName); tracingParameters.Add("volumeName", volumeName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginResyncReplication", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginReInitializeReplication", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resyncReplication").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reinitializeReplication").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); @@ -2784,11 +4185,10 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) } /// - /// Delete volume replication + /// Change pool for volume /// /// - /// Delete the replication connection on the destination volume, and send - /// release to the source replication + /// Moves volume to another pool /// /// /// The name of the resource group. @@ -2802,6 +4202,9 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) /// /// The name of the volume /// + /// + /// Move volume to the pool supplied in the body of the operation. + /// /// /// Headers that will be added to request. /// @@ -2820,7 +4223,7 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteReplicationWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginPoolChangeWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, PoolChangeRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -2898,6 +4301,14 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); } } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + if (body != null) + { + body.Validate(); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2909,12 +4320,13 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) tracingParameters.Add("accountName", accountName); tracingParameters.Add("poolName", poolName); tracingParameters.Add("volumeName", volumeName); + tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDeleteReplication", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginPoolChange", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/deleteReplication").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/poolChange").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); @@ -2963,6 +4375,12 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) // Serialize Request string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -3033,10 +4451,10 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) } /// - /// Authorize source volume replication + /// Relocate volume /// /// - /// Authorize the replication connection on the source volume + /// Relocates volume to a new stamp /// /// /// The name of the resource group. @@ -3050,9 +4468,6 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) /// /// The name of the volume /// - /// - /// Authorize request object supplied in the body of the operation. - /// /// /// Headers that will be added to request. /// @@ -3071,7 +4486,7 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginAuthorizeReplicationWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, AuthorizeRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginRelocateWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -3149,10 +4564,6 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); } } - if (body == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "body"); - } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3164,13 +4575,12 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) tracingParameters.Add("accountName", accountName); tracingParameters.Add("poolName", poolName); tracingParameters.Add("volumeName", volumeName); - tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginAuthorizeReplication", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginRelocate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/authorizeReplication").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/relocate").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); @@ -3219,12 +4629,6 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) // Serialize Request string _requestContent = null; - if(body != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -3295,10 +4699,10 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) } /// - /// ReInitialize volume replication + /// Finalize volume relocation /// /// - /// Re-Initializes the replication connection on the destination volume + /// Finalizes the relocation of the volume and cleans up the old volume. /// /// /// The name of the resource group. @@ -3330,7 +4734,7 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginReInitializeReplicationWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginFinalizeRelocationWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -3420,11 +4824,11 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) tracingParameters.Add("poolName", poolName); tracingParameters.Add("volumeName", volumeName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginReInitializeReplication", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginFinalizeRelocation", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reinitializeReplication").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/finalizeRelocation").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); @@ -3543,10 +4947,11 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) } /// - /// Change pool for volume + /// Revert volume relocation /// /// - /// Moves volume to another pool + /// Reverts the volume relocation process, cleans up the new volume and starts + /// using the former-existing volume. /// /// /// The name of the resource group. @@ -3560,9 +4965,6 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) /// /// The name of the volume /// - /// - /// Move volume to the pool supplied in the body of the operation. - /// /// /// Headers that will be added to request. /// @@ -3581,7 +4983,7 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginPoolChangeWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, PoolChangeRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginRevertRelocationWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -3659,14 +5061,6 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); } } - if (body == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "body"); - } - if (body != null) - { - body.Validate(); - } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3678,13 +5072,12 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) tracingParameters.Add("accountName", accountName); tracingParameters.Add("poolName", poolName); tracingParameters.Add("volumeName", volumeName); - tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginPoolChange", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginRevertRelocation", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/poolChange").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revertRelocation").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); @@ -3733,12 +5126,6 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) // Serialize Request string _requestContent = null; - if(body != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { diff --git a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/VolumesOperationsExtensions.cs b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/VolumesOperationsExtensions.cs index d9e64cc0bfdb..5aae5152b7d5 100644 --- a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/VolumesOperationsExtensions.cs +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/VolumesOperationsExtensions.cs @@ -383,6 +383,61 @@ public static void Revert(this IVolumesOperations operations, string resourceGro (await operations.RevertWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Reset cifs password + /// + /// + /// Reset cifs password from volume + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + public static void ResetCifsPassword(this IVolumesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName) + { + operations.ResetCifsPasswordAsync(resourceGroupName, accountName, poolName, volumeName).GetAwaiter().GetResult(); + } + + /// + /// Reset cifs password + /// + /// + /// Reset cifs password from volume + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The cancellation token. + /// + public static async Task ResetCifsPasswordAsync(this IVolumesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ResetCifsPasswordWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Break volume replication /// @@ -502,6 +557,64 @@ public static ReplicationStatus ReplicationStatusMethod(this IVolumesOperations } } + /// + /// List replications for volume + /// + /// + /// List all replications for a specified volume + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + public static ListReplications ListReplicationsMethod(this IVolumesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName) + { + return operations.ListReplicationsMethodAsync(resourceGroupName, accountName, poolName, volumeName).GetAwaiter().GetResult(); + } + + /// + /// List replications for volume + /// + /// + /// List all replications for a specified volume + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The cancellation token. + /// + public static async Task ListReplicationsMethodAsync(this IVolumesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListReplicationsMethodWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Resync volume replication /// @@ -795,6 +908,173 @@ public static void PoolChange(this IVolumesOperations operations, string resourc (await operations.PoolChangeWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Relocate volume + /// + /// + /// Relocates volume to a new stamp + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + public static void Relocate(this IVolumesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName) + { + operations.RelocateAsync(resourceGroupName, accountName, poolName, volumeName).GetAwaiter().GetResult(); + } + + /// + /// Relocate volume + /// + /// + /// Relocates volume to a new stamp + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The cancellation token. + /// + public static async Task RelocateAsync(this IVolumesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RelocateWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Finalize volume relocation + /// + /// + /// Finalizes the relocation of the volume and cleans up the old volume. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + public static void FinalizeRelocation(this IVolumesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName) + { + operations.FinalizeRelocationAsync(resourceGroupName, accountName, poolName, volumeName).GetAwaiter().GetResult(); + } + + /// + /// Finalize volume relocation + /// + /// + /// Finalizes the relocation of the volume and cleans up the old volume. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The cancellation token. + /// + public static async Task FinalizeRelocationAsync(this IVolumesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.FinalizeRelocationWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Revert volume relocation + /// + /// + /// Reverts the volume relocation process, cleans up the new volume and starts + /// using the former-existing volume. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + public static void RevertRelocation(this IVolumesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName) + { + operations.RevertRelocationAsync(resourceGroupName, accountName, poolName, volumeName).GetAwaiter().GetResult(); + } + + /// + /// Revert volume relocation + /// + /// + /// Reverts the volume relocation process, cleans up the new volume and starts + /// using the former-existing volume. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The cancellation token. + /// + public static async Task RevertRelocationAsync(this IVolumesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RevertRelocationWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Create or Update a volume /// @@ -1047,6 +1327,61 @@ public static void BeginRevert(this IVolumesOperations operations, string resour (await operations.BeginRevertWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Reset cifs password + /// + /// + /// Reset cifs password from volume + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + public static void BeginResetCifsPassword(this IVolumesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName) + { + operations.BeginResetCifsPasswordAsync(resourceGroupName, accountName, poolName, volumeName).GetAwaiter().GetResult(); + } + + /// + /// Reset cifs password + /// + /// + /// Reset cifs password from volume + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The cancellation token. + /// + public static async Task BeginResetCifsPasswordAsync(this IVolumesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginResetCifsPasswordWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Break volume replication /// @@ -1401,6 +1736,173 @@ public static void BeginPoolChange(this IVolumesOperations operations, string re (await operations.BeginPoolChangeWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, body, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Relocate volume + /// + /// + /// Relocates volume to a new stamp + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + public static void BeginRelocate(this IVolumesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName) + { + operations.BeginRelocateAsync(resourceGroupName, accountName, poolName, volumeName).GetAwaiter().GetResult(); + } + + /// + /// Relocate volume + /// + /// + /// Relocates volume to a new stamp + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The cancellation token. + /// + public static async Task BeginRelocateAsync(this IVolumesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRelocateWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Finalize volume relocation + /// + /// + /// Finalizes the relocation of the volume and cleans up the old volume. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + public static void BeginFinalizeRelocation(this IVolumesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName) + { + operations.BeginFinalizeRelocationAsync(resourceGroupName, accountName, poolName, volumeName).GetAwaiter().GetResult(); + } + + /// + /// Finalize volume relocation + /// + /// + /// Finalizes the relocation of the volume and cleans up the old volume. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The cancellation token. + /// + public static async Task BeginFinalizeRelocationAsync(this IVolumesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginFinalizeRelocationWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Revert volume relocation + /// + /// + /// Reverts the volume relocation process, cleans up the new volume and starts + /// using the former-existing volume. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + public static void BeginRevertRelocation(this IVolumesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName) + { + operations.BeginRevertRelocationAsync(resourceGroupName, accountName, poolName, volumeName).GetAwaiter().GetResult(); + } + + /// + /// Revert volume relocation + /// + /// + /// Reverts the volume relocation process, cleans up the new volume and starts + /// using the former-existing volume. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the NetApp account + /// + /// + /// The name of the capacity pool + /// + /// + /// The name of the volume + /// + /// + /// The cancellation token. + /// + public static async Task BeginRevertRelocationAsync(this IVolumesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRevertRelocationWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Describe all volumes ///