diff --git a/src/SDKs/SqlManagement/AzSdk.RP.props b/src/SDKs/SqlManagement/AzSdk.RP.props
index 06bec3382c45..22f6af87da04 100644
--- a/src/SDKs/SqlManagement/AzSdk.RP.props
+++ b/src/SDKs/SqlManagement/AzSdk.RP.props
@@ -1,7 +1,7 @@
- Sql_2017-03-01-preview;Sql_2014-04-01;Sql_2015-05-01-preview;Sql_2017-10-01-preview;
+ Sql_2017-03-01-preview;Sql_2017-10-01-preview;Sql_2014-04-01;Sql_2015-05-01-preview;
$(PackageTags);$(CommonTags);$(AzureApiTag);
\ No newline at end of file
diff --git a/src/SDKs/SqlManagement/Management.Sql/Customizations/Models/Database.cs b/src/SDKs/SqlManagement/Management.Sql/Customizations/Models/Database.cs
new file mode 100644
index 000000000000..d282987bd1c9
--- /dev/null
+++ b/src/SDKs/SqlManagement/Management.Sql/Customizations/Models/Database.cs
@@ -0,0 +1,58 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+
+namespace Microsoft.Azure.Management.Sql.Models
+{
+ using System;
+ using System.Linq;
+ using Newtonsoft.Json;
+
+ public partial class Database : TrackedResource
+ {
+ ///
+ /// Gets the edition of the database. If createMode is OnlineSecondary, this value is
+ /// ignored.To see possible values, query the capabilities API
+ /// (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities)
+ /// referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI
+ /// command az sql db list-editions -l westus --query[].name. Possible values include:
+ /// 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', 'Stretch',
+ /// 'DataWarehouse', 'System', 'System2'
+ ///
+ [JsonIgnore]
+ public string Edition
+ {
+ get
+ {
+ return Sku?.Tier;
+ }
+ }
+
+ ///
+ /// Gets the current service level objective of the database.
+ ///
+ [JsonIgnore]
+ public string ServiceLevelObjective
+ {
+ get
+ {
+ return CurrentServiceObjectiveName;
+ }
+ }
+
+ ///
+ /// Gets the name of the elastic pool the database is in. If elasticPoolName and
+ /// requestedServiceObjectiveName are both updated, the value of
+ /// requestedServiceObjectiveName is ignored. Not supported for DataWarehouse
+ /// edition.
+ ///
+ [JsonIgnore]
+ public string ElasticPoolName
+ {
+ get
+ {
+ return ResourceIdHelpers.GetLastSegment(ElasticPoolId);
+ }
+ }
+ }
+}
diff --git a/src/SDKs/SqlManagement/Management.Sql/Customizations/Models/DatabaseUpdate.cs b/src/SDKs/SqlManagement/Management.Sql/Customizations/Models/DatabaseUpdate.cs
new file mode 100644
index 000000000000..03e5f4a8bcfe
--- /dev/null
+++ b/src/SDKs/SqlManagement/Management.Sql/Customizations/Models/DatabaseUpdate.cs
@@ -0,0 +1,55 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+
+namespace Microsoft.Azure.Management.Sql.Models
+{
+ using System;
+ using System.Linq;
+ using Newtonsoft.Json;
+
+ public partial class DatabaseUpdate : TrackedResource
+ {
+ ///
+ /// Gets the edition of the database. If createMode is OnlineSecondary, this value is
+ /// ignored.To see possible values, query the capabilities API
+ /// (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities)
+ /// referred to by operationId: "Capabilities_ListByLocation." or use the Azure CLI
+ /// command az sql db list-editions -l westus --query[].name. Possible values include:
+ /// 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', 'Stretch',
+ /// 'DataWarehouse', 'System', 'System2'
+ ///
+ public string Edition
+ {
+ get
+ {
+ return Sku?.Tier;
+ }
+ }
+
+ ///
+ /// Gets the current service level objective of the database.
+ ///
+ public string ServiceLevelObjective
+ {
+ get
+ {
+ return CurrentServiceObjectiveName;
+ }
+ }
+
+ ///
+ /// Gets the name of the elastic pool the database is in. If elasticPoolName and
+ /// requestedServiceObjectiveName are both updated, the value of
+ /// requestedServiceObjectiveName is ignored. Not supported for DataWarehouse
+ /// edition.
+ ///
+ public string ElasticPoolName
+ {
+ get
+ {
+ return ResourceIdHelpers.GetLastSegment(ElasticPoolId);
+ }
+ }
+ }
+}
diff --git a/src/SDKs/SqlManagement/Management.Sql/Customizations/Models/ElasticPool.cs b/src/SDKs/SqlManagement/Management.Sql/Customizations/Models/ElasticPool.cs
new file mode 100644
index 000000000000..157c469655c4
--- /dev/null
+++ b/src/SDKs/SqlManagement/Management.Sql/Customizations/Models/ElasticPool.cs
@@ -0,0 +1,97 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+
+namespace Microsoft.Azure.Management.Sql.Models
+{
+ using System;
+ using System.Linq;
+ using Newtonsoft.Json;
+
+ public partial class ElasticPool : TrackedResource
+ {
+ ///
+ /// Gets or sets the edition of the elastic pool. Possible values include: 'Basic', 'Standard', 'Premium'
+ ///
+ public string Edition
+ {
+ get
+ {
+ return Sku?.Tier;
+ }
+ }
+
+ ///
+ /// Gets the total shared DTU for the database elastic pool.
+ ///
+ public int? Dtu
+ {
+ get
+ {
+ return Sku?.Capacity;
+ }
+ }
+
+ ///
+ /// Gets storage limit for the database elastic pool in MB.
+ ///
+ public int? StorageMB
+ {
+ get
+ {
+ if (MaxSizeBytes == null)
+ {
+ return null;
+ }
+
+ return (int)(MaxSizeBytes / 1024 / 1024);
+ }
+ set
+ {
+ MaxSizeBytes = value * 1024 * 1024;
+ }
+ }
+
+ ///
+ /// Gets or sets the minimum DTU all databases are guaranteed.
+ ///
+ [JsonIgnore]
+ public int? DatabaseDtuMin
+ {
+ get
+ {
+ return (int?)PerDatabaseSettings?.MinCapacity;
+ }
+ set
+ {
+ if (PerDatabaseSettings == null)
+ {
+ PerDatabaseSettings = new ElasticPoolPerDatabaseSettings();
+ }
+
+ PerDatabaseSettings.MinCapacity = value;
+ }
+ }
+
+ ///
+ /// Gets or sets the maximum DTU any one database can consume.
+ ///
+ [JsonIgnore]
+ public int? DatabaseDtuMax
+ {
+ get
+ {
+ return (int?)PerDatabaseSettings?.MaxCapacity;
+ }
+ set
+ {
+ if (PerDatabaseSettings == null)
+ {
+ PerDatabaseSettings = new ElasticPoolPerDatabaseSettings();
+ }
+
+ PerDatabaseSettings.MaxCapacity = value;
+ }
+ }
+ }
+}
diff --git a/src/SDKs/SqlManagement/Management.Sql/Customizations/Models/ElasticPoolUpdate.cs b/src/SDKs/SqlManagement/Management.Sql/Customizations/Models/ElasticPoolUpdate.cs
new file mode 100644
index 000000000000..b9283926d372
--- /dev/null
+++ b/src/SDKs/SqlManagement/Management.Sql/Customizations/Models/ElasticPoolUpdate.cs
@@ -0,0 +1,97 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+
+namespace Microsoft.Azure.Management.Sql.Models
+{
+ using System;
+ using System.Linq;
+ using Newtonsoft.Json;
+
+ public partial class ElasticPoolUpdate : TrackedResource
+ {
+ ///
+ /// Gets or sets the edition of the elastic pool. Possible values include: 'Basic', 'Standard', 'Premium'
+ ///
+ public string Edition
+ {
+ get
+ {
+ return Sku?.Tier;
+ }
+ }
+
+ ///
+ /// Gets the total shared DTU for the database elastic pool.
+ ///
+ public int? Dtu
+ {
+ get
+ {
+ return Sku?.Capacity;
+ }
+ }
+
+ ///
+ /// Gets storage limit for the database elastic pool in MB.
+ ///
+ public int? StorageMB
+ {
+ get
+ {
+ if (MaxSizeBytes == null)
+ {
+ return null;
+ }
+
+ return (int)(MaxSizeBytes / 1024 / 1024);
+ }
+ set
+ {
+ MaxSizeBytes = value * 1024 * 1024;
+ }
+ }
+
+ ///
+ /// Gets or sets the minimum DTU all databases are guaranteed.
+ ///
+ [JsonIgnore]
+ public int? DatabaseDtuMin
+ {
+ get
+ {
+ return (int?)PerDatabaseSettings?.MinCapacity;
+ }
+ set
+ {
+ if (PerDatabaseSettings == null)
+ {
+ PerDatabaseSettings = new ElasticPoolPerDatabaseSettings();
+ }
+
+ PerDatabaseSettings.MinCapacity = value;
+ }
+ }
+
+ ///
+ /// Gets or sets the maximum DTU any one database can consume.
+ ///
+ [JsonIgnore]
+ public int? DatabaseDtuMax
+ {
+ get
+ {
+ return (int?)PerDatabaseSettings?.MaxCapacity;
+ }
+ set
+ {
+ if (PerDatabaseSettings == null)
+ {
+ PerDatabaseSettings = new ElasticPoolPerDatabaseSettings();
+ }
+
+ PerDatabaseSettings.MaxCapacity = value;
+ }
+ }
+ }
+}
diff --git a/src/SDKs/SqlManagement/Management.Sql/Customizations/ResourceIdHelpers.cs b/src/SDKs/SqlManagement/Management.Sql/Customizations/ResourceIdHelpers.cs
new file mode 100644
index 000000000000..bcdced60e7eb
--- /dev/null
+++ b/src/SDKs/SqlManagement/Management.Sql/Customizations/ResourceIdHelpers.cs
@@ -0,0 +1,35 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+
+namespace Microsoft.Azure.Management.Sql
+{
+ using System;
+ using System.Linq;
+
+ ///
+ /// Helpers methods for working with resource ids.
+ ///
+ internal static class ResourceIdHelpers
+ {
+ ///
+ /// Gets the last segments of a resource id, or null if the id is null.
+ ///
+ /// The resource id.
+ public static string GetLastSegment(string resourceId)
+ {
+ if (resourceId == null)
+ {
+ return null;
+ }
+
+ // Uri.Segments is only supported for absolute uris, so we give
+ // a fake host name.
+ Uri uri = new Uri(
+ new Uri("https://my.example"), // Dummy host name
+ resourceId);
+
+ return uri.Segments.Last();
+ }
+ }
+}
diff --git a/src/SDKs/SqlManagement/Management.Sql/Generated/CapabilitiesOperations.cs b/src/SDKs/SqlManagement/Management.Sql/Generated/CapabilitiesOperations.cs
index a89d167ce1af..9613b5960ba5 100644
--- a/src/SDKs/SqlManagement/Management.Sql/Generated/CapabilitiesOperations.cs
+++ b/src/SDKs/SqlManagement/Management.Sql/Generated/CapabilitiesOperations.cs
@@ -51,10 +51,15 @@ internal CapabilitiesOperations(SqlManagementClient client)
public SqlManagementClient Client { get; private set; }
///
- /// Gets the capabilities available for the specified location.
+ /// Gets the subscription capabilities available for the specified location.
///
- ///
- /// The location id whose capabilities are retrieved.
+ ///
+ /// The location name whose capabilities are retrieved.
+ ///
+ ///
+ /// If specified, restricts the response to only include the selected item.
+ /// Possible values include: 'supportedEditions',
+ /// 'supportedElasticPoolEditions', 'supportedManagedInstanceVersions'
///
///
/// Headers that will be added to request.
@@ -77,17 +82,17 @@ internal CapabilitiesOperations(SqlManagementClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> ListByLocationWithHttpMessagesAsync(string locationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> ListByLocationWithHttpMessagesAsync(string locationName, string include = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (Client.SubscriptionId == null)
+ if (locationName == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "locationName");
}
- if (locationId == null)
+ if (Client.SubscriptionId == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "locationId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
- string apiVersion = "2014-04-01";
+ string apiVersion = "2017-10-01-preview";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -95,17 +100,22 @@ internal CapabilitiesOperations(SqlManagementClient client)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("locationName", locationName);
+ tracingParameters.Add("include", include);
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();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/capabilities").ToString();
+ _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName));
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
- _url = _url.Replace("{locationId}", System.Uri.EscapeDataString(locationId));
List _queryParameters = new List();
+ if (include != null)
+ {
+ _queryParameters.Add(string.Format("include={0}", System.Uri.EscapeDataString(include)));
+ }
if (apiVersion != null)
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
diff --git a/src/SDKs/SqlManagement/Management.Sql/Generated/CapabilitiesOperationsExtensions.cs b/src/SDKs/SqlManagement/Management.Sql/Generated/CapabilitiesOperationsExtensions.cs
index 9485f73d84e3..f3aa65d865c3 100644
--- a/src/SDKs/SqlManagement/Management.Sql/Generated/CapabilitiesOperationsExtensions.cs
+++ b/src/SDKs/SqlManagement/Management.Sql/Generated/CapabilitiesOperationsExtensions.cs
@@ -22,34 +22,44 @@ namespace Microsoft.Azure.Management.Sql
public static partial class CapabilitiesOperationsExtensions
{
///
- /// Gets the capabilities available for the specified location.
+ /// Gets the subscription capabilities available for the specified location.
///
///
/// The operations group for this extension method.
///
- ///
- /// The location id whose capabilities are retrieved.
+ ///
+ /// The location name whose capabilities are retrieved.
///
- public static LocationCapabilities ListByLocation(this ICapabilitiesOperations operations, string locationId)
+ ///
+ /// If specified, restricts the response to only include the selected item.
+ /// Possible values include: 'supportedEditions',
+ /// 'supportedElasticPoolEditions', 'supportedManagedInstanceVersions'
+ ///
+ public static LocationCapabilities ListByLocation(this ICapabilitiesOperations operations, string locationName, string include = default(string))
{
- return operations.ListByLocationAsync(locationId).GetAwaiter().GetResult();
+ return operations.ListByLocationAsync(locationName, include).GetAwaiter().GetResult();
}
///
- /// Gets the capabilities available for the specified location.
+ /// Gets the subscription capabilities available for the specified location.
///
///
/// The operations group for this extension method.
///
- ///
- /// The location id whose capabilities are retrieved.
+ ///
+ /// The location name whose capabilities are retrieved.
+ ///
+ ///
+ /// If specified, restricts the response to only include the selected item.
+ /// Possible values include: 'supportedEditions',
+ /// 'supportedElasticPoolEditions', 'supportedManagedInstanceVersions'
///
///
/// The cancellation token.
///
- public static async Task ListByLocationAsync(this ICapabilitiesOperations operations, string locationId, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task ListByLocationAsync(this ICapabilitiesOperations operations, string locationName, string include = default(string), CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.ListByLocationWithHttpMessagesAsync(locationId, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.ListByLocationWithHttpMessagesAsync(locationName, include, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
diff --git a/src/SDKs/SqlManagement/Management.Sql/Generated/DatabasesOperations.cs b/src/SDKs/SqlManagement/Management.Sql/Generated/DatabasesOperations.cs
index 26c3a7dfd351..3547ef22c10e 100644
--- a/src/SDKs/SqlManagement/Management.Sql/Generated/DatabasesOperations.cs
+++ b/src/SDKs/SqlManagement/Management.Sql/Generated/DatabasesOperations.cs
@@ -51,33 +51,7 @@ internal DatabasesOperations(SqlManagementClient client)
public SqlManagementClient Client { get; private set; }
///
- /// Pauses a data warehouse.
- ///
- ///
- /// 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 data warehouse to pause.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- public async Task PauseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- // Send request
- AzureOperationResponse _response = await BeginPauseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, customHeaders, cancellationToken).ConfigureAwait(false);
- return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
- }
-
- ///
- /// Resumes a data warehouse.
+ /// Imports a bacpac into a new database.
///
///
/// The name of the resource group that contains the resource. You can obtain
@@ -86,8 +60,8 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// The name of the server.
///
- ///
- /// The name of the data warehouse to resume.
+ ///
+ /// The required parameters for importing a Bacpac into a database.
///
///
/// The headers that will be added to request.
@@ -95,15 +69,16 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// The cancellation token.
///
- public async Task ResumeWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> ImportWithHttpMessagesAsync(string resourceGroupName, string serverName, ImportRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Send request
- AzureOperationResponse _response = await BeginResumeWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, customHeaders, cancellationToken).ConfigureAwait(false);
+ AzureOperationResponse _response = await BeginImportWithHttpMessagesAsync(resourceGroupName, serverName, parameters, customHeaders, cancellationToken).ConfigureAwait(false);
return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}
///
- /// Creates a new database or updates an existing database.
+ /// 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
@@ -113,10 +88,10 @@ internal DatabasesOperations(SqlManagementClient client)
/// The name of the server.
///
///
- /// The name of the database to be operated on (updated or created).
+ /// The name of the database to import into
///
///
- /// The required parameters for creating or updating a database.
+ /// The required parameters for importing a Bacpac into a database.
///
///
/// The headers that will be added to request.
@@ -124,15 +99,15 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// The cancellation token.
///
- public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Database 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 BeginCreateOrUpdateWithHttpMessagesAsync(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);
}
///
- /// Updates an existing database.
+ /// Exports a database to a bacpac.
///
///
/// The name of the resource group that contains the resource. You can obtain
@@ -142,10 +117,10 @@ internal DatabasesOperations(SqlManagementClient client)
/// The name of the server.
///
///
- /// The name of the database to be updated.
+ /// The name of the database to be exported.
///
///
- /// The required parameters for updating a database.
+ /// The required parameters for exporting a database.
///
///
/// The headers that will be added to request.
@@ -153,15 +128,15 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// The cancellation token.
///
- public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, DatabaseUpdate 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 BeginUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false);
- return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
+ // Send request
+ AzureOperationResponse _response = await BeginExportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}
///
- /// Deletes a database.
+ /// Returns database metrics.
///
///
/// The name of the resource group that contains the resource. You can obtain
@@ -171,7 +146,10 @@ internal DatabasesOperations(SqlManagementClient client)
/// The name of the server.
///
///
- /// The name of the database to be deleted.
+ /// The name of the database.
+ ///
+ ///
+ /// An OData filter expression that describes a subset of metrics to return.
///
///
/// Headers that will be added to request.
@@ -182,6 +160,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
///
@@ -191,7 +172,7 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task>> ListMetricsWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string filter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.SubscriptionId == null)
{
@@ -209,6 +190,10 @@ internal DatabasesOperations(SqlManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "databaseName");
}
+ if (filter == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "filter");
+ }
string apiVersion = "2014-04-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
@@ -221,12 +206,13 @@ internal DatabasesOperations(SqlManagementClient client)
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("serverName", serverName);
tracingParameters.Add("databaseName", databaseName);
+ tracingParameters.Add("filter", filter);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "ListMetrics", 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}").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/metrics").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));
@@ -236,6 +222,10 @@ internal DatabasesOperations(SqlManagementClient client)
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
}
+ if (filter != null)
+ {
+ _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter)));
+ }
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
@@ -243,7 +233,7 @@ internal DatabasesOperations(SqlManagementClient client)
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("DELETE");
+ _httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
@@ -294,7 +284,7 @@ internal DatabasesOperations(SqlManagementClient client)
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
- if ((int)_statusCode != 200 && (int)_statusCode != 204)
+ if ((int)_statusCode != 200)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
@@ -329,13 +319,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);
@@ -344,7 +352,7 @@ internal DatabasesOperations(SqlManagementClient client)
}
///
- /// Gets a database.
+ /// Returns database metric definitions.
///
///
/// The name of the resource group that contains the resource. You can obtain
@@ -354,11 +362,7 @@ internal DatabasesOperations(SqlManagementClient client)
/// The name of the server.
///
///
- /// The name of the database to be retrieved.
- ///
- ///
- /// A comma separated list of child objects to expand in the response. Possible
- /// properties: serviceTierAdvisors, transparentDataEncryption.
+ /// The name of the database.
///
///
/// Headers that will be added to request.
@@ -381,7 +385,7 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task>> ListMetricDefinitionsWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.SubscriptionId == null)
{
@@ -411,13 +415,12 @@ internal DatabasesOperations(SqlManagementClient client)
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("serverName", serverName);
tracingParameters.Add("databaseName", databaseName);
- tracingParameters.Add("expand", expand);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "ListMetricDefinitions", 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}").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/metricDefinitions").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));
@@ -427,10 +430,6 @@ 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 (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
@@ -524,7 +523,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"))
@@ -537,7 +536,7 @@ 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)
{
@@ -557,7 +556,7 @@ internal DatabasesOperations(SqlManagementClient client)
}
///
- /// Returns a list of databases in a server.
+ /// Upgrades a data warehouse.
///
///
/// The name of the resource group that contains the resource. You can obtain
@@ -566,12 +565,31 @@ 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.
+ ///
+ /// The name of the database to be upgraded.
///
- ///
- /// An OData filter expression that describes a subset of databases to return.
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public async Task UpgradeDataWarehouseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ // Send request
+ AzureOperationResponse _response = await BeginUpgradeDataWarehouseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Gets a list of databases.
+ ///
+ ///
+ /// 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.
///
///
/// Headers that will be added to request.
@@ -594,12 +612,8 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, string expand = default(string), string filter = default(string), 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)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
- }
if (resourceGroupName == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
@@ -608,7 +622,11 @@ internal DatabasesOperations(SqlManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "serverName");
}
- string apiVersion = "2014-04-01";
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ string apiVersion = "2017-10-01-preview";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -616,33 +634,23 @@ 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("expand", expand);
- tracingParameters.Add("filter", filter);
+ tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
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").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("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
List _queryParameters = new List();
if (apiVersion != null)
{
_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)));
- }
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
@@ -736,7 +744,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"))
@@ -749,7 +757,7 @@ 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)
{
@@ -769,7 +777,7 @@ internal DatabasesOperations(SqlManagementClient client)
}
///
- /// Gets a database inside of an elastic pool.
+ /// Gets a database.
///
///
/// The name of the resource group that contains the resource. You can obtain
@@ -778,11 +786,8 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// The name of the server.
///
- ///
- /// The name of the elastic pool to be retrieved.
- ///
///
- /// The name of the database to be retrieved.
+ /// The name of the database.
///
///
/// Headers that will be added to request.
@@ -805,12 +810,8 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> GetByElasticPoolWithHttpMessagesAsync(string resourceGroupName, string serverName, string elasticPoolName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, 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");
@@ -819,15 +820,15 @@ internal DatabasesOperations(SqlManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "serverName");
}
- if (elasticPoolName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "elasticPoolName");
- }
if (databaseName == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "databaseName");
}
- string apiVersion = "2014-04-01";
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ string apiVersion = "2017-10-01-preview";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -835,22 +836,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("elasticPoolName", elasticPoolName);
tracingParameters.Add("databaseName", databaseName);
+ tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "GetByElasticPool", 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}/elasticPools/{elasticPoolName}/databases/{databaseName}").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}").ToString();
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName));
- _url = _url.Replace("{elasticPoolName}", System.Uri.EscapeDataString(elasticPoolName));
_url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName));
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
List _queryParameters = new List();
if (apiVersion != null)
{
@@ -982,7 +981,91 @@ internal DatabasesOperations(SqlManagementClient client)
}
///
- /// Returns a list of databases in an elastic pool.
+ /// Creates a new database or updates an existing 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 name of the database.
+ ///
+ ///
+ /// The requested database resource state.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Database parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ // Send Request
+ AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Deletes the 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 name of the database.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ // Send request
+ AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Updates an existing 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 name of the database.
+ ///
+ ///
+ /// The requested database resource state.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, DatabaseUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ // Send Request
+ AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Gets a list of databases in an elastic pool.
///
///
/// The name of the resource group that contains the resource. You can obtain
@@ -992,7 +1075,7 @@ internal DatabasesOperations(SqlManagementClient client)
/// The name of the server.
///
///
- /// The name of the elastic pool to be retrieved.
+ /// The name of the elastic pool.
///
///
/// Headers that will be added to request.
@@ -1015,12 +1098,8 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task>> ListByElasticPoolWithHttpMessagesAsync(string resourceGroupName, string serverName, string elasticPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task>> ListByElasticPoolWithHttpMessagesAsync(string resourceGroupName, string serverName, string elasticPoolName, 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");
@@ -1033,7 +1112,11 @@ internal DatabasesOperations(SqlManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "elasticPoolName");
}
- string apiVersion = "2014-04-01";
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ string apiVersion = "2017-10-01-preview";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -1041,20 +1124,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("elasticPoolName", elasticPoolName);
+ tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "ListByElasticPool", 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}/elasticPools/{elasticPoolName}/databases").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("{elasticPoolName}", System.Uri.EscapeDataString(elasticPoolName));
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
List _queryParameters = new List();
if (apiVersion != null)
{
@@ -1153,7 +1236,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"))
@@ -1166,7 +1249,7 @@ 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)
{
@@ -1186,7 +1269,7 @@ internal DatabasesOperations(SqlManagementClient client)
}
///
- /// Gets a database inside of a recommented elastic pool.
+ /// Pauses a database.
///
///
/// The name of the resource group that contains the resource. You can obtain
@@ -1195,11 +1278,63 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// The name of the server.
///
- ///
- /// The name of the elastic pool to be retrieved.
+ ///
+ /// The name of the database to be paused.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public async Task> PauseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ // Send request
+ AzureOperationResponse _response = await BeginPauseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Resumes a 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 name of the database to be retrieved.
+ /// The name of the database to be resumed.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public async Task> ResumeWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ // Send request
+ AzureOperationResponse _response = await BeginResumeWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Renames a 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 name of the database to rename.
+ ///
+ ///
+ /// The resource move definition for renaming this database.
///
///
/// Headers that will be added to request.
@@ -1210,9 +1345,6 @@ 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
///
@@ -1222,12 +1354,8 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> GetByRecommendedElasticPoolWithHttpMessagesAsync(string resourceGroupName, string serverName, string recommendedElasticPoolName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task RenameWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ResourceMoveDefinition 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");
@@ -1236,15 +1364,23 @@ internal DatabasesOperations(SqlManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "serverName");
}
- if (recommendedElasticPoolName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "recommendedElasticPoolName");
- }
if (databaseName == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "databaseName");
}
- string apiVersion = "2014-04-01";
+ if (parameters == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
+ }
+ if (parameters != null)
+ {
+ parameters.Validate();
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ string apiVersion = "2017-10-01-preview";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -1252,22 +1388,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("recommendedElasticPoolName", recommendedElasticPoolName);
tracingParameters.Add("databaseName", databaseName);
+ tracingParameters.Add("parameters", parameters);
+ tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "GetByRecommendedElasticPool", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "Rename", 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}/recommendedElasticPools/{recommendedElasticPoolName}/databases/{databaseName}").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/move").ToString();
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName));
- _url = _url.Replace("{recommendedElasticPoolName}", System.Uri.EscapeDataString(recommendedElasticPoolName));
_url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName));
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
List _queryParameters = new List();
if (apiVersion != null)
{
@@ -1280,7 +1415,7 @@ internal DatabasesOperations(SqlManagementClient client)
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.Method = new HttpMethod("POST");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
@@ -1311,6 +1446,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)
{
@@ -1366,31 +1507,13 @@ 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);
@@ -1399,7 +1522,7 @@ internal DatabasesOperations(SqlManagementClient client)
}
///
- /// Returns a list of databases inside a recommented elastic pool.
+ /// Imports a bacpac into a new database.
///
///
/// The name of the resource group that contains the resource. You can obtain
@@ -1408,8 +1531,8 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// The name of the server.
///
- ///
- /// The name of the recommended elastic pool to be retrieved.
+ ///
+ /// The required parameters for importing a Bacpac into a database.
///
///
/// Headers that will be added to request.
@@ -1432,7 +1555,7 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task>> ListByRecommendedElasticPoolWithHttpMessagesAsync(string resourceGroupName, string serverName, string recommendedElasticPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> BeginImportWithHttpMessagesAsync(string resourceGroupName, string serverName, ImportRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.SubscriptionId == null)
{
@@ -1446,9 +1569,13 @@ internal DatabasesOperations(SqlManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "serverName");
}
- if (recommendedElasticPoolName == null)
+ if (parameters == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "recommendedElasticPoolName");
+ throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
+ }
+ if (parameters != null)
+ {
+ parameters.Validate();
}
string apiVersion = "2014-04-01";
// Tracing
@@ -1461,17 +1588,16 @@ internal DatabasesOperations(SqlManagementClient client)
tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("serverName", serverName);
- tracingParameters.Add("recommendedElasticPoolName", recommendedElasticPoolName);
+ tracingParameters.Add("parameters", parameters);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "ListByRecommendedElasticPool", tracingParameters);
+ 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}/recommendedElasticPools/{recommendedElasticPoolName}/databases").ToString();
+ 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));
- _url = _url.Replace("{recommendedElasticPoolName}", System.Uri.EscapeDataString(recommendedElasticPoolName));
List _queryParameters = new List();
if (apiVersion != null)
{
@@ -1484,7 +1610,7 @@ internal DatabasesOperations(SqlManagementClient client)
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.Method = new HttpMethod("POST");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
@@ -1515,6 +1641,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)
{
@@ -1535,7 +1667,7 @@ internal DatabasesOperations(SqlManagementClient client)
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
- if ((int)_statusCode != 200)
+ if ((int)_statusCode != 200 && (int)_statusCode != 202)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
@@ -1570,7 +1702,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"))
@@ -1583,7 +1715,7 @@ 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)
{
@@ -1602,32 +1734,6 @@ internal DatabasesOperations(SqlManagementClient client)
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.
- ///
- ///
- /// 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.
@@ -1646,64 +1752,6 @@ internal DatabasesOperations(SqlManagementClient client)
/// The required parameters for importing a Bacpac into a database.
///
///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- public async Task> CreateImportOperationWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ImportExtensionRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- // Send Request
- AzureOperationResponse _response = await BeginCreateImportOperationWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, customHeaders, cancellationToken).ConfigureAwait(false);
- return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
- }
-
- ///
- /// 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.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- 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);
- return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
- }
-
- ///
- /// Returns database metrics.
- ///
- ///
- /// 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.
- ///
- ///
- /// An OData filter expression that describes a subset of metrics to return.
- ///
- ///
/// Headers that will be added to request.
///
///
@@ -1724,7 +1772,7 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task>> ListMetricsWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string filter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> BeginCreateImportOperationWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ImportExtensionRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.SubscriptionId == null)
{
@@ -1742,11 +1790,16 @@ internal DatabasesOperations(SqlManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "databaseName");
}
- if (filter == null)
+ if (parameters == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "filter");
+ throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
+ }
+ if (parameters != null)
+ {
+ parameters.Validate();
}
string apiVersion = "2014-04-01";
+ string extensionName = "import";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -1758,26 +1811,24 @@ internal DatabasesOperations(SqlManagementClient client)
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("serverName", serverName);
tracingParameters.Add("databaseName", databaseName);
- tracingParameters.Add("filter", filter);
+ tracingParameters.Add("extensionName", extensionName);
+ tracingParameters.Add("parameters", parameters);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "ListMetrics", tracingParameters);
+ 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}/metrics").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions/{extensionName}").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("{extensionName}", System.Uri.EscapeDataString(extensionName));
List _queryParameters = new List();
if (apiVersion != null)
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
}
- if (filter != null)
- {
- _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter)));
- }
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
@@ -1785,7 +1836,7 @@ internal DatabasesOperations(SqlManagementClient client)
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.Method = new HttpMethod("PUT");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
@@ -1816,6 +1867,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)
{
@@ -1836,7 +1893,7 @@ internal DatabasesOperations(SqlManagementClient client)
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
- if ((int)_statusCode != 200)
+ if ((int)_statusCode != 201 && (int)_statusCode != 202)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
@@ -1871,7 +1928,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"))
@@ -1879,12 +1936,12 @@ internal DatabasesOperations(SqlManagementClient client)
_result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
// Deserialize Response
- if ((int)_statusCode == 200)
+ if ((int)_statusCode == 201)
{
_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)
{
@@ -1904,7 +1961,7 @@ internal DatabasesOperations(SqlManagementClient client)
}
///
- /// Returns database metric definitions.
+ /// Exports a database to a bacpac.
///
///
/// The name of the resource group that contains the resource. You can obtain
@@ -1914,7 +1971,10 @@ internal DatabasesOperations(SqlManagementClient client)
/// The name of the server.
///
///
- /// The name of the database.
+ /// The name of the database to be exported.
+ ///
+ ///
+ /// The required parameters for exporting a database.
///
///
/// Headers that will be added to request.
@@ -1937,7 +1997,7 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task>> ListMetricDefinitionsWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> BeginExportWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ExportRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.SubscriptionId == null)
{
@@ -1955,6 +2015,14 @@ 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";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
@@ -1967,12 +2035,13 @@ internal DatabasesOperations(SqlManagementClient client)
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("serverName", serverName);
tracingParameters.Add("databaseName", databaseName);
+ tracingParameters.Add("parameters", parameters);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "ListMetricDefinitions", tracingParameters);
+ 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}/metricDefinitions").ToString();
+ 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));
@@ -1989,7 +2058,7 @@ internal DatabasesOperations(SqlManagementClient client)
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.Method = new HttpMethod("POST");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
@@ -2020,6 +2089,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)
{
@@ -2040,7 +2115,7 @@ internal DatabasesOperations(SqlManagementClient client)
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
- if ((int)_statusCode != 200)
+ if ((int)_statusCode != 200 && (int)_statusCode != 202)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
@@ -2075,7 +2150,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"))
@@ -2088,7 +2163,7 @@ 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)
{
@@ -2108,7 +2183,7 @@ internal DatabasesOperations(SqlManagementClient client)
}
///
- /// Renames a database.
+ /// Upgrades a data warehouse.
///
///
/// The name of the resource group that contains the resource. You can obtain
@@ -2118,10 +2193,7 @@ internal DatabasesOperations(SqlManagementClient client)
/// The name of the server.
///
///
- /// The name of the database to rename.
- ///
- ///
- /// The resource move definition for renaming this database.
+ /// The name of the database to be upgraded.
///
///
/// Headers that will be added to request.
@@ -2141,7 +2213,7 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task RenameWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, ResourceMoveDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task BeginUpgradeDataWarehouseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (resourceGroupName == null)
{
@@ -2155,19 +2227,11 @@ internal DatabasesOperations(SqlManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "databaseName");
}
- if (parameters == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
- }
- if (parameters != null)
- {
- parameters.Validate();
- }
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
- string apiVersion = "2017-03-01-preview";
+ string apiVersion = "2017-10-01-preview";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -2178,14 +2242,13 @@ internal DatabasesOperations(SqlManagementClient client)
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, "Rename", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "BeginUpgradeDataWarehouse", 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}/move").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/upgradeDataWarehouse").ToString();
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName));
_url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName));
@@ -2233,12 +2296,6 @@ 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)
{
@@ -2259,7 +2316,7 @@ internal DatabasesOperations(SqlManagementClient client)
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
- if ((int)_statusCode != 200)
+ if ((int)_statusCode != 200 && (int)_statusCode != 202)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
@@ -2309,7 +2366,7 @@ internal DatabasesOperations(SqlManagementClient client)
}
///
- /// Pauses a data warehouse.
+ /// Creates a new database or updates an existing database.
///
///
/// The name of the resource group that contains the resource. You can obtain
@@ -2319,7 +2376,10 @@ internal DatabasesOperations(SqlManagementClient client)
/// The name of the server.
///
///
- /// The name of the data warehouse to pause.
+ /// The name of the database.
+ ///
+ ///
+ /// The requested database resource state.
///
///
/// Headers that will be added to request.
@@ -2330,6 +2390,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
///
@@ -2339,12 +2402,8 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task BeginPauseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Database 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");
@@ -2357,7 +2416,19 @@ internal DatabasesOperations(SqlManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "databaseName");
}
- string apiVersion = "2014-04-01";
+ if (parameters == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
+ }
+ if (parameters != null)
+ {
+ parameters.Validate();
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ string apiVersion = "2017-10-01-preview";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -2365,20 +2436,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("parameters", parameters);
+ tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginPause", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}").ToString();
_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("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
List _queryParameters = new List();
if (apiVersion != null)
{
@@ -2391,7 +2463,7 @@ internal DatabasesOperations(SqlManagementClient client)
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.Method = new HttpMethod("PUT");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
@@ -2422,6 +2494,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)
{
@@ -2442,7 +2520,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 && (int)_statusCode != 202)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
@@ -2477,13 +2555,49 @@ 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);
+ }
+ }
+ // 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);
@@ -2492,7 +2606,7 @@ internal DatabasesOperations(SqlManagementClient client)
}
///
- /// Resumes a data warehouse.
+ /// Deletes the database.
///
///
/// The name of the resource group that contains the resource. You can obtain
@@ -2502,7 +2616,7 @@ internal DatabasesOperations(SqlManagementClient client)
/// The name of the server.
///
///
- /// The name of the data warehouse to resume.
+ /// The name of the database.
///
///
/// Headers that will be added to request.
@@ -2522,12 +2636,8 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task BeginResumeWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, 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");
@@ -2540,7 +2650,11 @@ internal DatabasesOperations(SqlManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "databaseName");
}
- string apiVersion = "2014-04-01";
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ string apiVersion = "2017-10-01-preview";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -2548,20 +2662,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("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginResume", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}").ToString();
_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("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
List _queryParameters = new List();
if (apiVersion != null)
{
@@ -2574,7 +2688,7 @@ internal DatabasesOperations(SqlManagementClient client)
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.Method = new HttpMethod("DELETE");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
@@ -2625,7 +2739,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 != 202 && (int)_statusCode != 204)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
@@ -2675,7 +2789,7 @@ internal DatabasesOperations(SqlManagementClient client)
}
///
- /// Creates a new database or updates an existing database.
+ /// Updates an existing database.
///
///
/// The name of the resource group that contains the resource. You can obtain
@@ -2685,10 +2799,10 @@ internal DatabasesOperations(SqlManagementClient client)
/// The name of the server.
///
///
- /// The name of the database to be operated on (updated or created).
+ /// The name of the database.
///
///
- /// The required parameters for creating or updating a database.
+ /// The requested database resource state.
///
///
/// Headers that will be added to request.
@@ -2711,12 +2825,8 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Database parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, DatabaseUpdate 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");
@@ -2733,11 +2843,11 @@ internal DatabasesOperations(SqlManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
}
- if (parameters != null)
+ if (Client.SubscriptionId == null)
{
- parameters.Validate();
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
- string apiVersion = "2014-04-01";
+ string apiVersion = "2017-10-01-preview";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -2745,21 +2855,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("parameters", parameters);
+ tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}").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("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
List _queryParameters = new List();
if (apiVersion != null)
{
@@ -2772,7 +2882,7 @@ internal DatabasesOperations(SqlManagementClient client)
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("PUT");
+ _httpRequest.Method = new HttpMethod("PATCH");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
@@ -2829,7 +2939,7 @@ internal DatabasesOperations(SqlManagementClient client)
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
- if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202)
+ if ((int)_statusCode != 200 && (int)_statusCode != 202)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
@@ -2889,24 +2999,6 @@ internal DatabasesOperations(SqlManagementClient client)
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
- // Deserialize Response
- if ((int)_statusCode == 201)
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- try
- {
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- }
- catch (JsonException ex)
- {
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
- }
- }
if (_shouldTrace)
{
ServiceClientTracing.Exit(_invocationId, _result);
@@ -2915,7 +3007,7 @@ internal DatabasesOperations(SqlManagementClient client)
}
///
- /// Updates an existing database.
+ /// Pauses a database.
///
///
/// The name of the resource group that contains the resource. You can obtain
@@ -2925,10 +3017,7 @@ internal DatabasesOperations(SqlManagementClient client)
/// The name of the server.
///
///
- /// The name of the database to be updated.
- ///
- ///
- /// The required parameters for updating a database.
+ /// The name of the database to be paused.
///
///
/// Headers that will be added to request.
@@ -2951,12 +3040,8 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, DatabaseUpdate parameters, 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)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
- }
if (resourceGroupName == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
@@ -2969,11 +3054,11 @@ internal DatabasesOperations(SqlManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "databaseName");
}
- if (parameters == null)
+ if (Client.SubscriptionId == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
- string apiVersion = "2014-04-01";
+ string apiVersion = "2017-10-01-preview";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -2981,21 +3066,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("parameters", parameters);
+ tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "BeginPause", 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}").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause").ToString();
_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("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
List _queryParameters = new List();
if (apiVersion != null)
{
@@ -3008,7 +3092,7 @@ internal DatabasesOperations(SqlManagementClient client)
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("PATCH");
+ _httpRequest.Method = new HttpMethod("POST");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
@@ -3039,12 +3123,6 @@ 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)
{
@@ -3133,7 +3211,7 @@ internal DatabasesOperations(SqlManagementClient client)
}
///
- /// Imports a bacpac into a new database.
+ /// Resumes a database.
///
///
/// The name of the resource group that contains the resource. You can obtain
@@ -3142,8 +3220,8 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// The name of the server.
///
- ///
- /// The required parameters for importing a Bacpac into a database.
+ ///
+ /// The name of the database to be resumed.
///
///
/// Headers that will be added to request.
@@ -3166,12 +3244,8 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// 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))
+ public async Task> BeginResumeWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, 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");
@@ -3180,15 +3254,15 @@ internal DatabasesOperations(SqlManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "serverName");
}
- if (parameters == null)
+ if (databaseName == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
+ throw new ValidationException(ValidationRules.CannotBeNull, "databaseName");
}
- if (parameters != null)
+ if (Client.SubscriptionId == null)
{
- parameters.Validate();
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
- string apiVersion = "2014-04-01";
+ string apiVersion = "2017-10-01-preview";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -3196,19 +3270,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("parameters", parameters);
+ tracingParameters.Add("databaseName", databaseName);
+ tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginImport", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "BeginResume", 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));
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume").ToString();
_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("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
List _queryParameters = new List();
if (apiVersion != null)
{
@@ -3252,12 +3327,6 @@ 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)
{
@@ -3313,7 +3382,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"))
@@ -3326,7 +3395,7 @@ 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)
{
@@ -3346,21 +3415,10 @@ internal DatabasesOperations(SqlManagementClient client)
}
///
- /// Creates an import operation that imports a bacpac into an existing
- /// database. The existing database must be empty.
+ /// Gets a list of databases.
///
- ///
- /// 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.
+ ///
+ /// The NextLink from the previous successful call to List operation.
///
///
/// Headers that will be added to request.
@@ -3383,34 +3441,12 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// 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))
+ public async Task>> ListByServerNextWithHttpMessagesAsync(string nextPageLink, 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)
+ if (nextPageLink == 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();
+ throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink");
}
- string apiVersion = "2014-04-01";
- string extensionName = "import";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -3418,28 +3454,14 @@ 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("extensionName", extensionName);
- tracingParameters.Add("parameters", parameters);
+ tracingParameters.Add("nextPageLink", nextPageLink);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginCreateImportOperation", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "ListByServerNext", 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/{extensionName}").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("{extensionName}", System.Uri.EscapeDataString(extensionName));
+ string _url = "{nextLink}";
+ _url = _url.Replace("{nextLink}", nextPageLink);
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);
@@ -3447,7 +3469,7 @@ internal DatabasesOperations(SqlManagementClient client)
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("PUT");
+ _httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
@@ -3478,12 +3500,6 @@ 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)
{
@@ -3504,7 +3520,7 @@ internal DatabasesOperations(SqlManagementClient client)
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
- if ((int)_statusCode != 201 && (int)_statusCode != 202)
+ if ((int)_statusCode != 200)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
@@ -3539,7 +3555,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"))
@@ -3547,12 +3563,12 @@ internal DatabasesOperations(SqlManagementClient client)
_result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
// Deserialize Response
- if ((int)_statusCode == 201)
+ if ((int)_statusCode == 200)
{
_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)
{
@@ -3572,20 +3588,10 @@ internal DatabasesOperations(SqlManagementClient client)
}
///
- /// Exports a database to a bacpac.
+ /// Gets a list of databases in an elastic pool.
///
- ///
- /// 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.
+ ///
+ /// The NextLink from the previous successful call to List operation.
///
///
/// Headers that will be added to request.
@@ -3608,33 +3614,12 @@ internal DatabasesOperations(SqlManagementClient client)
///
/// 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))
+ public async Task>> ListByElasticPoolNextWithHttpMessagesAsync(string nextPageLink, 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)
+ if (nextPageLink == null)
{
- parameters.Validate();
+ throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink");
}
- string apiVersion = "2014-04-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -3642,26 +3627,14 @@ 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("nextPageLink", nextPageLink);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginExport", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "ListByElasticPoolNext", 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));
+ string _url = "{nextLink}";
+ _url = _url.Replace("{nextLink}", nextPageLink);
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);
@@ -3669,7 +3642,7 @@ internal DatabasesOperations(SqlManagementClient client)
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
@@ -3700,12 +3673,6 @@ 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)
{
@@ -3726,7 +3693,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
@@ -3761,7 +3728,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"))
@@ -3774,7 +3741,7 @@ 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)
{
diff --git a/src/SDKs/SqlManagement/Management.Sql/Generated/DatabasesOperationsExtensions.cs b/src/SDKs/SqlManagement/Management.Sql/Generated/DatabasesOperationsExtensions.cs
index fd9c9ea53d44..379191f6dc60 100644
--- a/src/SDKs/SqlManagement/Management.Sql/Generated/DatabasesOperationsExtensions.cs
+++ b/src/SDKs/SqlManagement/Management.Sql/Generated/DatabasesOperationsExtensions.cs
@@ -24,7 +24,7 @@ namespace Microsoft.Azure.Management.Sql
public static partial class DatabasesOperationsExtensions
{
///
- /// Pauses a data warehouse.
+ /// Imports a bacpac into a new database.
///
///
/// The operations group for this extension method.
@@ -36,16 +36,16 @@ public static partial class DatabasesOperationsExtensions
///
/// The name of the server.
///
- ///
- /// The name of the data warehouse to pause.
+ ///
+ /// The required parameters for importing a Bacpac into a database.
///
- public static void Pause(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName)
+ public static ImportExportResponse Import(this IDatabasesOperations operations, string resourceGroupName, string serverName, ImportRequest parameters)
{
- operations.PauseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult();
+ return operations.ImportAsync(resourceGroupName, serverName, parameters).GetAwaiter().GetResult();
}
///
- /// Pauses a data warehouse.
+ /// Imports a bacpac into a new database.
///
///
/// The operations group for this extension method.
@@ -57,19 +57,23 @@ public static void Pause(this IDatabasesOperations operations, string resourceGr
///
/// The name of the server.
///
- ///
- /// The name of the data warehouse to pause.
+ ///
+ /// The required parameters for importing a Bacpac into a database.
///
///
/// The cancellation token.
///
- public static async Task PauseAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task ImportAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, ImportRequest parameters, CancellationToken cancellationToken = default(CancellationToken))
{
- (await operations.PauseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ using (var _result = await operations.ImportWithHttpMessagesAsync(resourceGroupName, serverName, parameters, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
}
///
- /// Resumes a data warehouse.
+ /// 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.
@@ -82,15 +86,19 @@ public static void Pause(this IDatabasesOperations operations, string resourceGr
/// The name of the server.
///
///
- /// The name of the data warehouse to resume.
+ /// The name of the database to import into
+ ///
+ ///
+ /// The required parameters for importing a Bacpac into a database.
///
- public static void Resume(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName)
+ public static ImportExportResponse CreateImportOperation(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ImportExtensionRequest parameters)
{
- operations.ResumeAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult();
+ return operations.CreateImportOperationAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult();
}
///
- /// Resumes a data warehouse.
+ /// 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.
@@ -103,18 +111,24 @@ public static void Resume(this IDatabasesOperations operations, string resourceG
/// The name of the server.
///
///
- /// The name of the data warehouse to resume.
+ /// The name of the database to import into
+ ///
+ ///
+ /// The required parameters for importing a Bacpac into a database.
///
///
/// The cancellation token.
///
- public static async Task ResumeAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task CreateImportOperationAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ImportExtensionRequest parameters, CancellationToken cancellationToken = default(CancellationToken))
{
- (await operations.ResumeWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ using (var _result = await operations.CreateImportOperationWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
}
///
- /// Creates a new database or updates an existing database.
+ /// Exports a database to a bacpac.
///
///
/// The operations group for this extension method.
@@ -127,18 +141,18 @@ public static void Resume(this IDatabasesOperations operations, string resourceG
/// The name of the server.
///
///
- /// The name of the database to be operated on (updated or created).
+ /// The name of the database to be exported.
///
///
- /// The required parameters for creating or updating a database.
+ /// The required parameters for exporting a database.
///
- public static Database CreateOrUpdate(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, Database parameters)
+ public static ImportExportResponse Export(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportRequest parameters)
{
- return operations.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult();
+ return operations.ExportAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult();
}
///
- /// Creates a new database or updates an existing database.
+ /// Exports a database to a bacpac.
///
///
/// The operations group for this extension method.
@@ -151,24 +165,24 @@ public static Database CreateOrUpdate(this IDatabasesOperations operations, stri
/// The name of the server.
///
///
- /// The name of the database to be operated on (updated or created).
+ /// The name of the database to be exported.
///
///
- /// The required parameters for creating or updating a database.
+ /// The required parameters for exporting a database.
///
///
/// The cancellation token.
///
- public static async Task CreateOrUpdateAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, Database 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.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.ExportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
///
- /// Updates an existing database.
+ /// Returns database metrics.
///
///
/// The operations group for this extension method.
@@ -181,18 +195,18 @@ public static Database CreateOrUpdate(this IDatabasesOperations operations, stri
/// The name of the server.
///
///
- /// The name of the database to be updated.
+ /// The name of the database.
///
- ///
- /// The required parameters for updating a database.
+ ///
+ /// An OData filter expression that describes a subset of metrics to return.
///
- public static Database Update(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, DatabaseUpdate parameters)
+ public static IEnumerable ListMetrics(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, string filter)
{
- return operations.UpdateAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult();
+ return operations.ListMetricsAsync(resourceGroupName, serverName, databaseName, filter).GetAwaiter().GetResult();
}
///
- /// Updates an existing database.
+ /// Returns database metrics.
///
///
/// The operations group for this extension method.
@@ -205,24 +219,24 @@ public static Database Update(this IDatabasesOperations operations, string resou
/// The name of the server.
///
///
- /// The name of the database to be updated.
+ /// The name of the database.
///
- ///
- /// The required parameters for updating a database.
+ ///
+ /// An OData filter expression that describes a subset of metrics to return.
///
///
/// The cancellation token.
///
- public static async Task UpdateAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, DatabaseUpdate parameters, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task> ListMetricsAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, string filter, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.ListMetricsWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, filter, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
///
- /// Deletes a database.
+ /// Returns database metric definitions.
///
///
/// The operations group for this extension method.
@@ -235,15 +249,15 @@ public static Database Update(this IDatabasesOperations operations, string resou
/// The name of the server.
///
///
- /// The name of the database to be deleted.
+ /// The name of the database.
///
- public static void Delete(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName)
+ public static IEnumerable ListMetricDefinitions(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName)
{
- operations.DeleteAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult();
+ return operations.ListMetricDefinitionsAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult();
}
///
- /// Deletes a database.
+ /// Returns database metric definitions.
///
///
/// The operations group for this extension method.
@@ -256,18 +270,21 @@ public static void Delete(this IDatabasesOperations operations, string resourceG
/// The name of the server.
///
///
- /// The name of the database to be deleted.
+ /// The name of the database.
///
///
/// The cancellation token.
///
- public static async Task DeleteAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task> ListMetricDefinitionsAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken))
{
- (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ using (var _result = await operations.ListMetricDefinitionsWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
}
///
- /// Gets a database.
+ /// Upgrades a data warehouse.
///
///
/// The operations group for this extension method.
@@ -280,19 +297,15 @@ public static void Delete(this IDatabasesOperations operations, string resourceG
/// The name of the server.
///
///
- /// The name of the database to be retrieved.
- ///
- ///
- /// A comma separated list of child objects to expand in the response. Possible
- /// properties: serviceTierAdvisors, transparentDataEncryption.
+ /// The name of the database to be upgraded.
///
- public static Database Get(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, string expand = default(string))
+ public static void UpgradeDataWarehouse(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName)
{
- return operations.GetAsync(resourceGroupName, serverName, databaseName, expand).GetAwaiter().GetResult();
+ operations.UpgradeDataWarehouseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult();
}
///
- /// Gets a database.
+ /// Upgrades a data warehouse.
///
///
/// The operations group for this extension method.
@@ -305,25 +318,18 @@ public static void Delete(this IDatabasesOperations operations, string resourceG
/// The name of the server.
///
///
- /// The name of the database to be retrieved.
- ///
- ///
- /// A comma separated list of child objects to expand in the response. Possible
- /// properties: serviceTierAdvisors, transparentDataEncryption.
+ /// The name of the database to be upgraded.
///
///
/// The cancellation token.
///
- public static async Task GetAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task UpgradeDataWarehouseAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, expand, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
+ (await operations.UpgradeDataWarehouseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
///
- /// Returns a list of databases in a server.
+ /// Gets a list of databases.
///
///
/// The operations group for this extension method.
@@ -335,20 +341,13 @@ 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 expand = default(string), string filter = default(string))
+ public static IPage ListByServer(this IDatabasesOperations operations, string resourceGroupName, string serverName)
{
- return operations.ListByServerAsync(resourceGroupName, serverName, expand, filter).GetAwaiter().GetResult();
+ return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult();
}
///
- /// Returns a list of databases in a server.
+ /// Gets a list of databases.
///
///
/// The operations group for this extension method.
@@ -360,26 +359,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 expand = default(string), string filter = default(string), CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task> ListByServerAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, expand, filter, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
///
- /// Gets a database inside of an elastic pool.
+ /// Gets a database.
///
///
/// The operations group for this extension method.
@@ -391,19 +383,16 @@ public static void Delete(this IDatabasesOperations operations, string resourceG
///
/// The name of the server.
///
- ///
- /// The name of the elastic pool to be retrieved.
- ///
///
- /// The name of the database to be retrieved.
+ /// The name of the database.
///
- public static Database GetByElasticPool(this IDatabasesOperations operations, string resourceGroupName, string serverName, string elasticPoolName, string databaseName)
+ public static Database Get(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName)
{
- return operations.GetByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName, databaseName).GetAwaiter().GetResult();
+ return operations.GetAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult();
}
///
- /// Gets a database inside of an elastic pool.
+ /// Gets a database.
///
///
/// The operations group for this extension method.
@@ -415,25 +404,22 @@ public static Database GetByElasticPool(this IDatabasesOperations operations, st
///
/// The name of the server.
///
- ///
- /// The name of the elastic pool to be retrieved.
- ///
///
- /// The name of the database to be retrieved.
+ /// The name of the database.
///
///
/// The cancellation token.
///
- public static async Task GetByElasticPoolAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string elasticPoolName, string databaseName, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task GetAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.GetByElasticPoolWithHttpMessagesAsync(resourceGroupName, serverName, elasticPoolName, databaseName, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
///
- /// Returns a list of databases in an elastic pool.
+ /// Creates a new database or updates an existing database.
///
///
/// The operations group for this extension method.
@@ -445,16 +431,19 @@ public static Database GetByElasticPool(this IDatabasesOperations operations, st
///
/// The name of the server.
///
- ///
- /// The name of the elastic pool to be retrieved.
+ ///
+ /// The name of the database.
+ ///
+ ///
+ /// The requested database resource state.
///
- public static IEnumerable ListByElasticPool(this IDatabasesOperations operations, string resourceGroupName, string serverName, string elasticPoolName)
+ public static Database CreateOrUpdate(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, Database parameters)
{
- return operations.ListByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName).GetAwaiter().GetResult();
+ return operations.CreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult();
}
///
- /// Returns a list of databases in an elastic pool.
+ /// Creates a new database or updates an existing database.
///
///
/// The operations group for this extension method.
@@ -466,22 +455,25 @@ public static IEnumerable ListByElasticPool(this IDatabasesOperations
///
/// The name of the server.
///
- ///
- /// The name of the elastic pool to be retrieved.
+ ///
+ /// The name of the database.
+ ///
+ ///
+ /// The requested database resource state.
///
///
/// The cancellation token.
///
- public static async Task> ListByElasticPoolAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string elasticPoolName, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task CreateOrUpdateAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, Database parameters, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.ListByElasticPoolWithHttpMessagesAsync(resourceGroupName, serverName, elasticPoolName, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
///
- /// Gets a database inside of a recommented elastic pool.
+ /// Deletes the database.
///
///
/// The operations group for this extension method.
@@ -493,19 +485,16 @@ public static IEnumerable ListByElasticPool(this IDatabasesOperations
///
/// The name of the server.
///
- ///
- /// The name of the elastic pool to be retrieved.
- ///
///
- /// The name of the database to be retrieved.
+ /// The name of the database.
///
- public static Database GetByRecommendedElasticPool(this IDatabasesOperations operations, string resourceGroupName, string serverName, string recommendedElasticPoolName, string databaseName)
+ public static void Delete(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName)
{
- return operations.GetByRecommendedElasticPoolAsync(resourceGroupName, serverName, recommendedElasticPoolName, databaseName).GetAwaiter().GetResult();
+ operations.DeleteAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult();
}
///
- /// Gets a database inside of a recommented elastic pool.
+ /// Deletes the database.
///
///
/// The operations group for this extension method.
@@ -517,25 +506,19 @@ public static Database GetByRecommendedElasticPool(this IDatabasesOperations ope
///
/// The name of the server.
///
- ///
- /// The name of the elastic pool to be retrieved.
- ///
///
- /// The name of the database to be retrieved.
+ /// The name of the database.
///
///
/// The cancellation token.
///
- public static async Task GetByRecommendedElasticPoolAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string recommendedElasticPoolName, string databaseName, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task DeleteAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.GetByRecommendedElasticPoolWithHttpMessagesAsync(resourceGroupName, serverName, recommendedElasticPoolName, databaseName, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
+ (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
///
- /// Returns a list of databases inside a recommented elastic pool.
+ /// Updates an existing database.
///
///
/// The operations group for this extension method.
@@ -547,16 +530,19 @@ public static Database GetByRecommendedElasticPool(this IDatabasesOperations ope
///
/// The name of the server.
///
- ///
- /// The name of the recommended elastic pool to be retrieved.
+ ///
+ /// The name of the database.
+ ///
+ ///
+ /// The requested database resource state.
///
- public static IEnumerable ListByRecommendedElasticPool(this IDatabasesOperations operations, string resourceGroupName, string serverName, string recommendedElasticPoolName)
+ public static Database Update(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, DatabaseUpdate parameters)
{
- return operations.ListByRecommendedElasticPoolAsync(resourceGroupName, serverName, recommendedElasticPoolName).GetAwaiter().GetResult();
+ return operations.UpdateAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult();
}
///
- /// Returns a list of databases inside a recommented elastic pool.
+ /// Updates an existing database.
///
///
/// The operations group for this extension method.
@@ -568,22 +554,25 @@ public static IEnumerable ListByRecommendedElasticPool(this IDatabases
///
/// The name of the server.
///
- ///
- /// The name of the recommended elastic pool to be retrieved.
+ ///
+ /// The name of the database.
+ ///
+ ///
+ /// The requested database resource state.
///
///
/// The cancellation token.
///
- public static async Task> ListByRecommendedElasticPoolAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string recommendedElasticPoolName, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task UpdateAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, DatabaseUpdate parameters, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.ListByRecommendedElasticPoolWithHttpMessagesAsync(resourceGroupName, serverName, recommendedElasticPoolName, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
///
- /// Imports a bacpac into a new database.
+ /// Gets a list of databases in an elastic pool.
///
///
/// The operations group for this extension method.
@@ -595,16 +584,16 @@ public static IEnumerable ListByRecommendedElasticPool(this IDatabases
///
/// The name of the server.
///
- ///
- /// The required parameters for importing a Bacpac into a database.
+ ///
+ /// The name of the elastic pool.
///
- public static ImportExportResponse Import(this IDatabasesOperations operations, string resourceGroupName, string serverName, ImportRequest parameters)
+ public static IPage ListByElasticPool(this IDatabasesOperations operations, string resourceGroupName, string serverName, string elasticPoolName)
{
- return operations.ImportAsync(resourceGroupName, serverName, parameters).GetAwaiter().GetResult();
+ return operations.ListByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName).GetAwaiter().GetResult();
}
///
- /// Imports a bacpac into a new database.
+ /// Gets a list of databases in an elastic pool.
///
///
/// The operations group for this extension method.
@@ -616,23 +605,22 @@ public static ImportExportResponse Import(this IDatabasesOperations operations,
///
/// The name of the server.
///
- ///
- /// The required parameters for importing a Bacpac into a database.
+ ///
+ /// The name of the elastic pool.
///
///
/// The cancellation token.
///
- public static async Task ImportAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, ImportRequest parameters, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task> ListByElasticPoolAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string elasticPoolName, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.ImportWithHttpMessagesAsync(resourceGroupName, serverName, parameters, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.ListByElasticPoolWithHttpMessagesAsync(resourceGroupName, serverName, elasticPoolName, 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.
+ /// Pauses a database.
///
///
/// The operations group for this extension method.
@@ -645,19 +633,15 @@ public static ImportExportResponse Import(this IDatabasesOperations operations,
/// 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 to be paused.
///
- public static ImportExportResponse CreateImportOperation(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ImportExtensionRequest parameters)
+ public static Database Pause(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName)
{
- return operations.CreateImportOperationAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult();
+ return operations.PauseAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult();
}
///
- /// Creates an import operation that imports a bacpac into an existing
- /// database. The existing database must be empty.
+ /// Pauses a database.
///
///
/// The operations group for this extension method.
@@ -670,24 +654,21 @@ public static ImportExportResponse CreateImportOperation(this IDatabasesOperatio
/// 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 to be paused.
///
///
/// The cancellation token.
///
- public static async Task CreateImportOperationAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ImportExtensionRequest parameters, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task PauseAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.CreateImportOperationWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.PauseWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
///
- /// Exports a database to a bacpac.
+ /// Resumes a database.
///
///
/// The operations group for this extension method.
@@ -700,18 +681,15 @@ public static ImportExportResponse CreateImportOperation(this IDatabasesOperatio
/// The name of the server.
///
///
- /// The name of the database to be exported.
- ///
- ///
- /// The required parameters for exporting a database.
+ /// The name of the database to be resumed.
///
- public static ImportExportResponse Export(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportRequest parameters)
+ public static Database Resume(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName)
{
- return operations.ExportAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult();
+ return operations.ResumeAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult();
}
///
- /// Exports a database to a bacpac.
+ /// Resumes a database.
///
///
/// The operations group for this extension method.
@@ -724,24 +702,21 @@ public static ImportExportResponse Export(this IDatabasesOperations operations,
/// The name of the server.
///
///
- /// The name of the database to be exported.
- ///
- ///
- /// The required parameters for exporting a database.
+ /// The name of the database to be resumed.
///
///
/// The cancellation token.
///
- public static async Task ExportAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ExportRequest parameters, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task ResumeAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.ExportWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.ResumeWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
///
- /// Returns database metrics.
+ /// Renames a database.
///
///
/// The operations group for this extension method.
@@ -754,18 +729,18 @@ public static ImportExportResponse Export(this IDatabasesOperations operations,
/// The name of the server.
///
///
- /// The name of the database.
+ /// The name of the database to rename.
///
- ///
- /// An OData filter expression that describes a subset of metrics to return.
+ ///
+ /// The resource move definition for renaming this database.
///
- public static IEnumerable ListMetrics(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, string filter)
+ public static void Rename(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ResourceMoveDefinition parameters)
{
- return operations.ListMetricsAsync(resourceGroupName, serverName, databaseName, filter).GetAwaiter().GetResult();
+ operations.RenameAsync(resourceGroupName, serverName, databaseName, parameters).GetAwaiter().GetResult();
}
///
- /// Returns database metrics.
+ /// Renames a database.
///
///
/// The operations group for this extension method.
@@ -778,24 +753,21 @@ public static IEnumerable ListMetrics(this IDatabasesOperations operatio
/// The name of the server.
///
///
- /// The name of the database.
+ /// The name of the database to rename.
///
- ///
- /// An OData filter expression that describes a subset of metrics to return.
+ ///
+ /// The resource move definition for renaming this database.
///
///
/// The cancellation token.
///
- public static async Task> ListMetricsAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, string filter, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task RenameAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, ResourceMoveDefinition parameters, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.ListMetricsWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, filter, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
+ (await operations.RenameWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
///
- /// Returns database metric definitions.
+ /// Imports a bacpac into a new database.
///
///
/// The operations group for this extension method.
@@ -807,16 +779,16 @@ public static IEnumerable ListMetrics(this IDatabasesOperations operatio
///
/// The name of the server.
///
- ///
- /// The name of the database.
+ ///
+ /// The required parameters for importing a Bacpac into a database.
///
- public static IEnumerable ListMetricDefinitions(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName)
+ public static ImportExportResponse BeginImport(this IDatabasesOperations operations, string resourceGroupName, string serverName, ImportRequest parameters)
{
- return operations.ListMetricDefinitionsAsync(resourceGroupName, serverName, databaseName).GetAwaiter().GetResult();
+ return operations.BeginImportAsync(resourceGroupName, serverName, parameters).GetAwaiter().GetResult();
}
///