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 f8459015189f..a2f5108d1d45 100644 --- a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/AzureNetAppFilesManagementClient.cs +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/AzureNetAppFilesManagementClient.cs @@ -360,7 +360,7 @@ private void Initialize() MountTargets = new MountTargetsOperations(this); Snapshots = new SnapshotsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2019-08-01"; + ApiVersion = "2019-10-01"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; 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 a77ca6b39546..74e916461b73 100644 --- a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/IVolumesOperations.cs +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/IVolumesOperations.cs @@ -194,6 +194,170 @@ public partial interface IVolumesOperations /// Task DeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Break volume replication + /// + /// + /// Break 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. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BreakReplicationWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get volume replication status + /// + /// + /// Get the status of the 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. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ReplicationStatusMethodWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 source to destination. + /// + /// + /// 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 ResyncReplicationWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteReplicationWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task AuthorizeReplicationWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, AuthorizeRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Create or Update a volume /// /// diff --git a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/AuthorizeRequest.cs b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/AuthorizeRequest.cs new file mode 100644 index 000000000000..6a531f491154 --- /dev/null +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/AuthorizeRequest.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 Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Authorize request + /// + public partial class AuthorizeRequest : IResource + { + /// + /// Initializes a new instance of the AuthorizeRequest class. + /// + public AuthorizeRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AuthorizeRequest class. + /// + /// Resource id + public AuthorizeRequest(string remoteVolumeResourceId = default(string)) + { + RemoteVolumeResourceId = remoteVolumeResourceId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource id + /// + [JsonProperty(PropertyName = "remoteVolumeResourceId")] + public string RemoteVolumeResourceId { get; set; } + + } +} diff --git a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/ReplicationObject.cs b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/ReplicationObject.cs index b8d28a4e0ae9..4906b4fd1bc4 100644 --- a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/ReplicationObject.cs +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/ReplicationObject.cs @@ -30,16 +30,24 @@ public ReplicationObject() /// /// Initializes a new instance of the ReplicationObject class. /// - /// endpointType - /// replicationSchedule - /// remoteVolumeResourceId - /// replicationId - public ReplicationObject(string endpointType, string replicationSchedule, string remoteVolumeResourceId, string replicationId = default(string)) + /// Schedule + /// The resource ID of the remote + /// volume. + /// Id + /// Indicates whether the local volume is + /// the source or destination for the Volume Replication + /// Id used to identify the owner of the + /// resource + /// The remote region for the other + /// end of the Volume Replication. + public ReplicationObject(string replicationSchedule, string remoteVolumeResourceId, string replicationId = default(string), string endpointType = default(string), string ownerId = default(string), string remoteVolumeRegion = default(string)) { ReplicationId = replicationId; EndpointType = endpointType; ReplicationSchedule = replicationSchedule; + OwnerId = ownerId; RemoteVolumeResourceId = remoteVolumeResourceId; + RemoteVolumeRegion = remoteVolumeRegion; CustomInit(); } @@ -49,42 +57,43 @@ public ReplicationObject() partial void CustomInit(); /// - /// Gets or sets replicationId + /// Gets or sets id /// - /// - /// Id - /// [JsonProperty(PropertyName = "replicationId")] public string ReplicationId { get; set; } /// - /// Gets or sets endpointType + /// Gets or sets indicates whether the local volume is the source or + /// destination for the Volume Replication /// - /// - /// Indicates whether the local volume is the source or destination for - /// the Volume Replication - /// [JsonProperty(PropertyName = "endpointType")] public string EndpointType { get; set; } /// - /// Gets or sets replicationSchedule + /// Gets or sets schedule /// - /// - /// Schedule - /// [JsonProperty(PropertyName = "replicationSchedule")] public string ReplicationSchedule { get; set; } /// - /// Gets or sets remoteVolumeResourceId + /// Gets or sets id used to identify the owner of the resource + /// + [JsonProperty(PropertyName = "ownerId")] + public string OwnerId { get; set; } + + /// + /// Gets or sets the resource ID of the remote volume. /// - /// - /// 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. /// @@ -93,10 +102,6 @@ public ReplicationObject() /// public virtual void Validate() { - if (EndpointType == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "EndpointType"); - } if (ReplicationSchedule == null) { throw new ValidationException(ValidationRules.CannotBeNull, "ReplicationSchedule"); diff --git a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/ReplicationStatus.cs b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/ReplicationStatus.cs new file mode 100644 index 000000000000..90d7bc8b630d --- /dev/null +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/ReplicationStatus.cs @@ -0,0 +1,86 @@ +// +// 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; + + /// + /// Replication status + /// + public partial class ReplicationStatus + { + /// + /// Initializes a new instance of the ReplicationStatus class. + /// + public ReplicationStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReplicationStatus class. + /// + /// Replication health check + /// Status of the mirror + /// relationship + /// The status of the replication + /// The progress of the replication + /// Displays error message if the + /// replication is in an error state + public ReplicationStatus(bool? healthy = default(bool?), string relationshipStatus = default(string), string mirrorState = default(string), string totalProgress = default(string), string errorMessage = default(string)) + { + Healthy = healthy; + RelationshipStatus = relationshipStatus; + MirrorState = mirrorState; + TotalProgress = totalProgress; + ErrorMessage = errorMessage; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets replication health check + /// + [JsonProperty(PropertyName = "healthy")] + public bool? Healthy { get; set; } + + /// + /// Gets or sets status of the mirror relationship + /// + [JsonProperty(PropertyName = "relationshipStatus")] + public string RelationshipStatus { get; set; } + + /// + /// Gets or sets the status of the replication + /// + [JsonProperty(PropertyName = "mirrorState")] + public string MirrorState { get; set; } + + /// + /// Gets or sets the progress of the replication + /// + [JsonProperty(PropertyName = "totalProgress")] + public string TotalProgress { get; set; } + + /// + /// Gets or sets displays error message if the replication is in an + /// error state + /// + [JsonProperty(PropertyName = "errorMessage")] + public string ErrorMessage { get; set; } + + } +} 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 8ca7bc1d8f7b..f175a7b6992a 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 @@ -54,7 +54,8 @@ public Volume() /// mountTargets /// What type of volume is this /// DataProtection - public Volume(string location, 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 baremetalTenantId = default(string), object mountTargets = default(object), string volumeType = default(string), VolumePropertiesDataProtection dataProtection = default(VolumePropertiesDataProtection)) + /// Restoring + public Volume(string location, 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 baremetalTenantId = default(string), object mountTargets = default(object), string volumeType = default(string), VolumePropertiesDataProtection dataProtection = default(VolumePropertiesDataProtection), bool? isRestoring = default(bool?)) { Location = location; Id = id; @@ -74,6 +75,7 @@ public Volume() MountTargets = mountTargets; VolumeType = volumeType; DataProtection = dataProtection; + IsRestoring = isRestoring; CustomInit(); } @@ -224,6 +226,12 @@ public Volume() [JsonProperty(PropertyName = "properties.dataProtection")] public VolumePropertiesDataProtection DataProtection { get; set; } + /// + /// Gets or sets restoring + /// + [JsonProperty(PropertyName = "properties.isRestoring")] + public bool? IsRestoring { get; set; } + /// /// Validate the object. /// @@ -297,10 +305,6 @@ public virtual void Validate() throw new ValidationException(ValidationRules.Pattern, "BaremetalTenantId", "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"); } } - if (DataProtection != null) - { - DataProtection.Validate(); - } } } } diff --git a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/VolumePropertiesDataProtection.cs b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/VolumePropertiesDataProtection.cs index 89ee1b46ef87..556d0e66d4af 100644 --- a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/VolumePropertiesDataProtection.cs +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/Models/VolumePropertiesDataProtection.cs @@ -35,7 +35,7 @@ public VolumePropertiesDataProtection() /// class. /// /// Replication - public VolumePropertiesDataProtection(ReplicationObject replication = default(ReplicationObject)) + public VolumePropertiesDataProtection(object replication = default(object)) { Replication = replication; CustomInit(); @@ -53,20 +53,7 @@ public VolumePropertiesDataProtection() /// Replication properties /// [JsonProperty(PropertyName = "replication")] - public ReplicationObject Replication { get; set; } + public object Replication { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Replication != null) - { - Replication.Validate(); - } - } } } 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 b674f58c3651..5eaa499efa37 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,26 +19,15 @@ public static IEnumerable> ApiInfo_NetAppManagemen { return new Tuple[] { - new Tuple("NetApp", "Accounts", "2019-08-01"), - new Tuple("NetApp", "MountTargets", "2019-08-01"), - new Tuple("NetApp", "NetAppResource", "2019-08-01"), - new Tuple("NetApp", "Operations", "2019-08-01"), - new Tuple("NetApp", "Pools", "2019-08-01"), - new Tuple("NetApp", "Snapshots", "2019-08-01"), - new Tuple("NetApp", "Volumes", "2019-08-01"), + new Tuple("NetApp", "Accounts", "2019-10-01"), + new Tuple("NetApp", "MountTargets", "2019-10-01"), + new Tuple("NetApp", "NetAppResource", "2019-10-01"), + new Tuple("NetApp", "Operations", "2019-10-01"), + new Tuple("NetApp", "Pools", "2019-10-01"), + new Tuple("NetApp", "Snapshots", "2019-10-01"), + new Tuple("NetApp", "Volumes", "2019-10-01"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "latest"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4407"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/netapp/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=C:\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "0a276b37ef1d935b3a082d178ecbf9d553deef26"; - 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/VolumesOperations.cs b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/VolumesOperations.cs index 7f70c649ed52..c9d596a00ac1 100644 --- a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/VolumesOperations.cs +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/VolumesOperations.cs @@ -816,6 +816,1099 @@ internal VolumesOperations(AzureNetAppFilesManagementClient client) return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } + /// + /// Break volume replication + /// + /// + /// Break 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 + /// + /// + /// 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 BreakReplicationWithHttpMessagesAsync(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 (volumeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "volumeName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // 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, "BreakReplication", 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(); + _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 != 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; + } + + /// + /// Get volume replication status + /// + /// + /// Get the status of the replication + /// + /// + /// 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> ReplicationStatusMethodWithHttpMessagesAsync(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 (volumeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "volumeName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // 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, "ReplicationStatusMethod", 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}/replicationStatus").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 + /// source to destination. + /// + /// + /// 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 ResyncReplicationWithHttpMessagesAsync(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 (volumeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "volumeName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // 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, "ResyncReplication", 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(); + _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 != 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; + } + + /// + /// 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 + /// + /// + /// 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 DeleteReplicationWithHttpMessagesAsync(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 (volumeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "volumeName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // 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, "DeleteReplication", 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(); + _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 != 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; + } + + /// + /// 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. + /// + /// + /// 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 AuthorizeReplicationWithHttpMessagesAsync(string resourceGroupName, string accountName, string poolName, string volumeName, AuthorizeRequest 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 (volumeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "volumeName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + 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, "AuthorizeReplication", 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(); + _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 != 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; + } + /// /// Create or Update a volume /// 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 3e14b00f63c1..e9bb184b4cda 100644 --- a/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/VolumesOperationsExtensions.cs +++ b/sdk/netapp/Microsoft.Azure.Management.NetApp/src/Generated/VolumesOperationsExtensions.cs @@ -316,6 +316,296 @@ public static void Delete(this IVolumesOperations operations, string resourceGro (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Break volume replication + /// + /// + /// Break the replication connection on the destination 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 BreakReplication(this IVolumesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName) + { + operations.BreakReplicationAsync(resourceGroupName, accountName, poolName, volumeName).GetAwaiter().GetResult(); + } + + /// + /// Break volume replication + /// + /// + /// Break the replication connection on the destination 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 BreakReplicationAsync(this IVolumesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BreakReplicationWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get volume replication status + /// + /// + /// Get the status of the replication + /// + /// + /// 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 ReplicationStatus ReplicationStatusMethod(this IVolumesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName) + { + return operations.ReplicationStatusMethodAsync(resourceGroupName, accountName, poolName, volumeName).GetAwaiter().GetResult(); + } + + /// + /// Get volume replication status + /// + /// + /// Get the status of the replication + /// + /// + /// 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 ReplicationStatusMethodAsync(this IVolumesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ReplicationStatusMethodWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// 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 + /// source to destination. + /// + /// + /// 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 ResyncReplication(this IVolumesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName) + { + operations.ResyncReplicationAsync(resourceGroupName, accountName, poolName, volumeName).GetAwaiter().GetResult(); + } + + /// + /// 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 + /// source to destination. + /// + /// + /// 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 ResyncReplicationAsync(this IVolumesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ResyncReplicationWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Delete volume replication + /// + /// + /// Delete the replication connection on the destination volume, and send + /// release to the source replication + /// + /// + /// 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 DeleteReplication(this IVolumesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName) + { + operations.DeleteReplicationAsync(resourceGroupName, accountName, poolName, volumeName).GetAwaiter().GetResult(); + } + + /// + /// Delete volume replication + /// + /// + /// Delete the replication connection on the destination volume, and send + /// release to the source replication + /// + /// + /// 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 DeleteReplicationAsync(this IVolumesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteReplicationWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Authorize source volume replication + /// + /// + /// Authorize the replication connection on the source 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 + /// + /// + /// authorize request object supplied in the body of the operation. + /// + public static void AuthorizeReplication(this IVolumesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName, AuthorizeRequest body) + { + operations.AuthorizeReplicationAsync(resourceGroupName, accountName, poolName, volumeName, body).GetAwaiter().GetResult(); + } + + /// + /// Authorize source volume replication + /// + /// + /// Authorize the replication connection on the source 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 + /// + /// + /// authorize request object supplied in the body of the operation. + /// + /// + /// The cancellation token. + /// + public static async Task AuthorizeReplicationAsync(this IVolumesOperations operations, string resourceGroupName, string accountName, string poolName, string volumeName, AuthorizeRequest body, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.AuthorizeReplicationWithHttpMessagesAsync(resourceGroupName, accountName, poolName, volumeName, body, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Create or Update a volume ///