diff --git a/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/CapabilitiesOperations.cs b/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/CapabilitiesOperations.cs
new file mode 100644
index 000000000000..e8a4332d38c4
--- /dev/null
+++ b/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/CapabilitiesOperations.cs
@@ -0,0 +1,239 @@
+// 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 1.0.1.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Sql
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ 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;
+
+ ///
+ /// CapabilitiesOperations operations.
+ ///
+ internal partial class CapabilitiesOperations : IServiceOperations, ICapabilitiesOperations
+ {
+ ///
+ /// Initializes a new instance of the CapabilitiesOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal CapabilitiesOperations(SqlManagementClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the SqlManagementClient
+ ///
+ public SqlManagementClient Client { get; private set; }
+
+ ///
+ /// Gets the capabilities available for the specified location.
+ ///
+ ///
+ /// The location id whose capabilities are retrieved.
+ ///
+ ///
+ /// 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> ListByLocationWithHttpMessagesAsync(string locationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (locationId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "locationId");
+ }
+ string apiVersion = "2014-04-01";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("locationId", locationId);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListByLocation", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationId}/capabilities").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{locationId}", System.Uri.EscapeDataString(locationId));
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ }
+}
diff --git a/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/CapabilitiesOperationsExtensions.cs b/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/CapabilitiesOperationsExtensions.cs
new file mode 100644
index 000000000000..c181fbbc14f0
--- /dev/null
+++ b/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/CapabilitiesOperationsExtensions.cs
@@ -0,0 +1,59 @@
+// 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 1.0.1.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Sql
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Extension methods for CapabilitiesOperations.
+ ///
+ public static partial class CapabilitiesOperationsExtensions
+ {
+ ///
+ /// Gets the capabilities available for the specified location.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The location id whose capabilities are retrieved.
+ ///
+ public static LocationCapabilities ListByLocation(this ICapabilitiesOperations operations, string locationId)
+ {
+ return operations.ListByLocationAsync(locationId).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets the capabilities available for the specified location.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The location id whose capabilities are retrieved.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task ListByLocationAsync(this ICapabilitiesOperations operations, string locationId, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListByLocationWithHttpMessagesAsync(locationId, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/DatabasesOperations.cs b/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/DatabasesOperations.cs
index 92363832961e..41488d743cc0 100644
--- a/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/DatabasesOperations.cs
+++ b/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/DatabasesOperations.cs
@@ -2,16 +2,16 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
+// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
namespace Microsoft.Azure.Management.Sql
{
- using Azure;
- using Management;
- using Rest;
- using Rest.Azure;
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
using Models;
using Newtonsoft.Json;
using System.Collections;
@@ -51,8 +51,34 @@ internal DatabasesOperations(SqlManagementClient client)
public SqlManagementClient Client { get; private set; }
///
- /// Imports a bacpac into an existing database. The existing database must be
- /// empty.
+ /// Imports a bacpac into a new database.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server.
+ ///
+ ///
+ /// The required parameters for importing a Bacpac into a database.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public async Task> ImportWithHttpMessagesAsync(string resourceGroupName, string serverName, ImportRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ // Send request
+ AzureOperationResponse _response = await BeginImportWithHttpMessagesAsync(resourceGroupName, serverName, parameters, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Creates an import operation that imports a bacpac into an existing
+ /// database. The existing database must be empty.
///
///
/// The name of the resource group that contains the resource. You can obtain
@@ -73,10 +99,10 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// The cancellation token.
///
- public async Task> ImportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ImportExtensionRequestParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> CreateImportOperationWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ImportExtensionRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Send Request
- AzureOperationResponse _response = await BeginImportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false);
+ AzureOperationResponse _response = await BeginCreateImportOperationWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false);
return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}
@@ -102,10 +128,10 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// The cancellation token.
///
- public async Task> ExportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ExportRequestParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> ExportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ExportRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Send request
- AzureOperationResponse _response = await BeginExportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false);
+ AzureOperationResponse _response = await BeginExportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false);
return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}
@@ -199,9 +225,9 @@ internal DatabasesOperations(SqlManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- var _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE");
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("DELETE");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
@@ -216,6 +242,8 @@ internal DatabasesOperations(SqlManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -253,11 +281,19 @@ internal DatabasesOperations(SqlManagementClient client)
if ((int)_statusCode != 200 && (int)_statusCode != 204)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- if (_httpResponse.Content != null) {
+ 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;
+ }
}
- else {
- _responseContent = string.Empty;
+ catch (JsonException)
+ {
+ // Ignore the exception
}
ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
@@ -384,9 +420,9 @@ internal DatabasesOperations(SqlManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- var _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ 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)
@@ -401,6 +437,8 @@ internal DatabasesOperations(SqlManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -448,7 +486,7 @@ internal DatabasesOperations(SqlManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -485,7 +523,7 @@ internal DatabasesOperations(SqlManagementClient client)
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -645,9 +683,9 @@ internal DatabasesOperations(SqlManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- var _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ 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)
@@ -662,6 +700,8 @@ internal DatabasesOperations(SqlManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -709,7 +749,7 @@ internal DatabasesOperations(SqlManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -746,7 +786,7 @@ internal DatabasesOperations(SqlManagementClient client)
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -782,10 +822,10 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// The cancellation token.
///
- public async Task PauseDataWarehouseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task PauseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Send request
- AzureOperationResponse _response = await BeginPauseDataWarehouseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, customHeaders, cancellationToken).ConfigureAwait(false);
+ AzureOperationResponse _response = await BeginPauseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, customHeaders, cancellationToken).ConfigureAwait(false);
return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}
@@ -808,10 +848,10 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// The cancellation token.
///
- public async Task ResumeDataWarehouseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task ResumeWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Send request
- AzureOperationResponse _response = await BeginResumeDataWarehouseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, customHeaders, cancellationToken).ConfigureAwait(false);
+ AzureOperationResponse _response = await BeginResumeWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, customHeaders, cancellationToken).ConfigureAwait(false);
return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}
@@ -899,9 +939,9 @@ internal DatabasesOperations(SqlManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- var _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ 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)
@@ -916,6 +956,8 @@ internal DatabasesOperations(SqlManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -963,7 +1005,7 @@ internal DatabasesOperations(SqlManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1000,7 +1042,7 @@ internal DatabasesOperations(SqlManagementClient client)
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1129,9 +1171,9 @@ internal DatabasesOperations(SqlManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- var _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE");
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("DELETE");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
@@ -1146,6 +1188,8 @@ internal DatabasesOperations(SqlManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1183,11 +1227,19 @@ internal DatabasesOperations(SqlManagementClient client)
if ((int)_statusCode != 200 && (int)_statusCode != 204)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- if (_httpResponse.Content != null) {
+ 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;
+ }
}
- else {
- _responseContent = string.Empty;
+ catch (JsonException)
+ {
+ // Ignore the exception
}
ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
@@ -1236,7 +1288,7 @@ internal DatabasesOperations(SqlManagementClient client)
///
///
/// A comma separated list of child objects to expand in the response. Possible
- /// properties: serviceTierAdvisors, upgradeHint, transparentDataEncryption.
+ /// properties: serviceTierAdvisors, transparentDataEncryption.
///
///
/// Headers that will be added to request.
@@ -1314,9 +1366,9 @@ internal DatabasesOperations(SqlManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- var _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ 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)
@@ -1331,6 +1383,8 @@ internal DatabasesOperations(SqlManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1378,7 +1432,7 @@ internal DatabasesOperations(SqlManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1415,7 +1469,7 @@ internal DatabasesOperations(SqlManagementClient client)
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1442,6 +1496,10 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// The name of the server.
///
+ ///
+ /// A comma separated list of child objects to expand in the response. Possible
+ /// properties: serviceTierAdvisors, transparentDataEncryption.
+ ///
///
/// An OData filter expression that describes a subset of databases to return.
///
@@ -1466,7 +1524,7 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, string expand = default(string), string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.SubscriptionId == null)
{
@@ -1491,6 +1549,7 @@ internal DatabasesOperations(SqlManagementClient client)
tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("serverName", serverName);
+ tracingParameters.Add("expand", expand);
tracingParameters.Add("filter", filter);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters);
@@ -1506,6 +1565,10 @@ internal DatabasesOperations(SqlManagementClient client)
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
}
+ if (expand != null)
+ {
+ _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand)));
+ }
if (filter != null)
{
_queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter)));
@@ -1515,9 +1578,9 @@ internal DatabasesOperations(SqlManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- var _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ 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)
@@ -1532,6 +1595,8 @@ internal DatabasesOperations(SqlManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1579,7 +1644,7 @@ internal DatabasesOperations(SqlManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1616,7 +1681,7 @@ internal DatabasesOperations(SqlManagementClient client)
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1717,9 +1782,9 @@ internal DatabasesOperations(SqlManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- var _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ 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)
@@ -1734,6 +1799,8 @@ internal DatabasesOperations(SqlManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1781,7 +1848,7 @@ internal DatabasesOperations(SqlManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1818,7 +1885,7 @@ internal DatabasesOperations(SqlManagementClient client)
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1928,9 +1995,9 @@ internal DatabasesOperations(SqlManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- var _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ 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)
@@ -1945,6 +2012,8 @@ internal DatabasesOperations(SqlManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1992,7 +2061,7 @@ internal DatabasesOperations(SqlManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -2029,7 +2098,7 @@ internal DatabasesOperations(SqlManagementClient client)
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -2130,9 +2199,9 @@ internal DatabasesOperations(SqlManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- var _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ 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)
@@ -2147,6 +2216,8 @@ internal DatabasesOperations(SqlManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -2194,7 +2265,7 @@ internal DatabasesOperations(SqlManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -2231,7 +2302,7 @@ internal DatabasesOperations(SqlManagementClient client)
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -2262,9 +2333,9 @@ internal DatabasesOperations(SqlManagementClient client)
/// The name of the database for which setting the transparent data encryption
/// applies.
///
- ///
- /// The status of the database transparent data encryption. Possible values
- /// include: 'Enabled', 'Disabled'
+ ///
+ /// The required parameters for creating or updating transparent data
+ /// encryption.
///
///
/// Headers that will be added to request.
@@ -2287,7 +2358,7 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> CreateOrUpdateTransparentDataEncryptionConfigurationWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, TransparentDataEncryptionStates? status = default(TransparentDataEncryptionStates?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> CreateOrUpdateTransparentDataEncryptionConfigurationWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, TransparentDataEncryption parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.SubscriptionId == null)
{
@@ -2305,12 +2376,11 @@ internal DatabasesOperations(SqlManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "databaseName");
}
- string apiVersion = "2014-04-01";
- TransparentDataEncryption parameters = new TransparentDataEncryption();
- if (status != null)
+ if (parameters == null)
{
- parameters.Status = status;
+ throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
}
+ string apiVersion = "2014-04-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -2343,9 +2413,9 @@ internal DatabasesOperations(SqlManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- var _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("PUT");
+ 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)
@@ -2360,6 +2430,8 @@ internal DatabasesOperations(SqlManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -2377,7 +2449,7 @@ internal DatabasesOperations(SqlManagementClient client)
if(parameters != null)
{
_requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
- _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _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
@@ -2413,7 +2485,7 @@ internal DatabasesOperations(SqlManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -2450,7 +2522,7 @@ internal DatabasesOperations(SqlManagementClient client)
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -2468,7 +2540,7 @@ internal DatabasesOperations(SqlManagementClient client)
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -2569,9 +2641,9 @@ internal DatabasesOperations(SqlManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- var _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ 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)
@@ -2586,6 +2658,8 @@ internal DatabasesOperations(SqlManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -2633,7 +2707,7 @@ internal DatabasesOperations(SqlManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -2670,7 +2744,7 @@ internal DatabasesOperations(SqlManagementClient client)
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -2771,9 +2845,9 @@ internal DatabasesOperations(SqlManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- var _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ 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)
@@ -2788,6 +2862,8 @@ internal DatabasesOperations(SqlManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -2835,7 +2911,7 @@ internal DatabasesOperations(SqlManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -2872,7 +2948,7 @@ internal DatabasesOperations(SqlManagementClient client)
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -2890,8 +2966,7 @@ internal DatabasesOperations(SqlManagementClient client)
}
///
- /// Imports a bacpac into an existing database. The existing database must be
- /// empty.
+ /// Gets a database's threat detection policy.
///
///
/// The name of the resource group that contains the resource. You can obtain
@@ -2901,10 +2976,8 @@ internal DatabasesOperations(SqlManagementClient client)
/// The name of the server.
///
///
- /// The name of the database to import into
- ///
- ///
- /// The required parameters for importing a Bacpac into a database.
+ /// The name of the database for which database Threat Detection policy is
+ /// defined.
///
///
/// Headers that will be added to request.
@@ -2927,7 +3000,7 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> BeginImportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ImportExtensionRequestParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> GetThreatDetectionPolicyWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.SubscriptionId == null)
{
@@ -2945,19 +3018,7 @@ internal DatabasesOperations(SqlManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "databaseName");
}
- if (parameters == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
- }
- if (parameters != null)
- {
- parameters.Validate();
- }
string apiVersion = "2014-04-01";
- if (parameters == null)
- {
- parameters = new ImportExtensionRequestParameters();
- }
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -2965,17 +3026,16 @@ internal DatabasesOperations(SqlManagementClient client)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("serverName", serverName);
tracingParameters.Add("databaseName", databaseName);
- tracingParameters.Add("parameters", parameters);
+ tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginImport", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "GetThreatDetectionPolicy", 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.Sql/servers/{serverName}/databases/{databaseName}/extensions/import").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/default").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName));
@@ -2990,9 +3050,9 @@ internal DatabasesOperations(SqlManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- var _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("PUT");
+ 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)
@@ -3007,6 +3067,8 @@ internal DatabasesOperations(SqlManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -3021,12 +3083,6 @@ internal DatabasesOperations(SqlManagementClient client)
// Serialize Request
string _requestContent = null;
- if(parameters != null)
- {
- _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
- _httpRequest.Content = new System.Net.Http.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)
{
@@ -3047,7 +3103,7 @@ internal DatabasesOperations(SqlManagementClient client)
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
- if ((int)_statusCode != 200 && (int)_statusCode != 202)
+ if ((int)_statusCode != 200)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
@@ -3060,7 +3116,7 @@ internal DatabasesOperations(SqlManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -3082,7 +3138,7 @@ internal DatabasesOperations(SqlManagementClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse();
+ var _result = new AzureOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -3095,9 +3151,9 @@ internal DatabasesOperations(SqlManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -3115,7 +3171,7 @@ internal DatabasesOperations(SqlManagementClient client)
}
///
- /// Exports a database to a bacpac.
+ /// Creates or updates a database's threat detection policy.
///
///
/// The name of the resource group that contains the resource. You can obtain
@@ -3125,10 +3181,11 @@ internal DatabasesOperations(SqlManagementClient client)
/// The name of the server.
///
///
- /// The name of the database to be exported.
+ /// The name of the database for which database Threat Detection policy is
+ /// defined.
///
///
- /// The required parameters for exporting a database.
+ /// The database Threat Detection policy.
///
///
/// Headers that will be added to request.
@@ -3151,7 +3208,7 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> BeginExportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ExportRequestParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> CreateOrUpdateThreatDetectionPolicyWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, DatabaseSecurityAlertPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.SubscriptionId == null)
{
@@ -3185,17 +3242,17 @@ internal DatabasesOperations(SqlManagementClient client)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("serverName", serverName);
tracingParameters.Add("databaseName", databaseName);
tracingParameters.Add("parameters", parameters);
+ tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginExport", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateThreatDetectionPolicy", 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.Sql/servers/{serverName}/databases/{databaseName}/export").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/securityAlertPolicies/default").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName));
@@ -3210,9 +3267,9 @@ internal DatabasesOperations(SqlManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- var _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("POST");
+ 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)
@@ -3227,6 +3284,8 @@ internal DatabasesOperations(SqlManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -3244,7 +3303,7 @@ internal DatabasesOperations(SqlManagementClient client)
if(parameters != null)
{
_requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
- _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _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
@@ -3267,7 +3326,7 @@ internal DatabasesOperations(SqlManagementClient client)
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
- if ((int)_statusCode != 200 && (int)_statusCode != 202)
+ if ((int)_statusCode != 200 && (int)_statusCode != 201)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
@@ -3280,7 +3339,7 @@ internal DatabasesOperations(SqlManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -3302,7 +3361,7 @@ internal DatabasesOperations(SqlManagementClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse();
+ var _result = new AzureOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -3315,9 +3374,27 @@ internal DatabasesOperations(SqlManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 201)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -3335,7 +3412,7 @@ internal DatabasesOperations(SqlManagementClient client)
}
///
- /// Failover the database replication link.
+ /// Gets a database's blob auditing policy.
///
///
/// The name of the resource group that contains the resource. You can obtain
@@ -3345,10 +3422,7 @@ internal DatabasesOperations(SqlManagementClient client)
/// The name of the server.
///
///
- /// The name of the database that has the replication link to be failed over.
- ///
- ///
- /// The ID of the replication link to be failed over.
+ /// The name of the database for which database blob audit policy is defined.
///
///
/// Headers that will be added to request.
@@ -3359,6 +3433,9 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// Thrown when the operation returned an invalid status code
///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
///
/// Thrown when a required parameter is null
///
@@ -3368,7 +3445,7 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task BeginFailoverReplicationLinkWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> GetBlobAuditingPolicyWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.SubscriptionId == null)
{
@@ -3386,11 +3463,7 @@ internal DatabasesOperations(SqlManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "databaseName");
}
- if (linkId == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "linkId");
- }
- string apiVersion = "2014-04-01";
+ string apiVersion = "2015-05-01-preview";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -3398,22 +3471,20 @@ internal DatabasesOperations(SqlManagementClient client)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("serverName", serverName);
tracingParameters.Add("databaseName", databaseName);
- tracingParameters.Add("linkId", linkId);
+ tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginFailoverReplicationLink", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "GetBlobAuditingPolicy", 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.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/failover").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/default").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName));
_url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName));
- _url = _url.Replace("{linkId}", System.Uri.EscapeDataString(linkId));
List _queryParameters = new List();
if (apiVersion != null)
{
@@ -3424,9 +3495,9 @@ internal DatabasesOperations(SqlManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- var _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("POST");
+ 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)
@@ -3441,6 +3512,8 @@ internal DatabasesOperations(SqlManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -3475,14 +3548,22 @@ internal DatabasesOperations(SqlManagementClient client)
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
- if ((int)_statusCode != 204 && (int)_statusCode != 202)
+ if ((int)_statusCode != 200)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- if (_httpResponse.Content != null) {
+ 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;
+ }
}
- else {
- _responseContent = string.Empty;
+ catch (JsonException)
+ {
+ // Ignore the exception
}
ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
@@ -3502,13 +3583,31 @@ internal DatabasesOperations(SqlManagementClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse();
+ var _result = new AzureOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
{
_result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
if (_shouldTrace)
{
ServiceClientTracing.Exit(_invocationId, _result);
@@ -3517,8 +3616,7 @@ internal DatabasesOperations(SqlManagementClient client)
}
///
- /// Force failover the database replication link, which may result in data
- /// loss.
+ /// Creates or updates a database's blob auditing policy.
///
///
/// The name of the resource group that contains the resource. You can obtain
@@ -3528,10 +3626,11 @@ internal DatabasesOperations(SqlManagementClient client)
/// The name of the server.
///
///
- /// The name of the database that has the replication link to be failed over.
+ /// The name of the database for which database blob audit policy will be
+ /// defined.
///
- ///
- /// The ID of the replication link to be failed over.
+ ///
+ /// The database blob auditing policy.
///
///
/// Headers that will be added to request.
@@ -3542,6 +3641,9 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// Thrown when the operation returned an invalid status code
///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
///
/// Thrown when a required parameter is null
///
@@ -3551,7 +3653,7 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task BeginFailoverReplicationLinkAllowDataLossWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> CreateOrUpdateBlobAuditingPolicyWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, DatabaseBlobAuditingPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.SubscriptionId == null)
{
@@ -3569,11 +3671,15 @@ internal DatabasesOperations(SqlManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "databaseName");
}
- if (linkId == null)
+ if (parameters == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "linkId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
}
- string apiVersion = "2014-04-01";
+ if (parameters != null)
+ {
+ parameters.Validate();
+ }
+ string apiVersion = "2015-05-01-preview";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -3581,22 +3687,21 @@ internal DatabasesOperations(SqlManagementClient client)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("serverName", serverName);
tracingParameters.Add("databaseName", databaseName);
- tracingParameters.Add("linkId", linkId);
+ tracingParameters.Add("parameters", parameters);
+ tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginFailoverReplicationLinkAllowDataLoss", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateBlobAuditingPolicy", 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.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/forceFailoverAllowDataLoss").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/default").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName));
_url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName));
- _url = _url.Replace("{linkId}", System.Uri.EscapeDataString(linkId));
List _queryParameters = new List();
if (apiVersion != null)
{
@@ -3607,9 +3712,9 @@ internal DatabasesOperations(SqlManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- var _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("POST");
+ 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)
@@ -3624,6 +3729,8 @@ internal DatabasesOperations(SqlManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -3638,6 +3745,12 @@ internal DatabasesOperations(SqlManagementClient client)
// Serialize Request
string _requestContent = null;
+ if(parameters != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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)
{
@@ -3658,14 +3771,22 @@ internal DatabasesOperations(SqlManagementClient client)
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
- if ((int)_statusCode != 204 && (int)_statusCode != 202)
+ if ((int)_statusCode != 200 && (int)_statusCode != 201)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- if (_httpResponse.Content != null) {
+ 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;
+ }
}
- else {
- _responseContent = string.Empty;
+ catch (JsonException)
+ {
+ // Ignore the exception
}
ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
@@ -3685,22 +3806,1105 @@ internal DatabasesOperations(SqlManagementClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse();
+ var _result = new AzureOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
{
_result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
- if (_shouldTrace)
+ // Deserialize Response
+ if ((int)_statusCode == 200)
{
- ServiceClientTracing.Exit(_invocationId, _result);
+ _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);
+ }
}
- return _result;
- }
-
- ///
- /// Pauses a data warehouse.
+ // Deserialize Response
+ if ((int)_statusCode == 201)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Imports a bacpac into a new database.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server.
+ ///
+ ///
+ /// The required parameters for importing a Bacpac into a database.
+ ///
+ ///
+ /// 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> BeginImportWithHttpMessagesAsync(string resourceGroupName, string serverName, ImportRequest parameters, 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 (serverName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "serverName");
+ }
+ if (parameters == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
+ }
+ if (parameters != null)
+ {
+ parameters.Validate();
+ }
+ string apiVersion = "2014-04-01";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("serverName", serverName);
+ tracingParameters.Add("parameters", parameters);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "BeginImport", 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.Sql/servers/{serverName}/import").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName));
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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(parameters != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 201 && (int)_statusCode != 202)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 201)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Creates an import operation that imports a bacpac into an existing
+ /// database. The existing database must be empty.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server.
+ ///
+ ///
+ /// The name of the database to import into
+ ///
+ ///
+ /// The required parameters for importing a Bacpac into a database.
+ ///
+ ///
+ /// 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> BeginCreateImportOperationWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ImportExtensionRequest parameters, 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 (serverName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "serverName");
+ }
+ if (databaseName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "databaseName");
+ }
+ if (parameters == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
+ }
+ if (parameters != null)
+ {
+ parameters.Validate();
+ }
+ string apiVersion = "2014-04-01";
+ if (parameters == null)
+ {
+ parameters = new ImportExtensionRequest();
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("serverName", serverName);
+ tracingParameters.Add("databaseName", databaseName);
+ tracingParameters.Add("parameters", parameters);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "BeginCreateImportOperation", 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.Sql/servers/{serverName}/databases/{databaseName}/extensions/import").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName));
+ _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName));
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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(parameters != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200 && (int)_statusCode != 202)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Exports a database to a bacpac.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server.
+ ///
+ ///
+ /// The name of the database to be exported.
+ ///
+ ///
+ /// The required parameters for exporting a database.
+ ///
+ ///
+ /// 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> BeginExportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ExportRequest parameters, 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 (serverName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "serverName");
+ }
+ if (databaseName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "databaseName");
+ }
+ if (parameters == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
+ }
+ if (parameters != null)
+ {
+ parameters.Validate();
+ }
+ string apiVersion = "2014-04-01";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("serverName", serverName);
+ tracingParameters.Add("databaseName", databaseName);
+ tracingParameters.Add("parameters", parameters);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "BeginExport", 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.Sql/servers/{serverName}/databases/{databaseName}/export").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName));
+ _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName));
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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(parameters != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200 && (int)_statusCode != 202)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Failover the database replication link.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server.
+ ///
+ ///
+ /// The name of the database that has the replication link to be failed over.
+ ///
+ ///
+ /// The ID of the replication link to be failed over.
+ ///
+ ///
+ /// 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 BeginFailoverReplicationLinkWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, 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 (serverName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "serverName");
+ }
+ if (databaseName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "databaseName");
+ }
+ if (linkId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "linkId");
+ }
+ string apiVersion = "2014-04-01";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("serverName", serverName);
+ tracingParameters.Add("databaseName", databaseName);
+ tracingParameters.Add("linkId", linkId);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "BeginFailoverReplicationLink", 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.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/failover").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName));
+ _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName));
+ _url = _url.Replace("{linkId}", System.Uri.EscapeDataString(linkId));
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 != 204 && (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;
+ }
+
+ ///
+ /// Force failover the database replication link, which may result in data
+ /// loss.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server.
+ ///
+ ///
+ /// The name of the database that has the replication link to be failed over.
+ ///
+ ///
+ /// The ID of the replication link to be failed over.
+ ///
+ ///
+ /// 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 BeginFailoverReplicationLinkAllowDataLossWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string linkId, 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 (serverName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "serverName");
+ }
+ if (databaseName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "databaseName");
+ }
+ if (linkId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "linkId");
+ }
+ string apiVersion = "2014-04-01";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("serverName", serverName);
+ tracingParameters.Add("databaseName", databaseName);
+ tracingParameters.Add("linkId", linkId);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "BeginFailoverReplicationLinkAllowDataLoss", 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.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/forceFailoverAllowDataLoss").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName));
+ _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName));
+ _url = _url.Replace("{linkId}", System.Uri.EscapeDataString(linkId));
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 != 204 && (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;
+ }
+
+ ///
+ /// Pauses a data warehouse.
///
///
/// The name of the resource group that contains the resource. You can obtain
@@ -3730,7 +4934,7 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task BeginPauseDataWarehouseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task BeginPauseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.SubscriptionId == null)
{
@@ -3761,7 +4965,7 @@ internal DatabasesOperations(SqlManagementClient client)
tracingParameters.Add("serverName", serverName);
tracingParameters.Add("databaseName", databaseName);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginPauseDataWarehouse", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "BeginPause", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
@@ -3780,9 +4984,9 @@ internal DatabasesOperations(SqlManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- var _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("POST");
+ 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)
@@ -3797,6 +5001,8 @@ internal DatabasesOperations(SqlManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -3834,11 +5040,19 @@ internal DatabasesOperations(SqlManagementClient client)
if ((int)_statusCode != 200 && (int)_statusCode != 202)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- if (_httpResponse.Content != null) {
+ 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;
+ }
}
- else {
- _responseContent = string.Empty;
+ catch (JsonException)
+ {
+ // Ignore the exception
}
ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
@@ -3903,7 +5117,7 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task BeginResumeDataWarehouseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task BeginResumeWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.SubscriptionId == null)
{
@@ -3934,7 +5148,7 @@ internal DatabasesOperations(SqlManagementClient client)
tracingParameters.Add("serverName", serverName);
tracingParameters.Add("databaseName", databaseName);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginResumeDataWarehouse", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "BeginResume", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
@@ -3953,9 +5167,9 @@ internal DatabasesOperations(SqlManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- var _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("POST");
+ 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)
@@ -3970,6 +5184,8 @@ internal DatabasesOperations(SqlManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -4007,11 +5223,19 @@ internal DatabasesOperations(SqlManagementClient client)
if ((int)_statusCode != 202 && (int)_statusCode != 200)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- if (_httpResponse.Content != null) {
+ 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;
+ }
}
- else {
- _responseContent = string.Empty;
+ catch (JsonException)
+ {
+ // Ignore the exception
}
ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
@@ -4143,9 +5367,9 @@ internal DatabasesOperations(SqlManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- var _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("PUT");
+ 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)
@@ -4160,6 +5384,8 @@ internal DatabasesOperations(SqlManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -4177,7 +5403,7 @@ internal DatabasesOperations(SqlManagementClient client)
if(parameters != null)
{
_requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
- _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _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
@@ -4213,7 +5439,7 @@ internal DatabasesOperations(SqlManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -4250,7 +5476,7 @@ internal DatabasesOperations(SqlManagementClient client)
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -4268,7 +5494,7 @@ internal DatabasesOperations(SqlManagementClient client)
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -4287,4 +5513,3 @@ internal DatabasesOperations(SqlManagementClient client)
}
}
-
diff --git a/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/DatabasesOperationsExtensions.cs b/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/DatabasesOperationsExtensions.cs
index a4ac85caca0e..62eaef545577 100644
--- a/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/DatabasesOperationsExtensions.cs
+++ b/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/DatabasesOperationsExtensions.cs
@@ -2,16 +2,16 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
+// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
namespace Microsoft.Azure.Management.Sql
{
- using Azure;
- using Management;
- using Rest;
- using Rest.Azure;
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
using Models;
using System.Collections;
using System.Collections.Generic;
@@ -24,8 +24,56 @@ namespace Microsoft.Azure.Management.Sql
public static partial class DatabasesOperationsExtensions
{
///
- /// Imports a bacpac into an existing database. The existing database must be
- /// empty.
+ /// Imports a bacpac into a new database.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server.
+ ///
+ ///
+ /// The required parameters for importing a Bacpac into a database.
+ ///
+ public static ImportExportResponse Import(this IDatabasesOperations operations, string resourceGroupName, string serverName, ImportRequest parameters)
+ {
+ return operations.ImportAsync(resourceGroupName, serverName, parameters).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Imports a bacpac into a new database.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server.
+ ///
+ ///
+ /// The required parameters for importing a Bacpac into a database.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task ImportAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, ImportRequest parameters, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ImportWithHttpMessagesAsync(resourceGroupName, serverName, parameters, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Creates an import operation that imports a bacpac into an existing
+ /// database. The existing database must be empty.
///
///
/// The operations group for this extension method.
@@ -43,14 +91,14 @@ public static partial class DatabasesOperationsExtensions
///
/// The required parameters for importing a Bacpac into a database.
///
- public static ImportExportOperationResponse Import(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ImportExtensionRequestParameters parameters)
+ public static ImportExportResponse CreateImportOperation(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ImportExtensionRequest parameters)
{
- return operations.ImportAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult();
+ return operations.CreateImportOperationAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult();
}
///
- /// Imports a bacpac into an existing database. The existing database must be
- /// empty.
+ /// Creates an import operation that imports a bacpac into an existing
+ /// database. The existing database must be empty.
///
///
/// The operations group for this extension method.
@@ -71,9 +119,9 @@ public static ImportExportOperationResponse Import(this IDatabasesOperations ope
///
/// The cancellation token.
///
- public static async Task ImportAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ImportExtensionRequestParameters parameters, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task CreateImportOperationAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ImportExtensionRequest parameters, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.ImportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.CreateImportOperationWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
@@ -98,7 +146,7 @@ public static ImportExportOperationResponse Import(this IDatabasesOperations ope
///
/// The required parameters for exporting a database.
///
- public static ImportExportOperationResponse Export(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportRequestParameters parameters)
+ public static ImportExportResponse Export(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportRequest parameters)
{
return operations.ExportAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult();
}
@@ -125,7 +173,7 @@ public static ImportExportOperationResponse Export(this IDatabasesOperations ope
///
/// The cancellation token.
///
- public static async Task ExportAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportRequestParameters parameters, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task ExportAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportRequest parameters, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.ExportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false))
{
@@ -181,7 +229,7 @@ public static void DeleteReplicationLink(this IDatabasesOperations operations, s
///
public static async Task DeleteReplicationLinkAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default(CancellationToken))
{
- await operations.DeleteReplicationLinkWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, null, cancellationToken).ConfigureAwait(false);
+ (await operations.DeleteReplicationLinkWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
///
@@ -286,7 +334,7 @@ public static void FailoverReplicationLink(this IDatabasesOperations operations,
///
public static async Task FailoverReplicationLinkAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default(CancellationToken))
{
- await operations.FailoverReplicationLinkWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, null, cancellationToken).ConfigureAwait(false);
+ (await operations.FailoverReplicationLinkWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
///
@@ -339,7 +387,7 @@ public static void FailoverReplicationLinkAllowDataLoss(this IDatabasesOperation
///
public static async Task FailoverReplicationLinkAllowDataLossAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default(CancellationToken))
{
- await operations.FailoverReplicationLinkAllowDataLossWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, null, cancellationToken).ConfigureAwait(false);
+ (await operations.FailoverReplicationLinkAllowDataLossWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
///
@@ -406,9 +454,9 @@ public static IEnumerable ListReplicationLinks(this IDatabasesO
///
/// The name of the data warehouse to pause.
///
- public static void PauseDataWarehouse(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName)
+ public static void Pause(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName)
{
- operations.PauseDataWarehouseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult();
+ operations.PauseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult();
}
///
@@ -430,9 +478,9 @@ public static void PauseDataWarehouse(this IDatabasesOperations operations, stri
///
/// The cancellation token.
///
- public static async Task PauseDataWarehouseAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task PauseAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken))
{
- await operations.PauseDataWarehouseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false);
+ (await operations.PauseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
///
@@ -451,9 +499,9 @@ public static void PauseDataWarehouse(this IDatabasesOperations operations, stri
///
/// The name of the data warehouse to resume.
///
- public static void ResumeDataWarehouse(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName)
+ public static void Resume(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName)
{
- operations.ResumeDataWarehouseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult();
+ operations.ResumeAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult();
}
///
@@ -475,9 +523,9 @@ public static void ResumeDataWarehouse(this IDatabasesOperations operations, str
///
/// The cancellation token.
///
- public static async Task ResumeDataWarehouseAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task ResumeAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken))
{
- await operations.ResumeDataWarehouseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false);
+ (await operations.ResumeWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
///
@@ -628,7 +676,7 @@ public static void Delete(this IDatabasesOperations operations, string resourceG
///
public static async Task DeleteAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken))
{
- await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false);
+ (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
///
@@ -649,7 +697,7 @@ public static void Delete(this IDatabasesOperations operations, string resourceG
///
///
/// A comma separated list of child objects to expand in the response. Possible
- /// properties: serviceTierAdvisors, upgradeHint, transparentDataEncryption.
+ /// properties: serviceTierAdvisors, transparentDataEncryption.
///
public static Database Get(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, string expand = default(string))
{
@@ -674,7 +722,7 @@ public static void Delete(this IDatabasesOperations operations, string resourceG
///
///
/// A comma separated list of child objects to expand in the response. Possible
- /// properties: serviceTierAdvisors, upgradeHint, transparentDataEncryption.
+ /// properties: serviceTierAdvisors, transparentDataEncryption.
///
///
/// The cancellation token.
@@ -700,12 +748,16 @@ public static void Delete(this IDatabasesOperations operations, string resourceG
///
/// The name of the server.
///
+ ///
+ /// A comma separated list of child objects to expand in the response. Possible
+ /// properties: serviceTierAdvisors, transparentDataEncryption.
+ ///
///
/// An OData filter expression that describes a subset of databases to return.
///
- public static IEnumerable ListByServer(this IDatabasesOperations operations, string resourceGroupName, string serverName, string filter = default(string))
+ public static IEnumerable ListByServer(this IDatabasesOperations operations, string resourceGroupName, string serverName, string expand = default(string), string filter = default(string))
{
- return operations.ListByServerAsync(resourceGroupName, serverName, filter).GetAwaiter().GetResult();
+ return operations.ListByServerAsync(resourceGroupName, serverName, expand, filter).GetAwaiter().GetResult();
}
///
@@ -721,15 +773,19 @@ public static void Delete(this IDatabasesOperations operations, string resourceG
///
/// The name of the server.
///
+ ///
+ /// A comma separated list of child objects to expand in the response. Possible
+ /// properties: serviceTierAdvisors, transparentDataEncryption.
+ ///
///
/// An OData filter expression that describes a subset of databases to return.
///
///
/// The cancellation token.
///
- public static async Task> ListByServerAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task> ListByServerAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string expand = default(string), string filter = default(string), CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, filter, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, expand, filter, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
@@ -902,13 +958,13 @@ public static IEnumerable ListServiceTierAdvisors(this IData
/// The name of the database for which setting the transparent data encryption
/// applies.
///
- ///
- /// The status of the database transparent data encryption. Possible values
- /// include: 'Enabled', 'Disabled'
+ ///
+ /// The required parameters for creating or updating transparent data
+ /// encryption.
///
- public static TransparentDataEncryption CreateOrUpdateTransparentDataEncryptionConfiguration(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, TransparentDataEncryptionStates? status = default(TransparentDataEncryptionStates?))
+ public static TransparentDataEncryption CreateOrUpdateTransparentDataEncryptionConfiguration(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, TransparentDataEncryption parameters)
{
- return operations.CreateOrUpdateTransparentDataEncryptionConfigurationAsync(resourceGroupName, serverName, databaseName, status).GetAwaiter().GetResult();
+ return operations.CreateOrUpdateTransparentDataEncryptionConfigurationAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult();
}
///
@@ -928,16 +984,16 @@ public static IEnumerable ListServiceTierAdvisors(this IData
/// The name of the database for which setting the transparent data encryption
/// applies.
///
- ///
- /// The status of the database transparent data encryption. Possible values
- /// include: 'Enabled', 'Disabled'
+ ///
+ /// The required parameters for creating or updating transparent data
+ /// encryption.
///
///
/// The cancellation token.
///
- public static async Task CreateOrUpdateTransparentDataEncryptionConfigurationAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, TransparentDataEncryptionStates? status = default(TransparentDataEncryptionStates?), CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task CreateOrUpdateTransparentDataEncryptionConfigurationAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, TransparentDataEncryption parameters, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.CreateOrUpdateTransparentDataEncryptionConfigurationWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, status, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.CreateOrUpdateTransparentDataEncryptionConfigurationWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
@@ -1040,8 +1096,266 @@ public static IEnumerable ListTransparentData
}
///
- /// Imports a bacpac into an existing database. The existing database must be
- /// empty.
+ /// Gets a database's threat detection policy.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server.
+ ///
+ ///
+ /// The name of the database for which database Threat Detection policy is
+ /// defined.
+ ///
+ public static DatabaseSecurityAlertPolicy GetThreatDetectionPolicy(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName)
+ {
+ return operations.GetThreatDetectionPolicyAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets a database's threat detection policy.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server.
+ ///
+ ///
+ /// The name of the database for which database Threat Detection policy is
+ /// defined.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetThreatDetectionPolicyAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetThreatDetectionPolicyWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Creates or updates a database's threat detection policy.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server.
+ ///
+ ///
+ /// The name of the database for which database Threat Detection policy is
+ /// defined.
+ ///
+ ///
+ /// The database Threat Detection policy.
+ ///
+ public static DatabaseSecurityAlertPolicy CreateOrUpdateThreatDetectionPolicy(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, DatabaseSecurityAlertPolicy parameters)
+ {
+ return operations.CreateOrUpdateThreatDetectionPolicyAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Creates or updates a database's threat detection policy.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server.
+ ///
+ ///
+ /// The name of the database for which database Threat Detection policy is
+ /// defined.
+ ///
+ ///
+ /// The database Threat Detection policy.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task CreateOrUpdateThreatDetectionPolicyAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, DatabaseSecurityAlertPolicy parameters, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.CreateOrUpdateThreatDetectionPolicyWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Gets a database's blob auditing policy.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server.
+ ///
+ ///
+ /// The name of the database for which database blob audit policy is defined.
+ ///
+ public static DatabaseBlobAuditingPolicy GetBlobAuditingPolicy(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName)
+ {
+ return operations.GetBlobAuditingPolicyAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets a database's blob auditing policy.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server.
+ ///
+ ///
+ /// The name of the database for which database blob audit policy is defined.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetBlobAuditingPolicyAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetBlobAuditingPolicyWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Creates or updates a database's blob auditing policy.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server.
+ ///
+ ///
+ /// The name of the database for which database blob audit policy will be
+ /// defined.
+ ///
+ ///
+ /// The database blob auditing policy.
+ ///
+ public static DatabaseBlobAuditingPolicy CreateOrUpdateBlobAuditingPolicy(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, DatabaseBlobAuditingPolicy parameters)
+ {
+ return operations.CreateOrUpdateBlobAuditingPolicyAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Creates or updates a database's blob auditing policy.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server.
+ ///
+ ///
+ /// The name of the database for which database blob audit policy will be
+ /// defined.
+ ///
+ ///
+ /// The database blob auditing policy.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task CreateOrUpdateBlobAuditingPolicyAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, DatabaseBlobAuditingPolicy parameters, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.CreateOrUpdateBlobAuditingPolicyWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Imports a bacpac into a new database.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server.
+ ///
+ ///
+ /// The required parameters for importing a Bacpac into a database.
+ ///
+ public static ImportExportResponse BeginImport(this IDatabasesOperations operations, string resourceGroupName, string serverName, ImportRequest parameters)
+ {
+ return operations.BeginImportAsync(resourceGroupName, serverName, parameters).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Imports a bacpac into a new database.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server.
+ ///
+ ///
+ /// The required parameters for importing a Bacpac into a database.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task BeginImportAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, ImportRequest parameters, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.BeginImportWithHttpMessagesAsync(resourceGroupName, serverName, parameters, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Creates an import operation that imports a bacpac into an existing
+ /// database. The existing database must be empty.
///
///
/// The operations group for this extension method.
@@ -1059,14 +1373,14 @@ public static IEnumerable ListTransparentData
///
/// The required parameters for importing a Bacpac into a database.
///
- public static ImportExportOperationResponse BeginImport(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ImportExtensionRequestParameters parameters)
+ public static ImportExportResponse BeginCreateImportOperation(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ImportExtensionRequest parameters)
{
- return operations.BeginImportAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult();
+ return operations.BeginCreateImportOperationAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult();
}
///
- /// Imports a bacpac into an existing database. The existing database must be
- /// empty.
+ /// Creates an import operation that imports a bacpac into an existing
+ /// database. The existing database must be empty.
///
///
/// The operations group for this extension method.
@@ -1087,9 +1401,9 @@ public static ImportExportOperationResponse BeginImport(this IDatabasesOperation
///
/// The cancellation token.
///
- public static async Task BeginImportAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ImportExtensionRequestParameters parameters, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task BeginCreateImportOperationAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ImportExtensionRequest parameters, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.BeginImportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.BeginCreateImportOperationWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
@@ -1114,7 +1428,7 @@ public static ImportExportOperationResponse BeginImport(this IDatabasesOperation
///
/// The required parameters for exporting a database.
///
- public static ImportExportOperationResponse BeginExport(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportRequestParameters parameters)
+ public static ImportExportResponse BeginExport(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportRequest parameters)
{
return operations.BeginExportAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult();
}
@@ -1141,7 +1455,7 @@ public static ImportExportOperationResponse BeginExport(this IDatabasesOperation
///
/// The cancellation token.
///
- public static async Task BeginExportAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportRequestParameters parameters, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task BeginExportAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportRequest parameters, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.BeginExportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false))
{
@@ -1197,7 +1511,7 @@ public static void BeginFailoverReplicationLink(this IDatabasesOperations operat
///
public static async Task BeginFailoverReplicationLinkAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default(CancellationToken))
{
- await operations.BeginFailoverReplicationLinkWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, null, cancellationToken).ConfigureAwait(false);
+ (await operations.BeginFailoverReplicationLinkWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
///
@@ -1250,7 +1564,7 @@ public static void BeginFailoverReplicationLinkAllowDataLoss(this IDatabasesOper
///
public static async Task BeginFailoverReplicationLinkAllowDataLossAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, string linkId, CancellationToken cancellationToken = default(CancellationToken))
{
- await operations.BeginFailoverReplicationLinkAllowDataLossWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, null, cancellationToken).ConfigureAwait(false);
+ (await operations.BeginFailoverReplicationLinkAllowDataLossWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, linkId, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
///
@@ -1269,9 +1583,9 @@ public static void BeginFailoverReplicationLinkAllowDataLoss(this IDatabasesOper
///
/// The name of the data warehouse to pause.
///
- public static void BeginPauseDataWarehouse(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName)
+ public static void BeginPause(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName)
{
- operations.BeginPauseDataWarehouseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult();
+ operations.BeginPauseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult();
}
///
@@ -1293,9 +1607,9 @@ public static void BeginPauseDataWarehouse(this IDatabasesOperations operations,
///
/// The cancellation token.
///
- public static async Task BeginPauseDataWarehouseAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task BeginPauseAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken))
{
- await operations.BeginPauseDataWarehouseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false);
+ (await operations.BeginPauseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
///
@@ -1314,9 +1628,9 @@ public static void BeginPauseDataWarehouse(this IDatabasesOperations operations,
///
/// The name of the data warehouse to resume.
///
- public static void BeginResumeDataWarehouse(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName)
+ public static void BeginResume(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName)
{
- operations.BeginResumeDataWarehouseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult();
+ operations.BeginResumeAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult();
}
///
@@ -1338,9 +1652,9 @@ public static void BeginResumeDataWarehouse(this IDatabasesOperations operations
///
/// The cancellation token.
///
- public static async Task BeginResumeDataWarehouseAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task BeginResumeAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken))
{
- await operations.BeginResumeDataWarehouseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false);
+ (await operations.BeginResumeWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
///
@@ -1403,4 +1717,3 @@ public static Database BeginCreateOrUpdate(this IDatabasesOperations operations,
}
}
-
diff --git a/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/ElasticPoolsOperations.cs b/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/ElasticPoolsOperations.cs
index b13ca86960b2..c32acd9fd7fe 100644
--- a/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/ElasticPoolsOperations.cs
+++ b/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/ElasticPoolsOperations.cs
@@ -2,16 +2,16 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
+// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
namespace Microsoft.Azure.Management.Sql
{
- using Azure;
- using Management;
- using Rest;
- using Rest.Azure;
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
using Models;
using Newtonsoft.Json;
using System.Collections;
@@ -160,9 +160,9 @@ internal ElasticPoolsOperations(SqlManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- var _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE");
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("DELETE");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
@@ -177,6 +177,8 @@ internal ElasticPoolsOperations(SqlManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -214,11 +216,19 @@ internal ElasticPoolsOperations(SqlManagementClient client)
if ((int)_statusCode != 200 && (int)_statusCode != 204)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- if (_httpResponse.Content != null) {
+ 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;
+ }
}
- else {
- _responseContent = string.Empty;
+ catch (JsonException)
+ {
+ // Ignore the exception
}
ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
@@ -336,9 +346,9 @@ internal ElasticPoolsOperations(SqlManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- var _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ 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)
@@ -353,6 +363,8 @@ internal ElasticPoolsOperations(SqlManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -400,7 +412,7 @@ internal ElasticPoolsOperations(SqlManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -437,7 +449,7 @@ internal ElasticPoolsOperations(SqlManagementClient client)
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -529,9 +541,9 @@ internal ElasticPoolsOperations(SqlManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- var _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ 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)
@@ -546,6 +558,8 @@ internal ElasticPoolsOperations(SqlManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -593,7 +607,7 @@ internal ElasticPoolsOperations(SqlManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -630,7 +644,7 @@ internal ElasticPoolsOperations(SqlManagementClient client)
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -731,9 +745,9 @@ internal ElasticPoolsOperations(SqlManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- var _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ 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)
@@ -748,6 +762,8 @@ internal ElasticPoolsOperations(SqlManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -795,7 +811,7 @@ internal ElasticPoolsOperations(SqlManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -832,7 +848,7 @@ internal ElasticPoolsOperations(SqlManagementClient client)
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -933,9 +949,9 @@ internal ElasticPoolsOperations(SqlManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- var _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ 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)
@@ -950,6 +966,8 @@ internal ElasticPoolsOperations(SqlManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -997,7 +1015,7 @@ internal ElasticPoolsOperations(SqlManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1034,7 +1052,7 @@ internal ElasticPoolsOperations(SqlManagementClient client)
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1144,9 +1162,9 @@ internal ElasticPoolsOperations(SqlManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- var _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ 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)
@@ -1161,6 +1179,8 @@ internal ElasticPoolsOperations(SqlManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1208,7 +1228,7 @@ internal ElasticPoolsOperations(SqlManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1245,7 +1265,7 @@ internal ElasticPoolsOperations(SqlManagementClient client)
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1346,9 +1366,9 @@ internal ElasticPoolsOperations(SqlManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- var _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ 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)
@@ -1363,6 +1383,8 @@ internal ElasticPoolsOperations(SqlManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1410,7 +1432,7 @@ internal ElasticPoolsOperations(SqlManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1447,7 +1469,7 @@ internal ElasticPoolsOperations(SqlManagementClient client)
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1560,9 +1582,9 @@ internal ElasticPoolsOperations(SqlManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- var _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("PUT");
+ 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)
@@ -1577,6 +1599,8 @@ internal ElasticPoolsOperations(SqlManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1594,7 +1618,7 @@ internal ElasticPoolsOperations(SqlManagementClient client)
if(parameters != null)
{
_requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
- _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _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
@@ -1630,7 +1654,7 @@ internal ElasticPoolsOperations(SqlManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -1667,7 +1691,7 @@ internal ElasticPoolsOperations(SqlManagementClient client)
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1685,7 +1709,7 @@ internal ElasticPoolsOperations(SqlManagementClient client)
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1704,4 +1728,3 @@ internal ElasticPoolsOperations(SqlManagementClient client)
}
}
-
diff --git a/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/ElasticPoolsOperationsExtensions.cs b/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/ElasticPoolsOperationsExtensions.cs
index 032d79fb0997..5b0f1409861c 100644
--- a/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/ElasticPoolsOperationsExtensions.cs
+++ b/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/ElasticPoolsOperationsExtensions.cs
@@ -2,16 +2,16 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
+// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
namespace Microsoft.Azure.Management.Sql
{
- using Azure;
- using Management;
- using Rest;
- using Rest.Azure;
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
using Models;
using System.Collections;
using System.Collections.Generic;
@@ -119,7 +119,7 @@ public static void Delete(this IElasticPoolsOperations operations, string resour
///
public static async Task DeleteAsync(this IElasticPoolsOperations operations, string resourceGroupName, string serverName, string elasticPoolName, CancellationToken cancellationToken = default(CancellationToken))
{
- await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serverName, elasticPoolName, null, cancellationToken).ConfigureAwait(false);
+ (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serverName, elasticPoolName, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
///
@@ -466,4 +466,3 @@ public static ElasticPool BeginCreateOrUpdate(this IElasticPoolsOperations opera
}
}
-
diff --git a/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/ImportExportOperations.cs b/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/FirewallRulesOperations.cs
similarity index 65%
rename from src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/ImportExportOperations.cs
rename to src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/FirewallRulesOperations.cs
index 9f4bc0efd326..eadef528ad4a 100644
--- a/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/ImportExportOperations.cs
+++ b/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/FirewallRulesOperations.cs
@@ -2,16 +2,16 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
+// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
namespace Microsoft.Azure.Management.Sql
{
- using Azure;
- using Management;
- using Rest;
- using Rest.Azure;
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
using Models;
using Newtonsoft.Json;
using System.Collections;
@@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Sql
using System.Threading.Tasks;
///
- /// ImportExportOperations operations.
+ /// FirewallRulesOperations operations.
///
- internal partial class ImportExportOperations : IServiceOperations, IImportExportOperations
+ internal partial class FirewallRulesOperations : IServiceOperations, IFirewallRulesOperations
{
///
- /// Initializes a new instance of the ImportExportOperations class.
+ /// Initializes a new instance of the FirewallRulesOperations class.
///
///
/// Reference to the service client.
@@ -36,7 +36,7 @@ internal partial class ImportExportOperations : IServiceOperations
/// Thrown when a required parameter is null
///
- internal ImportExportOperations(SqlManagementClient client)
+ internal FirewallRulesOperations(SqlManagementClient client)
{
if (client == null)
{
@@ -51,7 +51,7 @@ internal ImportExportOperations(SqlManagementClient client)
public SqlManagementClient Client { get; private set; }
///
- /// The status of an import operation given the operation ID.
+ /// Creates or updates a firewall rule.
///
///
/// The name of the resource group that contains the resource. You can obtain
@@ -60,6 +60,12 @@ internal ImportExportOperations(SqlManagementClient client)
///
/// The name of the server.
///
+ ///
+ /// The name of the firewall rule.
+ ///
+ ///
+ /// The required parameters for creating or updating a firewall rule.
+ ///
///
/// Headers that will be added to request.
///
@@ -81,7 +87,7 @@ internal ImportExportOperations(SqlManagementClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, FirewallRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.SubscriptionId == null)
{
@@ -95,6 +101,18 @@ internal ImportExportOperations(SqlManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "serverName");
}
+ if (firewallRuleName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "firewallRuleName");
+ }
+ if (parameters == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
+ }
+ if (parameters != null)
+ {
+ parameters.Validate();
+ }
string apiVersion = "2014-04-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
@@ -106,15 +124,18 @@ internal ImportExportOperations(SqlManagementClient client)
tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("serverName", serverName);
+ tracingParameters.Add("firewallRuleName", firewallRuleName);
+ tracingParameters.Add("parameters", parameters);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "ListByServer", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", 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.Sql/servers/{serverName}/importExportOperationResults").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName));
+ _url = _url.Replace("{firewallRuleName}", System.Uri.EscapeDataString(firewallRuleName));
List _queryParameters = new List();
if (apiVersion != null)
{
@@ -125,9 +146,9 @@ internal ImportExportOperations(SqlManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- var _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ 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)
@@ -142,6 +163,8 @@ internal ImportExportOperations(SqlManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -156,6 +179,12 @@ internal ImportExportOperations(SqlManagementClient client)
// Serialize Request
string _requestContent = null;
+ if(parameters != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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)
{
@@ -176,7 +205,7 @@ internal ImportExportOperations(SqlManagementClient client)
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
- if ((int)_statusCode != 200)
+ if ((int)_statusCode != 200 && (int)_statusCode != 201)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
@@ -189,7 +218,7 @@ internal ImportExportOperations(SqlManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -211,7 +240,7 @@ internal ImportExportOperations(SqlManagementClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse>();
+ var _result = new AzureOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -224,9 +253,27 @@ internal ImportExportOperations(SqlManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 201)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -244,7 +291,190 @@ internal ImportExportOperations(SqlManagementClient client)
}
///
- /// The of an import operation given the operation ID.
+ /// Deletes a firewall rule.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server.
+ ///
+ ///
+ /// The name of the firewall rule.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, 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 (serverName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "serverName");
+ }
+ if (firewallRuleName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "firewallRuleName");
+ }
+ string apiVersion = "2014-04-01";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("serverName", serverName);
+ tracingParameters.Add("firewallRuleName", firewallRuleName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Delete", 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.Sql/servers/{serverName}/firewallRules/{firewallRuleName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName));
+ _url = _url.Replace("{firewallRuleName}", System.Uri.EscapeDataString(firewallRuleName));
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("DELETE");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200 && (int)_statusCode != 204)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Gets a firewall rule.
///
///
/// The name of the resource group that contains the resource. You can obtain
@@ -253,8 +483,8 @@ internal ImportExportOperations(SqlManagementClient client)
///
/// The name of the server.
///
- ///
- /// The operation ID associated with the operation.
+ ///
+ /// The name of the firewall rule.
///
///
/// Headers that will be added to request.
@@ -277,7 +507,7 @@ internal ImportExportOperations(SqlManagementClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> GetByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, System.Guid operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string firewallRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.SubscriptionId == null)
{
@@ -291,6 +521,10 @@ internal ImportExportOperations(SqlManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "serverName");
}
+ if (firewallRuleName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "firewallRuleName");
+ }
string apiVersion = "2014-04-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
@@ -302,17 +536,17 @@ internal ImportExportOperations(SqlManagementClient client)
tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("serverName", serverName);
- tracingParameters.Add("operationId", operationId);
+ tracingParameters.Add("firewallRuleName", firewallRuleName);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "GetByServer", tracingParameters);
+ 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.Sql/servers/{serverName}/importExportOperationResults/{operationId}").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName));
- _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(operationId, Client.SerializationSettings).Trim('"')));
+ _url = _url.Replace("{firewallRuleName}", System.Uri.EscapeDataString(firewallRuleName));
List _queryParameters = new List();
if (apiVersion != null)
{
@@ -323,9 +557,9 @@ internal ImportExportOperations(SqlManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- var _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ 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)
@@ -340,6 +574,8 @@ internal ImportExportOperations(SqlManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -387,7 +623,7 @@ internal ImportExportOperations(SqlManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -409,7 +645,7 @@ internal ImportExportOperations(SqlManagementClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse();
+ var _result = new AzureOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -422,9 +658,9 @@ internal ImportExportOperations(SqlManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -442,8 +678,7 @@ internal ImportExportOperations(SqlManagementClient client)
}
///
- /// The status of an import or export operation on a database given the
- /// operation ID.
+ /// Returns a list of firewall rules.
///
///
/// The name of the resource group that contains the resource. You can obtain
@@ -452,12 +687,6 @@ internal ImportExportOperations(SqlManagementClient client)
///
/// The name of the server.
///
- ///
- /// The name of the database
- ///
- ///
- /// The operation ID associated with the operation.
- ///
///
/// Headers that will be added to request.
///
@@ -479,7 +708,7 @@ internal ImportExportOperations(SqlManagementClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> GetByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, System.Guid operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.SubscriptionId == null)
{
@@ -493,10 +722,6 @@ internal ImportExportOperations(SqlManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "serverName");
}
- if (databaseName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "databaseName");
- }
string apiVersion = "2014-04-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
@@ -508,19 +733,15 @@ internal ImportExportOperations(SqlManagementClient client)
tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("serverName", serverName);
- tracingParameters.Add("databaseName", databaseName);
- tracingParameters.Add("operationId", operationId);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "GetByDatabase", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "ListByServer", 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.Sql/servers/{serverName}/databases/{databaseName}/importExportOperationResults/{operationId}").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName));
- _url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName));
- _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(operationId, Client.SerializationSettings).Trim('"')));
List _queryParameters = new List();
if (apiVersion != null)
{
@@ -531,9 +752,9 @@ internal ImportExportOperations(SqlManagementClient client)
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- var _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ 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)
@@ -548,6 +769,8 @@ internal ImportExportOperations(SqlManagementClient client)
}
_httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -595,7 +818,7 @@ internal ImportExportOperations(SqlManagementClient client)
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
@@ -617,7 +840,7 @@ internal ImportExportOperations(SqlManagementClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse();
+ var _result = new AzureOperationResponse>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -630,9 +853,9 @@ internal ImportExportOperations(SqlManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -651,4 +874,3 @@ internal ImportExportOperations(SqlManagementClient client)
}
}
-
diff --git a/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/FirewallRulesOperationsExtensions.cs b/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/FirewallRulesOperationsExtensions.cs
new file mode 100644
index 000000000000..4246d5728b3d
--- /dev/null
+++ b/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/FirewallRulesOperationsExtensions.cs
@@ -0,0 +1,216 @@
+// 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 1.0.1.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Sql
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Extension methods for FirewallRulesOperations.
+ ///
+ public static partial class FirewallRulesOperationsExtensions
+ {
+ ///
+ /// Creates or updates a firewall rule.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server.
+ ///
+ ///
+ /// The name of the firewall rule.
+ ///
+ ///
+ /// The required parameters for creating or updating a firewall rule.
+ ///
+ public static FirewallRule CreateOrUpdate(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName, FirewallRule parameters)
+ {
+ return operations.CreateOrUpdateAsync(resourceGroupName, serverName, firewallRuleName, parameters).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Creates or updates a firewall rule.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server.
+ ///
+ ///
+ /// The name of the firewall rule.
+ ///
+ ///
+ /// The required parameters for creating or updating a firewall rule.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task CreateOrUpdateAsync(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName, FirewallRule parameters, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, firewallRuleName, parameters, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Deletes a firewall rule.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server.
+ ///
+ ///
+ /// The name of the firewall rule.
+ ///
+ public static void Delete(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName)
+ {
+ operations.DeleteAsync(resourceGroupName, serverName, firewallRuleName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Deletes a firewall rule.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server.
+ ///
+ ///
+ /// The name of the firewall rule.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task DeleteAsync(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serverName, firewallRuleName, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ }
+
+ ///
+ /// Gets a firewall rule.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server.
+ ///
+ ///
+ /// The name of the firewall rule.
+ ///
+ public static FirewallRule Get(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName)
+ {
+ return operations.GetAsync(resourceGroupName, serverName, firewallRuleName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets a firewall rule.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server.
+ ///
+ ///
+ /// The name of the firewall rule.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetAsync(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, string firewallRuleName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, firewallRuleName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Returns a list of firewall rules.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server.
+ ///
+ public static IEnumerable ListByServer(this IFirewallRulesOperations operations, string resourceGroupName, string serverName)
+ {
+ return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Returns a list of firewall rules.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListByServerAsync(this IFirewallRulesOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/ICapabilitiesOperations.cs b/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/ICapabilitiesOperations.cs
new file mode 100644
index 000000000000..153262fa1851
--- /dev/null
+++ b/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/ICapabilitiesOperations.cs
@@ -0,0 +1,49 @@
+// 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 1.0.1.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Sql
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// CapabilitiesOperations operations.
+ ///
+ public partial interface ICapabilitiesOperations
+ {
+ ///
+ /// Gets the capabilities available for the specified location.
+ ///
+ ///
+ /// The location id whose capabilities are retrieved.
+ ///
+ ///
+ /// 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> ListByLocationWithHttpMessagesAsync(string locationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
diff --git a/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/IDatabasesOperations.cs b/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/IDatabasesOperations.cs
index dbf23eee5e6a..900aff386484 100644
--- a/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/IDatabasesOperations.cs
+++ b/src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/IDatabasesOperations.cs
@@ -2,16 +2,16 @@
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
-// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
+// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
namespace Microsoft.Azure.Management.Sql
{
- using Azure;
- using Management;
- using Rest;
- using Rest.Azure;
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
using Models;
using System.Collections;
using System.Collections.Generic;
@@ -24,8 +24,38 @@ namespace Microsoft.Azure.Management.Sql
public partial interface IDatabasesOperations
{
///
- /// Imports a bacpac into an existing database. The existing database
- /// must be empty.
+ /// Imports a bacpac into a new database.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can
+ /// obtain this value from the Azure Resource Manager API or the
+ /// portal.
+ ///
+ ///
+ /// The name of the server.
+ ///
+ ///
+ /// The required parameters for importing a Bacpac into a database.
+ ///
+ ///
+ /// 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> ImportWithHttpMessagesAsync(string resourceGroupName, string serverName, ImportRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///