From f8a08fa9e01a846aa63d859cd8519f108b46d576 Mon Sep 17 00:00:00 2001 From: adxsdknet Date: Fri, 17 May 2019 15:05:47 +0000 Subject: [PATCH] .NET SDK Resource Provider:'RecoveryServices.SiteRecovery' REST Spec PR 'https://github.com/Azure/azure-rest-api-specs/pull/6006' REST Spec PR Author 'hitesh715' REST Spec PR Last commit --- .../IReplicationVaultSettingOperations.cs | 131 +++ .../ISiteRecoveryManagementClient.cs | 5 + .../Models/VMwareV2FabricSpecificDetails.cs | 10 +- .../Generated/Models/VaultSetting.cs | 56 ++ .../Models/VaultSettingCreationInput.cs | 70 ++ .../VaultSettingCreationInputProperties.cs | 68 ++ .../Models/VaultSettingProperties.cs | 52 ++ .../ReplicationVaultSettingOperations.cs | 843 ++++++++++++++++++ ...icationVaultSettingOperationsExtensions.cs | 193 ++++ .../SdkInfo_SiteRecoveryManagementClient.cs | 1 + .../Generated/SiteRecoveryManagementClient.cs | 6 + 11 files changed, 1434 insertions(+), 1 deletion(-) create mode 100644 src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/IReplicationVaultSettingOperations.cs create mode 100644 src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/Models/VaultSetting.cs create mode 100644 src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/Models/VaultSettingCreationInput.cs create mode 100644 src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/Models/VaultSettingCreationInputProperties.cs create mode 100644 src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/Models/VaultSettingProperties.cs create mode 100644 src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/ReplicationVaultSettingOperations.cs create mode 100644 src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/ReplicationVaultSettingOperationsExtensions.cs diff --git a/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/IReplicationVaultSettingOperations.cs b/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/IReplicationVaultSettingOperations.cs new file mode 100644 index 0000000000000..5312e4f78158d --- /dev/null +++ b/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/IReplicationVaultSettingOperations.cs @@ -0,0 +1,131 @@ +// +// 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.RecoveryServices.SiteRecovery +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ReplicationVaultSettingOperations operations. + /// + public partial interface IReplicationVaultSettingOperations + { + /// + /// Gets the list of vault setting. + /// + /// + /// Gets the list of vault setting. This includes the Migration Hub + /// connection settings. + /// + /// + /// 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>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the vault setting. + /// + /// + /// Gets the vault setting. This includes the Migration Hub connection + /// settings. + /// + /// + /// Vault setting name. + /// + /// + /// 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 vaultSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates vault setting. A vault setting object is a singleton per + /// vault and it is always present by default. + /// + /// + /// The operation to configure vault setting. + /// + /// + /// Vault setting name. + /// + /// + /// Vault setting creation input. + /// + /// + /// 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(string vaultSettingName, VaultSettingCreationInput input, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the list of vault setting. + /// + /// + /// Gets the list of vault setting. This includes the Migration Hub + /// connection settings. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// 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>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/ISiteRecoveryManagementClient.cs b/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/ISiteRecoveryManagementClient.cs index ffa88823b6ef6..7c3507a63c2b2 100644 --- a/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/ISiteRecoveryManagementClient.cs +++ b/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/ISiteRecoveryManagementClient.cs @@ -199,5 +199,10 @@ public partial interface ISiteRecoveryManagementClient : System.IDisposable /// IReplicationVaultHealthOperations ReplicationVaultHealth { get; } + /// + /// Gets the IReplicationVaultSettingOperations. + /// + IReplicationVaultSettingOperations ReplicationVaultSetting { get; } + } } diff --git a/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/Models/VMwareV2FabricSpecificDetails.cs b/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/Models/VMwareV2FabricSpecificDetails.cs index 73f0fbbb1c4c9..bedfb8ea76d2a 100644 --- a/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/Models/VMwareV2FabricSpecificDetails.cs +++ b/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/Models/VMwareV2FabricSpecificDetails.cs @@ -36,11 +36,13 @@ public VMwareV2FabricSpecificDetails() /// The Migration solution ARM /// Id. /// The service endpoint. - public VMwareV2FabricSpecificDetails(string vmwareSiteId = default(string), string migrationSolutionId = default(string), string serviceEndpoint = default(string)) + /// The service resource Id. + public VMwareV2FabricSpecificDetails(string vmwareSiteId = default(string), string migrationSolutionId = default(string), string serviceEndpoint = default(string), string serviceResourceId = default(string)) { VmwareSiteId = vmwareSiteId; MigrationSolutionId = migrationSolutionId; ServiceEndpoint = serviceEndpoint; + ServiceResourceId = serviceResourceId; CustomInit(); } @@ -67,5 +69,11 @@ public VMwareV2FabricSpecificDetails() [JsonProperty(PropertyName = "serviceEndpoint")] public string ServiceEndpoint { get; private set; } + /// + /// Gets the service resource Id. + /// + [JsonProperty(PropertyName = "serviceResourceId")] + public string ServiceResourceId { get; private set; } + } } diff --git a/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/Models/VaultSetting.cs b/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/Models/VaultSetting.cs new file mode 100644 index 0000000000000..69bab09930066 --- /dev/null +++ b/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/Models/VaultSetting.cs @@ -0,0 +1,56 @@ +// +// 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.RecoveryServices.SiteRecovery.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Vault setting. + /// + public partial class VaultSetting : Resource + { + /// + /// Initializes a new instance of the VaultSetting class. + /// + public VaultSetting() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VaultSetting class. + /// + /// Resource Id + /// Resource Name + /// Resource Type + /// Resource Location + /// The vault setting properties. + public VaultSetting(string id = default(string), string name = default(string), string type = default(string), string location = default(string), VaultSettingProperties properties = default(VaultSettingProperties)) + : base(id, name, type, location) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the vault setting properties. + /// + [JsonProperty(PropertyName = "properties")] + public VaultSettingProperties Properties { get; set; } + + } +} diff --git a/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/Models/VaultSettingCreationInput.cs b/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/Models/VaultSettingCreationInput.cs new file mode 100644 index 0000000000000..d0c534cf940b8 --- /dev/null +++ b/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/Models/VaultSettingCreationInput.cs @@ -0,0 +1,70 @@ +// +// 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.RecoveryServices.SiteRecovery.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Input to create vault setting. + /// + public partial class VaultSettingCreationInput + { + /// + /// Initializes a new instance of the VaultSettingCreationInput class. + /// + public VaultSettingCreationInput() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VaultSettingCreationInput class. + /// + /// Vault setting creation input + /// properties. + public VaultSettingCreationInput(VaultSettingCreationInputProperties properties) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets vault setting creation input properties. + /// + [JsonProperty(PropertyName = "properties")] + public VaultSettingCreationInputProperties Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); + } + if (Properties != null) + { + Properties.Validate(); + } + } + } +} diff --git a/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/Models/VaultSettingCreationInputProperties.cs b/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/Models/VaultSettingCreationInputProperties.cs new file mode 100644 index 0000000000000..6682a94a7ebaa --- /dev/null +++ b/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/Models/VaultSettingCreationInputProperties.cs @@ -0,0 +1,68 @@ +// +// 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.RecoveryServices.SiteRecovery.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Input to create vault setting. + /// + public partial class VaultSettingCreationInputProperties + { + /// + /// Initializes a new instance of the + /// VaultSettingCreationInputProperties class. + /// + public VaultSettingCreationInputProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// VaultSettingCreationInputProperties class. + /// + /// The migration solution + /// Id. + public VaultSettingCreationInputProperties(string migrationSolutionId) + { + MigrationSolutionId = migrationSolutionId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the migration solution Id. + /// + [JsonProperty(PropertyName = "migrationSolutionId")] + public string MigrationSolutionId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (MigrationSolutionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "MigrationSolutionId"); + } + } + } +} diff --git a/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/Models/VaultSettingProperties.cs b/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/Models/VaultSettingProperties.cs new file mode 100644 index 0000000000000..582df8b28c0d8 --- /dev/null +++ b/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/Models/VaultSettingProperties.cs @@ -0,0 +1,52 @@ +// +// 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.RecoveryServices.SiteRecovery.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Vault setting properties. + /// + public partial class VaultSettingProperties + { + /// + /// Initializes a new instance of the VaultSettingProperties class. + /// + public VaultSettingProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VaultSettingProperties class. + /// + /// The migration solution ARM + /// Id. + public VaultSettingProperties(string migrationSolutionId = default(string)) + { + MigrationSolutionId = migrationSolutionId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the migration solution ARM Id. + /// + [JsonProperty(PropertyName = "migrationSolutionId")] + public string MigrationSolutionId { get; set; } + + } +} diff --git a/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/ReplicationVaultSettingOperations.cs b/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/ReplicationVaultSettingOperations.cs new file mode 100644 index 0000000000000..f8a683edadbfb --- /dev/null +++ b/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/ReplicationVaultSettingOperations.cs @@ -0,0 +1,843 @@ +// +// 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.RecoveryServices.SiteRecovery +{ + 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; + + /// + /// ReplicationVaultSettingOperations operations. + /// + internal partial class ReplicationVaultSettingOperations : IServiceOperations, IReplicationVaultSettingOperations + { + /// + /// Initializes a new instance of the ReplicationVaultSettingOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ReplicationVaultSettingOperations(SiteRecoveryManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SiteRecoveryManagementClient + /// + public SiteRecoveryManagementClient Client { get; private set; } + + /// + /// Gets the list of vault setting. + /// + /// + /// Gets the list of vault setting. This includes the Migration Hub connection + /// settings. + /// + /// + /// 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>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceName"); + } + if (Client.ResourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", 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.RecoveryServices/vaults/{resourceName}/replicationVaultSettings").ToString(); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(Client.ResourceName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + 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; + } + + /// + /// Gets the vault setting. + /// + /// + /// Gets the vault setting. This includes the Migration Hub connection + /// settings. + /// + /// + /// Vault setting name. + /// + /// + /// 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 vaultSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceName"); + } + if (Client.ResourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (vaultSettingName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vaultSettingName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("vaultSettingName", vaultSettingName); + 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.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName}").ToString(); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(Client.ResourceName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{vaultSettingName}", System.Uri.EscapeDataString(vaultSettingName)); + 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; + } + + /// + /// Updates vault setting. A vault setting object is a singleton per vault and + /// it is always present by default. + /// + /// + /// The operation to configure vault setting. + /// + /// + /// Vault setting name. + /// + /// + /// Vault setting creation input. + /// + /// + /// 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> CreateWithHttpMessagesAsync(string vaultSettingName, VaultSettingCreationInput input, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceName"); + } + if (Client.ResourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ResourceGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (vaultSettingName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vaultSettingName"); + } + if (input == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "input"); + } + if (input != null) + { + input.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("vaultSettingName", vaultSettingName); + tracingParameters.Add("input", input); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", 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.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName}").ToString(); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(Client.ResourceName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(Client.ResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{vaultSettingName}", System.Uri.EscapeDataString(vaultSettingName)); + 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(input != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(input, 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) + { + 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; + } + + /// + /// Gets the list of vault setting. + /// + /// + /// Gets the list of vault setting. This includes the Migration Hub connection + /// settings. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// 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>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + 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/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/ReplicationVaultSettingOperationsExtensions.cs b/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/ReplicationVaultSettingOperationsExtensions.cs new file mode 100644 index 0000000000000..5872a91840a58 --- /dev/null +++ b/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/ReplicationVaultSettingOperationsExtensions.cs @@ -0,0 +1,193 @@ +// +// 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.RecoveryServices.SiteRecovery +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ReplicationVaultSettingOperations. + /// + public static partial class ReplicationVaultSettingOperationsExtensions + { + /// + /// Gets the list of vault setting. + /// + /// + /// Gets the list of vault setting. This includes the Migration Hub connection + /// settings. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IReplicationVaultSettingOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets the list of vault setting. + /// + /// + /// Gets the list of vault setting. This includes the Migration Hub connection + /// settings. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IReplicationVaultSettingOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the vault setting. + /// + /// + /// Gets the vault setting. This includes the Migration Hub connection + /// settings. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Vault setting name. + /// + public static VaultSetting Get(this IReplicationVaultSettingOperations operations, string vaultSettingName) + { + return operations.GetAsync(vaultSettingName).GetAwaiter().GetResult(); + } + + /// + /// Gets the vault setting. + /// + /// + /// Gets the vault setting. This includes the Migration Hub connection + /// settings. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Vault setting name. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IReplicationVaultSettingOperations operations, string vaultSettingName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(vaultSettingName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates vault setting. A vault setting object is a singleton per vault and + /// it is always present by default. + /// + /// + /// The operation to configure vault setting. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Vault setting name. + /// + /// + /// Vault setting creation input. + /// + public static VaultSetting Create(this IReplicationVaultSettingOperations operations, string vaultSettingName, VaultSettingCreationInput input) + { + return operations.CreateAsync(vaultSettingName, input).GetAwaiter().GetResult(); + } + + /// + /// Updates vault setting. A vault setting object is a singleton per vault and + /// it is always present by default. + /// + /// + /// The operation to configure vault setting. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Vault setting name. + /// + /// + /// Vault setting creation input. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IReplicationVaultSettingOperations operations, string vaultSettingName, VaultSettingCreationInput input, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(vaultSettingName, input, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the list of vault setting. + /// + /// + /// Gets the list of vault setting. This includes the Migration Hub connection + /// settings. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IReplicationVaultSettingOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of vault setting. + /// + /// + /// Gets the list of vault setting. This includes the Migration Hub connection + /// settings. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IReplicationVaultSettingOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/SdkInfo_SiteRecoveryManagementClient.cs b/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/SdkInfo_SiteRecoveryManagementClient.cs index 22f6607d114a6..717bc2c21cc3e 100644 --- a/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/SdkInfo_SiteRecoveryManagementClient.cs +++ b/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/SdkInfo_SiteRecoveryManagementClient.cs @@ -40,6 +40,7 @@ public static IEnumerable> ApiInfo_SiteRecoveryMan new Tuple("RecoveryServices", "ReplicationStorageClassificationMappings", "2018-07-10"), new Tuple("RecoveryServices", "ReplicationStorageClassifications", "2018-07-10"), new Tuple("RecoveryServices", "ReplicationVaultHealth", "2018-07-10"), + new Tuple("RecoveryServices", "ReplicationVaultSetting", "2018-07-10"), new Tuple("RecoveryServices", "ReplicationvCenters", "2018-07-10"), new Tuple("RecoveryServices", "SupportedOperatingSystems", "2018-07-10"), new Tuple("RecoveryServices", "TargetComputeSizes", "2018-07-10"), diff --git a/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/SiteRecoveryManagementClient.cs b/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/SiteRecoveryManagementClient.cs index 5d5cdaf5985c7..3d2ccd3a69466 100644 --- a/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/SiteRecoveryManagementClient.cs +++ b/src/SDKs/RecoveryServices.SiteRecovery/Management.RecoveryServices.SiteRecovery/Generated/SiteRecoveryManagementClient.cs @@ -202,6 +202,11 @@ public partial class SiteRecoveryManagementClient : ServiceClient public virtual IReplicationVaultHealthOperations ReplicationVaultHealth { get; private set; } + /// + /// Gets the IReplicationVaultSettingOperations. + /// + public virtual IReplicationVaultSettingOperations ReplicationVaultSetting { get; private set; } + /// /// Initializes a new instance of the SiteRecoveryManagementClient class. /// @@ -467,6 +472,7 @@ private void Initialize() ReplicationRecoveryPlans = new ReplicationRecoveryPlansOperations(this); SupportedOperatingSystems = new SupportedOperatingSystemsOperations(this); ReplicationVaultHealth = new ReplicationVaultHealthOperations(this); + ReplicationVaultSetting = new ReplicationVaultSettingOperations(this); BaseUri = new System.Uri("https://management.azure.com"); ApiVersion = "2018-07-10"; AcceptLanguage = "en-US";