diff --git a/sdk/sqlvirtualmachine/Microsoft.Azure.Management.SqlVirtualMachine/src/Generated/ISqlVirtualMachinesOperations.cs b/sdk/sqlvirtualmachine/Microsoft.Azure.Management.SqlVirtualMachine/src/Generated/ISqlVirtualMachinesOperations.cs index e88b4153da06..18c0fe012b44 100644 --- a/sdk/sqlvirtualmachine/Microsoft.Azure.Management.SqlVirtualMachine/src/Generated/ISqlVirtualMachinesOperations.cs +++ b/sdk/sqlvirtualmachine/Microsoft.Azure.Management.SqlVirtualMachine/src/Generated/ISqlVirtualMachinesOperations.cs @@ -23,6 +23,34 @@ namespace Microsoft.Azure.Management.SqlVirtualMachine /// public partial interface ISqlVirtualMachinesOperations { + /// + /// Gets the list of sql virtual machines in a SQL virtual machine + /// group. + /// + /// + /// Name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// Name of the SQL virtual machine group. + /// + /// + /// 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>> ListBySqlVmGroupWithHttpMessagesAsync(string resourceGroupName, string sqlVirtualMachineGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all SQL virtual machines in a subscription. /// @@ -265,6 +293,29 @@ public partial interface ISqlVirtualMachinesOperations /// Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string sqlVirtualMachineName, SqlVirtualMachineUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Gets the list of sql virtual machines in a SQL virtual machine + /// group. + /// + /// + /// 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>> ListBySqlVmGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Gets all SQL virtual machines in a subscription. /// /// diff --git a/sdk/sqlvirtualmachine/Microsoft.Azure.Management.SqlVirtualMachine/src/Generated/Models/SQLStorageSettings.cs b/sdk/sqlvirtualmachine/Microsoft.Azure.Management.SqlVirtualMachine/src/Generated/Models/SQLStorageSettings.cs new file mode 100644 index 000000000000..05e9e551bca1 --- /dev/null +++ b/sdk/sqlvirtualmachine/Microsoft.Azure.Management.SqlVirtualMachine/src/Generated/Models/SQLStorageSettings.cs @@ -0,0 +1,61 @@ +// +// 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.SqlVirtualMachine.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Set disk storage settings for SQL Server. + /// + public partial class SQLStorageSettings + { + /// + /// Initializes a new instance of the SQLStorageSettings class. + /// + public SQLStorageSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SQLStorageSettings class. + /// + /// Logical Unit Numbers for the disks. + /// SQL Server default file path + public SQLStorageSettings(IList luns = default(IList), string defaultFilePath = default(string)) + { + Luns = luns; + DefaultFilePath = defaultFilePath; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets logical Unit Numbers for the disks. + /// + [JsonProperty(PropertyName = "luns")] + public IList Luns { get; set; } + + /// + /// Gets or sets SQL Server default file path + /// + [JsonProperty(PropertyName = "defaultFilePath")] + public string DefaultFilePath { get; set; } + + } +} diff --git a/sdk/sqlvirtualmachine/Microsoft.Azure.Management.SqlVirtualMachine/src/Generated/Models/SqlVirtualMachineModel.cs b/sdk/sqlvirtualmachine/Microsoft.Azure.Management.SqlVirtualMachine/src/Generated/Models/SqlVirtualMachineModel.cs index b2363f3bd787..451592ff3010 100644 --- a/sdk/sqlvirtualmachine/Microsoft.Azure.Management.SqlVirtualMachine/src/Generated/Models/SqlVirtualMachineModel.cs +++ b/sdk/sqlvirtualmachine/Microsoft.Azure.Management.SqlVirtualMachine/src/Generated/Models/SqlVirtualMachineModel.cs @@ -69,7 +69,9 @@ public SqlVirtualMachineModel() /// settings. /// SQL Server /// configuration management settings. - public SqlVirtualMachineModel(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), ResourceIdentity identity = default(ResourceIdentity), string virtualMachineResourceId = default(string), string provisioningState = default(string), string sqlImageOffer = default(string), string sqlServerLicenseType = default(string), string sqlManagement = default(string), string sqlImageSku = default(string), string sqlVirtualMachineGroupResourceId = default(string), WsfcDomainCredentials wsfcDomainCredentials = default(WsfcDomainCredentials), AutoPatchingSettings autoPatchingSettings = default(AutoPatchingSettings), AutoBackupSettings autoBackupSettings = default(AutoBackupSettings), KeyVaultCredentialSettings keyVaultCredentialSettings = default(KeyVaultCredentialSettings), ServerConfigurationsManagementSettings serverConfigurationsManagementSettings = default(ServerConfigurationsManagementSettings)) + /// Storage Configuration + /// Settings. + public SqlVirtualMachineModel(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), ResourceIdentity identity = default(ResourceIdentity), string virtualMachineResourceId = default(string), string provisioningState = default(string), string sqlImageOffer = default(string), string sqlServerLicenseType = default(string), string sqlManagement = default(string), string sqlImageSku = default(string), string sqlVirtualMachineGroupResourceId = default(string), WsfcDomainCredentials wsfcDomainCredentials = default(WsfcDomainCredentials), AutoPatchingSettings autoPatchingSettings = default(AutoPatchingSettings), AutoBackupSettings autoBackupSettings = default(AutoBackupSettings), KeyVaultCredentialSettings keyVaultCredentialSettings = default(KeyVaultCredentialSettings), ServerConfigurationsManagementSettings serverConfigurationsManagementSettings = default(ServerConfigurationsManagementSettings), StorageConfigurationSettings storageConfigurationSettings = default(StorageConfigurationSettings)) : base(location, id, name, type, tags) { Identity = identity; @@ -85,6 +87,7 @@ public SqlVirtualMachineModel() AutoBackupSettings = autoBackupSettings; KeyVaultCredentialSettings = keyVaultCredentialSettings; ServerConfigurationsManagementSettings = serverConfigurationsManagementSettings; + StorageConfigurationSettings = storageConfigurationSettings; CustomInit(); } @@ -179,6 +182,12 @@ public SqlVirtualMachineModel() [JsonProperty(PropertyName = "properties.serverConfigurationsManagementSettings")] public ServerConfigurationsManagementSettings ServerConfigurationsManagementSettings { get; set; } + /// + /// Gets or sets storage Configuration Settings. + /// + [JsonProperty(PropertyName = "properties.storageConfigurationSettings")] + public StorageConfigurationSettings StorageConfigurationSettings { get; set; } + /// /// Validate the object. /// diff --git a/sdk/sqlvirtualmachine/Microsoft.Azure.Management.SqlVirtualMachine/src/Generated/Models/StorageConfigurationSettings.cs b/sdk/sqlvirtualmachine/Microsoft.Azure.Management.SqlVirtualMachine/src/Generated/Models/StorageConfigurationSettings.cs new file mode 100644 index 000000000000..6db24ca89dda --- /dev/null +++ b/sdk/sqlvirtualmachine/Microsoft.Azure.Management.SqlVirtualMachine/src/Generated/Models/StorageConfigurationSettings.cs @@ -0,0 +1,92 @@ +// +// 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.SqlVirtualMachine.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Storage Configurations for SQL Data, Log and TempDb. + /// + public partial class StorageConfigurationSettings + { + /// + /// Initializes a new instance of the StorageConfigurationSettings + /// class. + /// + public StorageConfigurationSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StorageConfigurationSettings + /// class. + /// + /// SQL Server Data Storage + /// Settings. + /// SQL Server Log Storage + /// Settings. + /// SQL Server TempDb Storage + /// Settings. + /// Disk configuration to apply to + /// SQL Server. Possible values include: 'NEW', 'EXTEND', 'ADD' + /// Storage workload type. Possible + /// values include: 'GENERAL', 'OLTP', 'DW' + public StorageConfigurationSettings(SQLStorageSettings sqlDataSettings = default(SQLStorageSettings), SQLStorageSettings sqlLogSettings = default(SQLStorageSettings), SQLStorageSettings sqlTempDbSettings = default(SQLStorageSettings), string diskConfigurationType = default(string), string storageWorkloadType = default(string)) + { + SqlDataSettings = sqlDataSettings; + SqlLogSettings = sqlLogSettings; + SqlTempDbSettings = sqlTempDbSettings; + DiskConfigurationType = diskConfigurationType; + StorageWorkloadType = storageWorkloadType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets SQL Server Data Storage Settings. + /// + [JsonProperty(PropertyName = "sqlDataSettings")] + public SQLStorageSettings SqlDataSettings { get; set; } + + /// + /// Gets or sets SQL Server Log Storage Settings. + /// + [JsonProperty(PropertyName = "sqlLogSettings")] + public SQLStorageSettings SqlLogSettings { get; set; } + + /// + /// Gets or sets SQL Server TempDb Storage Settings. + /// + [JsonProperty(PropertyName = "sqlTempDbSettings")] + public SQLStorageSettings SqlTempDbSettings { get; set; } + + /// + /// Gets or sets disk configuration to apply to SQL Server. Possible + /// values include: 'NEW', 'EXTEND', 'ADD' + /// + [JsonProperty(PropertyName = "diskConfigurationType")] + public string DiskConfigurationType { get; set; } + + /// + /// Gets or sets storage workload type. Possible values include: + /// 'GENERAL', 'OLTP', 'DW' + /// + [JsonProperty(PropertyName = "storageWorkloadType")] + public string StorageWorkloadType { get; set; } + + } +} diff --git a/sdk/sqlvirtualmachine/Microsoft.Azure.Management.SqlVirtualMachine/src/Generated/Models/StorageWorkloadType.cs b/sdk/sqlvirtualmachine/Microsoft.Azure.Management.SqlVirtualMachine/src/Generated/Models/StorageWorkloadType.cs new file mode 100644 index 000000000000..f8eb340d49f8 --- /dev/null +++ b/sdk/sqlvirtualmachine/Microsoft.Azure.Management.SqlVirtualMachine/src/Generated/Models/StorageWorkloadType.cs @@ -0,0 +1,23 @@ +// +// 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.SqlVirtualMachine.Models +{ + + /// + /// Defines values for StorageWorkloadType. + /// + public static class StorageWorkloadType + { + public const string GENERAL = "GENERAL"; + public const string OLTP = "OLTP"; + public const string DW = "DW"; + } +} diff --git a/sdk/sqlvirtualmachine/Microsoft.Azure.Management.SqlVirtualMachine/src/Generated/SdkInfo_SqlVirtualMachineManagementClient.cs b/sdk/sqlvirtualmachine/Microsoft.Azure.Management.SqlVirtualMachine/src/Generated/SdkInfo_SqlVirtualMachineManagementClient.cs index b0ef8bb93837..59ee7697d631 100644 --- a/sdk/sqlvirtualmachine/Microsoft.Azure.Management.SqlVirtualMachine/src/Generated/SdkInfo_SqlVirtualMachineManagementClient.cs +++ b/sdk/sqlvirtualmachine/Microsoft.Azure.Management.SqlVirtualMachine/src/Generated/SdkInfo_SqlVirtualMachineManagementClient.cs @@ -26,16 +26,5 @@ public static IEnumerable> ApiInfo_SqlVirtualMachi }.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/sqlvirtualmachine/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=C:\\Users\\myvmadmin\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "e63401cb21aba92650b877be0b7d8893452cd6fe"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/sqlvirtualmachine/Microsoft.Azure.Management.SqlVirtualMachine/src/Generated/SqlVirtualMachinesOperations.cs b/sdk/sqlvirtualmachine/Microsoft.Azure.Management.SqlVirtualMachine/src/Generated/SqlVirtualMachinesOperations.cs index 5ce7c101d2d5..13a243696abd 100644 --- a/sdk/sqlvirtualmachine/Microsoft.Azure.Management.SqlVirtualMachine/src/Generated/SqlVirtualMachinesOperations.cs +++ b/sdk/sqlvirtualmachine/Microsoft.Azure.Management.SqlVirtualMachine/src/Generated/SqlVirtualMachinesOperations.cs @@ -50,6 +50,203 @@ internal SqlVirtualMachinesOperations(SqlVirtualMachineManagementClient client) /// public SqlVirtualMachineManagementClient Client { get; private set; } + /// + /// Gets the list of sql virtual machines in a SQL virtual machine group. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL virtual machine group. + /// + /// + /// 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>> ListBySqlVmGroupWithHttpMessagesAsync(string resourceGroupName, string sqlVirtualMachineGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sqlVirtualMachineGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlVirtualMachineGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + 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("sqlVirtualMachineGroupName", sqlVirtualMachineGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySqlVmGroup", 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.SqlVirtualMachine/sqlVirtualMachineGroups/{sqlVirtualMachineGroupName}/sqlVirtualMachines").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sqlVirtualMachineGroupName}", System.Uri.EscapeDataString(sqlVirtualMachineGroupName)); + _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 all SQL virtual machines in a subscription. /// @@ -1316,6 +1513,179 @@ internal SqlVirtualMachinesOperations(SqlVirtualMachineManagementClient client) return _result; } + /// + /// Gets the list of sql virtual machines in a SQL virtual machine group. + /// + /// + /// 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>> ListBySqlVmGroupNextWithHttpMessagesAsync(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, "ListBySqlVmGroupNext", 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; + } + /// /// Gets all SQL virtual machines in a subscription. /// diff --git a/sdk/sqlvirtualmachine/Microsoft.Azure.Management.SqlVirtualMachine/src/Generated/SqlVirtualMachinesOperationsExtensions.cs b/sdk/sqlvirtualmachine/Microsoft.Azure.Management.SqlVirtualMachine/src/Generated/SqlVirtualMachinesOperationsExtensions.cs index 945541322910..c86178e4e641 100644 --- a/sdk/sqlvirtualmachine/Microsoft.Azure.Management.SqlVirtualMachine/src/Generated/SqlVirtualMachinesOperationsExtensions.cs +++ b/sdk/sqlvirtualmachine/Microsoft.Azure.Management.SqlVirtualMachine/src/Generated/SqlVirtualMachinesOperationsExtensions.cs @@ -21,6 +21,48 @@ namespace Microsoft.Azure.Management.SqlVirtualMachine /// public static partial class SqlVirtualMachinesOperationsExtensions { + /// + /// Gets the list of sql virtual machines in a SQL virtual machine group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL virtual machine group. + /// + public static IPage ListBySqlVmGroup(this ISqlVirtualMachinesOperations operations, string resourceGroupName, string sqlVirtualMachineGroupName) + { + return operations.ListBySqlVmGroupAsync(resourceGroupName, sqlVirtualMachineGroupName).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of sql virtual machines in a SQL virtual machine group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL virtual machine group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySqlVmGroupAsync(this ISqlVirtualMachinesOperations operations, string resourceGroupName, string sqlVirtualMachineGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySqlVmGroupWithHttpMessagesAsync(resourceGroupName, sqlVirtualMachineGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Gets all SQL virtual machines in a subscription. /// @@ -403,6 +445,40 @@ public static SqlVirtualMachineModel BeginUpdate(this ISqlVirtualMachinesOperati } } + /// + /// Gets the list of sql virtual machines in a SQL virtual machine group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySqlVmGroupNext(this ISqlVirtualMachinesOperations operations, string nextPageLink) + { + return operations.ListBySqlVmGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of sql virtual machines in a SQL virtual machine group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySqlVmGroupNextAsync(this ISqlVirtualMachinesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySqlVmGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Gets all SQL virtual machines in a subscription. ///