diff --git a/src/SDKs/SqlManagement/Management.Sql/Generated/ISqlManagementClient.cs b/src/SDKs/SqlManagement/Management.Sql/Generated/ISqlManagementClient.cs
index 1daf136f2c64..62e4aa90d0ac 100644
--- a/src/SDKs/SqlManagement/Management.Sql/Generated/ISqlManagementClient.cs
+++ b/src/SDKs/SqlManagement/Management.Sql/Generated/ISqlManagementClient.cs
@@ -226,6 +226,21 @@ public partial interface ISqlManagementClient : System.IDisposable
///
IServerKeysOperations ServerKeys { get; }
+ ///
+ /// Gets the ISyncAgentsOperations.
+ ///
+ ISyncAgentsOperations SyncAgents { get; }
+
+ ///
+ /// Gets the ISyncGroupsOperations.
+ ///
+ ISyncGroupsOperations SyncGroups { get; }
+
+ ///
+ /// Gets the ISyncMembersOperations.
+ ///
+ ISyncMembersOperations SyncMembers { get; }
+
///
/// Gets the IVirtualNetworkRulesOperations.
///
diff --git a/src/SDKs/SqlManagement/Management.Sql/Generated/ISyncAgentsOperations.cs b/src/SDKs/SqlManagement/Management.Sql/Generated/ISyncAgentsOperations.cs
new file mode 100644
index 000000000000..09e3ef4b7096
--- /dev/null
+++ b/src/SDKs/SqlManagement/Management.Sql/Generated/ISyncAgentsOperations.cs
@@ -0,0 +1,308 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Sql
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// SyncAgentsOperations operations.
+ ///
+ public partial interface ISyncAgentsOperations
+ {
+ ///
+ /// Gets a sync agent.
+ ///
+ ///
+ /// 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 on which the sync agent is hosted.
+ ///
+ ///
+ /// The name of the sync agent.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string syncAgentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Creates or updates a sync agent.
+ ///
+ ///
+ /// 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 on which the sync agent is hosted.
+ ///
+ ///
+ /// The name of the sync agent.
+ ///
+ ///
+ /// The requested sync agent resource state.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string syncAgentName, SyncAgent parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Deletes a sync agent.
+ ///
+ ///
+ /// 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 on which the sync agent is hosted.
+ ///
+ ///
+ /// The name of the sync agent.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string syncAgentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Lists sync agents in a server.
+ ///
+ ///
+ /// 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 on which the sync agent is hosted.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Generates a sync agent key.
+ ///
+ ///
+ /// 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 on which the sync agent is hosted.
+ ///
+ ///
+ /// The name of the sync agent.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> GenerateKeyWithHttpMessagesAsync(string resourceGroupName, string serverName, string syncAgentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Lists databases linked to a sync agent.
+ ///
+ ///
+ /// 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 on which the sync agent is hosted.
+ ///
+ ///
+ /// The name of the sync agent.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListLinkedDatabasesWithHttpMessagesAsync(string resourceGroupName, string serverName, string syncAgentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Creates or updates a sync agent.
+ ///
+ ///
+ /// 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 on which the sync agent is hosted.
+ ///
+ ///
+ /// The name of the sync agent.
+ ///
+ ///
+ /// The requested sync agent resource state.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string syncAgentName, SyncAgent parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Deletes a sync agent.
+ ///
+ ///
+ /// 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 on which the sync agent is hosted.
+ ///
+ ///
+ /// The name of the sync agent.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string syncAgentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Lists sync agents in a server.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListByServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Lists databases linked to a sync agent.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListLinkedDatabasesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
diff --git a/src/SDKs/SqlManagement/Management.Sql/Generated/ISyncGroupsOperations.cs b/src/SDKs/SqlManagement/Management.Sql/Generated/ISyncGroupsOperations.cs
new file mode 100644
index 000000000000..7d654d5b25b9
--- /dev/null
+++ b/src/SDKs/SqlManagement/Management.Sql/Generated/ISyncGroupsOperations.cs
@@ -0,0 +1,603 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Sql
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// SyncGroupsOperations operations.
+ ///
+ public partial interface ISyncGroupsOperations
+ {
+ ///
+ /// Gets a collection of sync database ids.
+ ///
+ ///
+ /// The name of the region where the resource is located.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListSyncDatabaseIdsWithHttpMessagesAsync(string locationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Refreshes a hub database schema.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task RefreshHubSchemaWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Gets a collection of hub database schemas.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListHubSchemasWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Gets a collection of sync group logs.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group.
+ ///
+ ///
+ /// Get logs generated after this time.
+ ///
+ ///
+ /// Get logs generated before this time.
+ ///
+ ///
+ /// The types of logs to retrieve. Possible values include: 'All',
+ /// 'Error', 'Warning', 'Success'
+ ///
+ ///
+ /// The continuation token for this operation.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListLogsWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, string startTime, string endTime, string type, string continuationToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Cancels a sync group synchronization.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task CancelSyncWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Triggers a sync group synchronization.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task TriggerSyncWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Gets a sync group.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Creates or updates a sync group.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group.
+ ///
+ ///
+ /// The requested sync group resource state.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, SyncGroup parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Deletes a sync group.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Updates a sync group.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group.
+ ///
+ ///
+ /// The requested sync group resource state.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, SyncGroup parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Lists sync groups under a hub 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Refreshes a hub database schema.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task BeginRefreshHubSchemaWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Creates or updates a sync group.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group.
+ ///
+ ///
+ /// The requested sync group resource state.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, SyncGroup parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Deletes a sync group.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Updates a sync group.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group.
+ ///
+ ///
+ /// The requested sync group resource state.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, SyncGroup parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Gets a collection of sync database ids.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListSyncDatabaseIdsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Gets a collection of hub database schemas.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListHubSchemasNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Gets a collection of sync group logs.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListLogsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Lists sync groups under a hub database.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListByDatabaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
diff --git a/src/SDKs/SqlManagement/Management.Sql/Generated/ISyncMembersOperations.cs b/src/SDKs/SqlManagement/Management.Sql/Generated/ISyncMembersOperations.cs
new file mode 100644
index 000000000000..d56ab64cf9c2
--- /dev/null
+++ b/src/SDKs/SqlManagement/Management.Sql/Generated/ISyncMembersOperations.cs
@@ -0,0 +1,464 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Sql
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// SyncMembersOperations operations.
+ ///
+ public partial interface ISyncMembersOperations
+ {
+ ///
+ /// Gets a sync member.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group on which the sync member is hosted.
+ ///
+ ///
+ /// The name of the sync member.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, string syncMemberName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Creates or updates a sync member.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group on which the sync member is hosted.
+ ///
+ ///
+ /// The name of the sync member.
+ ///
+ ///
+ /// The requested sync member resource state.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, string syncMemberName, SyncMember parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Deletes a sync member.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group on which the sync member is hosted.
+ ///
+ ///
+ /// The name of the sync member.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, string syncMemberName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Updates an existing sync member.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group on which the sync member is hosted.
+ ///
+ ///
+ /// The name of the sync member.
+ ///
+ ///
+ /// The requested sync member resource state.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, string syncMemberName, SyncMember parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Lists sync members in the given sync group.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListBySyncGroupWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Gets a sync member database schema.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group on which the sync member is hosted.
+ ///
+ ///
+ /// The name of the sync member.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListMemberSchemasWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, string syncMemberName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Refreshes a sync member database schema.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group on which the sync member is hosted.
+ ///
+ ///
+ /// The name of the sync member.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task RefreshMemberSchemaWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, string syncMemberName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Creates or updates a sync member.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group on which the sync member is hosted.
+ ///
+ ///
+ /// The name of the sync member.
+ ///
+ ///
+ /// The requested sync member resource state.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, string syncMemberName, SyncMember parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Deletes a sync member.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group on which the sync member is hosted.
+ ///
+ ///
+ /// The name of the sync member.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, string syncMemberName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Updates an existing sync member.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group on which the sync member is hosted.
+ ///
+ ///
+ /// The name of the sync member.
+ ///
+ ///
+ /// The requested sync member resource state.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, string syncMemberName, SyncMember parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Refreshes a sync member database schema.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group on which the sync member is hosted.
+ ///
+ ///
+ /// The name of the sync member.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task BeginRefreshMemberSchemaWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, string syncMemberName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Lists sync members in the given sync group.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListBySyncGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Gets a sync member database schema.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListMemberSchemasNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
diff --git a/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncAgent.cs b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncAgent.cs
new file mode 100644
index 000000000000..74f4e0054875
--- /dev/null
+++ b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncAgent.cs
@@ -0,0 +1,114 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Sql.Models
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Sql;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Serialization;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// An Azure SQL Database sync agent.
+ ///
+ [Rest.Serialization.JsonTransformation]
+ public partial class SyncAgent : ProxyResource
+ {
+ ///
+ /// Initializes a new instance of the SyncAgent class.
+ ///
+ public SyncAgent()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the SyncAgent class.
+ ///
+ /// Resource ID.
+ /// Resource name.
+ /// Resource type.
+ /// Name of the sync agent.
+ /// ARM resource id of the sync database
+ /// in the sync agent.
+ /// Last alive time of the sync
+ /// agent.
+ /// State of the sync agent. Possible values
+ /// include: 'Online', 'Offline', 'NeverConnected'
+ /// If the sync agent version is up to
+ /// date.
+ /// Expiration time of the sync agent
+ /// version.
+ /// Version of the sync agent.
+ public SyncAgent(string id = default(string), string name = default(string), string type = default(string), string syncAgentName = default(string), string syncDatabaseId = default(string), System.DateTime? lastAliveTime = default(System.DateTime?), string state = default(string), bool? isUpToDate = default(bool?), System.DateTime? expiryTime = default(System.DateTime?), string version = default(string))
+ : base(id, name, type)
+ {
+ SyncAgentName = syncAgentName;
+ SyncDatabaseId = syncDatabaseId;
+ LastAliveTime = lastAliveTime;
+ State = state;
+ IsUpToDate = isUpToDate;
+ ExpiryTime = expiryTime;
+ Version = version;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets name of the sync agent.
+ ///
+ [JsonProperty(PropertyName = "properties.name")]
+ public string SyncAgentName { get; private set; }
+
+ ///
+ /// Gets or sets ARM resource id of the sync database in the sync
+ /// agent.
+ ///
+ [JsonProperty(PropertyName = "properties.syncDatabaseId")]
+ public string SyncDatabaseId { get; set; }
+
+ ///
+ /// Gets last alive time of the sync agent.
+ ///
+ [JsonProperty(PropertyName = "properties.lastAliveTime")]
+ public System.DateTime? LastAliveTime { get; private set; }
+
+ ///
+ /// Gets state of the sync agent. Possible values include: 'Online',
+ /// 'Offline', 'NeverConnected'
+ ///
+ [JsonProperty(PropertyName = "properties.state")]
+ public string State { get; private set; }
+
+ ///
+ /// Gets if the sync agent version is up to date.
+ ///
+ [JsonProperty(PropertyName = "properties.isUpToDate")]
+ public bool? IsUpToDate { get; private set; }
+
+ ///
+ /// Gets expiration time of the sync agent version.
+ ///
+ [JsonProperty(PropertyName = "properties.expiryTime")]
+ public System.DateTime? ExpiryTime { get; private set; }
+
+ ///
+ /// Gets version of the sync agent.
+ ///
+ [JsonProperty(PropertyName = "properties.version")]
+ public string Version { get; private set; }
+
+ }
+}
diff --git a/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncAgentKeyProperties.cs b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncAgentKeyProperties.cs
new file mode 100644
index 000000000000..6b2690b9f66d
--- /dev/null
+++ b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncAgentKeyProperties.cs
@@ -0,0 +1,52 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Sql.Models
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Sql;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Properties of an Azure SQL Database sync agent key.
+ ///
+ public partial class SyncAgentKeyProperties
+ {
+ ///
+ /// Initializes a new instance of the SyncAgentKeyProperties class.
+ ///
+ public SyncAgentKeyProperties()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the SyncAgentKeyProperties class.
+ ///
+ /// Key of sync agent.
+ public SyncAgentKeyProperties(string syncAgentKey = default(string))
+ {
+ SyncAgentKey = syncAgentKey;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets key of sync agent.
+ ///
+ [JsonProperty(PropertyName = "syncAgentKey")]
+ public string SyncAgentKey { get; private set; }
+
+ }
+}
diff --git a/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncAgentLinkedDatabase.cs b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncAgentLinkedDatabase.cs
new file mode 100644
index 000000000000..c27f5cd9d32b
--- /dev/null
+++ b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncAgentLinkedDatabase.cs
@@ -0,0 +1,107 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Sql.Models
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Sql;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Serialization;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// An Azure SQL Database sync agent linked database.
+ ///
+ [Rest.Serialization.JsonTransformation]
+ public partial class SyncAgentLinkedDatabase : ProxyResource
+ {
+ ///
+ /// Initializes a new instance of the SyncAgentLinkedDatabase class.
+ ///
+ public SyncAgentLinkedDatabase()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the SyncAgentLinkedDatabase class.
+ ///
+ /// Resource ID.
+ /// Resource name.
+ /// Resource type.
+ /// Type of the sync agent linked database.
+ /// Possible values include: 'AzureSqlDatabase',
+ /// 'SqlServerDatabase'
+ /// Id of the sync agent linked
+ /// database.
+ /// Description of the sync agent linked
+ /// database.
+ /// Server name of the sync agent linked
+ /// database.
+ /// Database name of the sync agent linked
+ /// database.
+ /// User name of the sync agent linked
+ /// database.
+ public SyncAgentLinkedDatabase(string id = default(string), string name = default(string), string type = default(string), string databaseType = default(string), string databaseId = default(string), string description = default(string), string serverName = default(string), string databaseName = default(string), string userName = default(string))
+ : base(id, name, type)
+ {
+ DatabaseType = databaseType;
+ DatabaseId = databaseId;
+ Description = description;
+ ServerName = serverName;
+ DatabaseName = databaseName;
+ UserName = userName;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets type of the sync agent linked database. Possible values
+ /// include: 'AzureSqlDatabase', 'SqlServerDatabase'
+ ///
+ [JsonProperty(PropertyName = "properties.databaseType")]
+ public string DatabaseType { get; private set; }
+
+ ///
+ /// Gets id of the sync agent linked database.
+ ///
+ [JsonProperty(PropertyName = "properties.databaseId")]
+ public string DatabaseId { get; private set; }
+
+ ///
+ /// Gets description of the sync agent linked database.
+ ///
+ [JsonProperty(PropertyName = "properties.description")]
+ public string Description { get; private set; }
+
+ ///
+ /// Gets server name of the sync agent linked database.
+ ///
+ [JsonProperty(PropertyName = "properties.serverName")]
+ public string ServerName { get; private set; }
+
+ ///
+ /// Gets database name of the sync agent linked database.
+ ///
+ [JsonProperty(PropertyName = "properties.databaseName")]
+ public string DatabaseName { get; private set; }
+
+ ///
+ /// Gets user name of the sync agent linked database.
+ ///
+ [JsonProperty(PropertyName = "properties.userName")]
+ public string UserName { get; private set; }
+
+ }
+}
diff --git a/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncAgentState.cs b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncAgentState.cs
new file mode 100644
index 000000000000..d869a886a71a
--- /dev/null
+++ b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncAgentState.cs
@@ -0,0 +1,24 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Sql.Models
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Sql;
+
+ ///
+ /// Defines values for SyncAgentState.
+ ///
+ public static class SyncAgentState
+ {
+ public const string Online = "Online";
+ public const string Offline = "Offline";
+ public const string NeverConnected = "NeverConnected";
+ }
+}
diff --git a/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncConflictResolutionPolicy.cs b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncConflictResolutionPolicy.cs
new file mode 100644
index 000000000000..68a867dc3b07
--- /dev/null
+++ b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncConflictResolutionPolicy.cs
@@ -0,0 +1,23 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Sql.Models
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Sql;
+
+ ///
+ /// Defines values for SyncConflictResolutionPolicy.
+ ///
+ public static class SyncConflictResolutionPolicy
+ {
+ public const string HubWin = "HubWin";
+ public const string MemberWin = "MemberWin";
+ }
+}
diff --git a/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncDatabaseIdProperties.cs b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncDatabaseIdProperties.cs
new file mode 100644
index 000000000000..b721d7a9a050
--- /dev/null
+++ b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncDatabaseIdProperties.cs
@@ -0,0 +1,52 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Sql.Models
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Sql;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Properties of the sync database id.
+ ///
+ public partial class SyncDatabaseIdProperties
+ {
+ ///
+ /// Initializes a new instance of the SyncDatabaseIdProperties class.
+ ///
+ public SyncDatabaseIdProperties()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the SyncDatabaseIdProperties class.
+ ///
+ /// ARM resource id of sync database.
+ public SyncDatabaseIdProperties(string id = default(string))
+ {
+ Id = id;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets ARM resource id of sync database.
+ ///
+ [JsonProperty(PropertyName = "id")]
+ public string Id { get; private set; }
+
+ }
+}
diff --git a/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncDirection.cs b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncDirection.cs
new file mode 100644
index 000000000000..80a5c40e87d1
--- /dev/null
+++ b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncDirection.cs
@@ -0,0 +1,24 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Sql.Models
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Sql;
+
+ ///
+ /// Defines values for SyncDirection.
+ ///
+ public static class SyncDirection
+ {
+ public const string Bidirectional = "Bidirectional";
+ public const string OneWayMemberToHub = "OneWayMemberToHub";
+ public const string OneWayHubToMember = "OneWayHubToMember";
+ }
+}
diff --git a/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncFullSchemaProperties.cs b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncFullSchemaProperties.cs
new file mode 100644
index 000000000000..556488966f3f
--- /dev/null
+++ b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncFullSchemaProperties.cs
@@ -0,0 +1,64 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Sql.Models
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Sql;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// Properties of the database full schema.
+ ///
+ public partial class SyncFullSchemaProperties
+ {
+ ///
+ /// Initializes a new instance of the SyncFullSchemaProperties class.
+ ///
+ public SyncFullSchemaProperties()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the SyncFullSchemaProperties class.
+ ///
+ /// List of tables in the database full
+ /// schema.
+ /// Last update time of the database
+ /// schema.
+ public SyncFullSchemaProperties(IList tables = default(IList), System.DateTime? lastUpdateTime = default(System.DateTime?))
+ {
+ Tables = tables;
+ LastUpdateTime = lastUpdateTime;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets list of tables in the database full schema.
+ ///
+ [JsonProperty(PropertyName = "tables")]
+ public IList Tables { get; private set; }
+
+ ///
+ /// Gets last update time of the database schema.
+ ///
+ [JsonProperty(PropertyName = "lastUpdateTime")]
+ public System.DateTime? LastUpdateTime { get; private set; }
+
+ }
+}
diff --git a/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncFullSchemaTable.cs b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncFullSchemaTable.cs
new file mode 100644
index 000000000000..c44c662426de
--- /dev/null
+++ b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncFullSchemaTable.cs
@@ -0,0 +1,87 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Sql.Models
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Sql;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// Properties of the table in the database full schema.
+ ///
+ public partial class SyncFullSchemaTable
+ {
+ ///
+ /// Initializes a new instance of the SyncFullSchemaTable class.
+ ///
+ public SyncFullSchemaTable()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the SyncFullSchemaTable class.
+ ///
+ /// List of columns in the table of database full
+ /// schema.
+ /// Error id of the table.
+ /// If there is error in the table.
+ /// Name of the table.
+ /// Quoted name of the table.
+ public SyncFullSchemaTable(IList columns = default(IList), string errorId = default(string), bool? hasError = default(bool?), string name = default(string), string quotedName = default(string))
+ {
+ Columns = columns;
+ ErrorId = errorId;
+ HasError = hasError;
+ Name = name;
+ QuotedName = quotedName;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets list of columns in the table of database full schema.
+ ///
+ [JsonProperty(PropertyName = "columns")]
+ public IList Columns { get; private set; }
+
+ ///
+ /// Gets error id of the table.
+ ///
+ [JsonProperty(PropertyName = "errorId")]
+ public string ErrorId { get; private set; }
+
+ ///
+ /// Gets if there is error in the table.
+ ///
+ [JsonProperty(PropertyName = "hasError")]
+ public bool? HasError { get; private set; }
+
+ ///
+ /// Gets name of the table.
+ ///
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; private set; }
+
+ ///
+ /// Gets quoted name of the table.
+ ///
+ [JsonProperty(PropertyName = "quotedName")]
+ public string QuotedName { get; private set; }
+
+ }
+}
diff --git a/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncFullSchemaTableColumn.cs b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncFullSchemaTableColumn.cs
new file mode 100644
index 000000000000..e994bd6797d9
--- /dev/null
+++ b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncFullSchemaTableColumn.cs
@@ -0,0 +1,101 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Sql.Models
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Sql;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Properties of the column in the table of database full schema.
+ ///
+ public partial class SyncFullSchemaTableColumn
+ {
+ ///
+ /// Initializes a new instance of the SyncFullSchemaTableColumn class.
+ ///
+ public SyncFullSchemaTableColumn()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the SyncFullSchemaTableColumn class.
+ ///
+ /// Data size of the column.
+ /// Data type of the column.
+ /// Error id of the column.
+ /// If there is error in the table.
+ /// If it is the primary key of the
+ /// table.
+ /// Name of the column.
+ /// Quoted name of the column.
+ public SyncFullSchemaTableColumn(string dataSize = default(string), string dataType = default(string), string errorId = default(string), bool? hasError = default(bool?), bool? isPrimaryKey = default(bool?), string name = default(string), string quotedName = default(string))
+ {
+ DataSize = dataSize;
+ DataType = dataType;
+ ErrorId = errorId;
+ HasError = hasError;
+ IsPrimaryKey = isPrimaryKey;
+ Name = name;
+ QuotedName = quotedName;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets data size of the column.
+ ///
+ [JsonProperty(PropertyName = "dataSize")]
+ public string DataSize { get; private set; }
+
+ ///
+ /// Gets data type of the column.
+ ///
+ [JsonProperty(PropertyName = "dataType")]
+ public string DataType { get; private set; }
+
+ ///
+ /// Gets error id of the column.
+ ///
+ [JsonProperty(PropertyName = "errorId")]
+ public string ErrorId { get; private set; }
+
+ ///
+ /// Gets if there is error in the table.
+ ///
+ [JsonProperty(PropertyName = "hasError")]
+ public bool? HasError { get; private set; }
+
+ ///
+ /// Gets if it is the primary key of the table.
+ ///
+ [JsonProperty(PropertyName = "isPrimaryKey")]
+ public bool? IsPrimaryKey { get; private set; }
+
+ ///
+ /// Gets name of the column.
+ ///
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; private set; }
+
+ ///
+ /// Gets quoted name of the column.
+ ///
+ [JsonProperty(PropertyName = "quotedName")]
+ public string QuotedName { get; private set; }
+
+ }
+}
diff --git a/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncGroup.cs b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncGroup.cs
new file mode 100644
index 000000000000..38573b406a49
--- /dev/null
+++ b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncGroup.cs
@@ -0,0 +1,126 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Sql.Models
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Sql;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Serialization;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// An Azure SQL Database sync group.
+ ///
+ [Rest.Serialization.JsonTransformation]
+ public partial class SyncGroup : ProxyResource
+ {
+ ///
+ /// Initializes a new instance of the SyncGroup class.
+ ///
+ public SyncGroup()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the SyncGroup class.
+ ///
+ /// Resource ID.
+ /// Resource name.
+ /// Resource type.
+ /// Sync interval of the sync group.
+ /// Last sync time of the sync
+ /// group.
+ /// Conflict resolution policy
+ /// of the sync group. Possible values include: 'HubWin',
+ /// 'MemberWin'
+ /// ARM resource id of the sync database
+ /// in the sync group.
+ /// User name for the sync group hub
+ /// database credential.
+ /// Password for the sync group hub
+ /// database credential.
+ /// Sync state of the sync group. Possible
+ /// values include: 'NotReady', 'Error', 'Warning', 'Progressing',
+ /// 'Good'
+ /// Sync schema of the sync group.
+ public SyncGroup(string id = default(string), string name = default(string), string type = default(string), int? interval = default(int?), System.DateTime? lastSyncTime = default(System.DateTime?), string conflictResolutionPolicy = default(string), string syncDatabaseId = default(string), string hubDatabaseUserName = default(string), string hubDatabasePassword = default(string), string syncState = default(string), SyncGroupSchema schema = default(SyncGroupSchema))
+ : base(id, name, type)
+ {
+ Interval = interval;
+ LastSyncTime = lastSyncTime;
+ ConflictResolutionPolicy = conflictResolutionPolicy;
+ SyncDatabaseId = syncDatabaseId;
+ HubDatabaseUserName = hubDatabaseUserName;
+ HubDatabasePassword = hubDatabasePassword;
+ SyncState = syncState;
+ Schema = schema;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets sync interval of the sync group.
+ ///
+ [JsonProperty(PropertyName = "properties.interval")]
+ public int? Interval { get; set; }
+
+ ///
+ /// Gets last sync time of the sync group.
+ ///
+ [JsonProperty(PropertyName = "properties.lastSyncTime")]
+ public System.DateTime? LastSyncTime { get; private set; }
+
+ ///
+ /// Gets or sets conflict resolution policy of the sync group. Possible
+ /// values include: 'HubWin', 'MemberWin'
+ ///
+ [JsonProperty(PropertyName = "properties.conflictResolutionPolicy")]
+ public string ConflictResolutionPolicy { get; set; }
+
+ ///
+ /// Gets or sets ARM resource id of the sync database in the sync
+ /// group.
+ ///
+ [JsonProperty(PropertyName = "properties.syncDatabaseId")]
+ public string SyncDatabaseId { get; set; }
+
+ ///
+ /// Gets or sets user name for the sync group hub database credential.
+ ///
+ [JsonProperty(PropertyName = "properties.hubDatabaseUserName")]
+ public string HubDatabaseUserName { get; set; }
+
+ ///
+ /// Gets or sets password for the sync group hub database credential.
+ ///
+ [JsonProperty(PropertyName = "properties.hubDatabasePassword")]
+ public string HubDatabasePassword { get; set; }
+
+ ///
+ /// Gets sync state of the sync group. Possible values include:
+ /// 'NotReady', 'Error', 'Warning', 'Progressing', 'Good'
+ ///
+ [JsonProperty(PropertyName = "properties.syncState")]
+ public string SyncState { get; private set; }
+
+ ///
+ /// Gets or sets sync schema of the sync group.
+ ///
+ [JsonProperty(PropertyName = "properties.schema")]
+ public SyncGroupSchema Schema { get; set; }
+
+ }
+}
diff --git a/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncGroupLogProperties.cs b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncGroupLogProperties.cs
new file mode 100644
index 000000000000..5b055b618a05
--- /dev/null
+++ b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncGroupLogProperties.cs
@@ -0,0 +1,95 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Sql.Models
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Sql;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Properties of an Azure SQL Database sync group log.
+ ///
+ public partial class SyncGroupLogProperties
+ {
+ ///
+ /// Initializes a new instance of the SyncGroupLogProperties class.
+ ///
+ public SyncGroupLogProperties()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the SyncGroupLogProperties class.
+ ///
+ /// Timestamp of the sync group log.
+ /// Type of the sync group log. Possible values
+ /// include: 'All', 'Error', 'Warning', 'Success'
+ /// Source of the sync group log.
+ /// Details of the sync group log.
+ /// TracingId of the sync group log.
+ /// OperationStatus of the sync group
+ /// log.
+ public SyncGroupLogProperties(System.DateTime? timestamp = default(System.DateTime?), string type = default(string), string source = default(string), string details = default(string), System.Guid? tracingId = default(System.Guid?), string operationStatus = default(string))
+ {
+ Timestamp = timestamp;
+ Type = type;
+ Source = source;
+ Details = details;
+ TracingId = tracingId;
+ OperationStatus = operationStatus;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets timestamp of the sync group log.
+ ///
+ [JsonProperty(PropertyName = "timestamp")]
+ public System.DateTime? Timestamp { get; private set; }
+
+ ///
+ /// Gets type of the sync group log. Possible values include: 'All',
+ /// 'Error', 'Warning', 'Success'
+ ///
+ [JsonProperty(PropertyName = "type")]
+ public string Type { get; private set; }
+
+ ///
+ /// Gets source of the sync group log.
+ ///
+ [JsonProperty(PropertyName = "source")]
+ public string Source { get; private set; }
+
+ ///
+ /// Gets details of the sync group log.
+ ///
+ [JsonProperty(PropertyName = "details")]
+ public string Details { get; private set; }
+
+ ///
+ /// Gets tracingId of the sync group log.
+ ///
+ [JsonProperty(PropertyName = "tracingId")]
+ public System.Guid? TracingId { get; private set; }
+
+ ///
+ /// Gets operationStatus of the sync group log.
+ ///
+ [JsonProperty(PropertyName = "operationStatus")]
+ public string OperationStatus { get; private set; }
+
+ }
+}
diff --git a/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncGroupLogType.cs b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncGroupLogType.cs
new file mode 100644
index 000000000000..23d120444dc7
--- /dev/null
+++ b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncGroupLogType.cs
@@ -0,0 +1,25 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Sql.Models
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Sql;
+
+ ///
+ /// Defines values for SyncGroupLogType.
+ ///
+ public static class SyncGroupLogType
+ {
+ public const string All = "All";
+ public const string Error = "Error";
+ public const string Warning = "Warning";
+ public const string Success = "Success";
+ }
+}
diff --git a/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncGroupSchema.cs b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncGroupSchema.cs
new file mode 100644
index 000000000000..c7abc0672856
--- /dev/null
+++ b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncGroupSchema.cs
@@ -0,0 +1,63 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Sql.Models
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Sql;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// Properties of sync group schema.
+ ///
+ public partial class SyncGroupSchema
+ {
+ ///
+ /// Initializes a new instance of the SyncGroupSchema class.
+ ///
+ public SyncGroupSchema()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the SyncGroupSchema class.
+ ///
+ /// List of tables in sync group schema.
+ /// Name of master sync member where
+ /// the schema is from.
+ public SyncGroupSchema(IList tables = default(IList), string masterSyncMemberName = default(string))
+ {
+ Tables = tables;
+ MasterSyncMemberName = masterSyncMemberName;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets list of tables in sync group schema.
+ ///
+ [JsonProperty(PropertyName = "tables")]
+ public IList Tables { get; set; }
+
+ ///
+ /// Gets or sets name of master sync member where the schema is from.
+ ///
+ [JsonProperty(PropertyName = "masterSyncMemberName")]
+ public string MasterSyncMemberName { get; set; }
+
+ }
+}
diff --git a/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncGroupSchemaTable.cs b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncGroupSchemaTable.cs
new file mode 100644
index 000000000000..db50f6fc1392
--- /dev/null
+++ b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncGroupSchemaTable.cs
@@ -0,0 +1,63 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Sql.Models
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Sql;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// Properties of table in sync group schema.
+ ///
+ public partial class SyncGroupSchemaTable
+ {
+ ///
+ /// Initializes a new instance of the SyncGroupSchemaTable class.
+ ///
+ public SyncGroupSchemaTable()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the SyncGroupSchemaTable class.
+ ///
+ /// List of columns in sync group schema.
+ /// Quoted name of sync group schema
+ /// table.
+ public SyncGroupSchemaTable(IList columns = default(IList), string quotedName = default(string))
+ {
+ Columns = columns;
+ QuotedName = quotedName;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets list of columns in sync group schema.
+ ///
+ [JsonProperty(PropertyName = "columns")]
+ public IList Columns { get; set; }
+
+ ///
+ /// Gets or sets quoted name of sync group schema table.
+ ///
+ [JsonProperty(PropertyName = "quotedName")]
+ public string QuotedName { get; set; }
+
+ }
+}
diff --git a/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncGroupSchemaTableColumn.cs b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncGroupSchemaTableColumn.cs
new file mode 100644
index 000000000000..34abeb2d558b
--- /dev/null
+++ b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncGroupSchemaTableColumn.cs
@@ -0,0 +1,69 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Sql.Models
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Sql;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Properties of column in sync group table.
+ ///
+ public partial class SyncGroupSchemaTableColumn
+ {
+ ///
+ /// Initializes a new instance of the SyncGroupSchemaTableColumn class.
+ ///
+ public SyncGroupSchemaTableColumn()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the SyncGroupSchemaTableColumn class.
+ ///
+ /// Quoted name of sync group table
+ /// column.
+ /// Data size of the column.
+ /// Data type of the column.
+ public SyncGroupSchemaTableColumn(string quotedName = default(string), string dataSize = default(string), string dataType = default(string))
+ {
+ QuotedName = quotedName;
+ DataSize = dataSize;
+ DataType = dataType;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets quoted name of sync group table column.
+ ///
+ [JsonProperty(PropertyName = "quotedName")]
+ public string QuotedName { get; set; }
+
+ ///
+ /// Gets or sets data size of the column.
+ ///
+ [JsonProperty(PropertyName = "dataSize")]
+ public string DataSize { get; set; }
+
+ ///
+ /// Gets or sets data type of the column.
+ ///
+ [JsonProperty(PropertyName = "dataType")]
+ public string DataType { get; set; }
+
+ }
+}
diff --git a/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncGroupState.cs b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncGroupState.cs
new file mode 100644
index 000000000000..46c79f63d274
--- /dev/null
+++ b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncGroupState.cs
@@ -0,0 +1,26 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Sql.Models
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Sql;
+
+ ///
+ /// Defines values for SyncGroupState.
+ ///
+ public static class SyncGroupState
+ {
+ public const string NotReady = "NotReady";
+ public const string Error = "Error";
+ public const string Warning = "Warning";
+ public const string Progressing = "Progressing";
+ public const string Good = "Good";
+ }
+}
diff --git a/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncMember.cs b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncMember.cs
new file mode 100644
index 000000000000..59845dabb711
--- /dev/null
+++ b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncMember.cs
@@ -0,0 +1,148 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Sql.Models
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Sql;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Serialization;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// An Azure SQL Database sync member.
+ ///
+ [Rest.Serialization.JsonTransformation]
+ public partial class SyncMember : ProxyResource
+ {
+ ///
+ /// Initializes a new instance of the SyncMember class.
+ ///
+ public SyncMember()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the SyncMember class.
+ ///
+ /// Resource ID.
+ /// Resource name.
+ /// Resource type.
+ /// Database type of the sync member.
+ /// Possible values include: 'AzureSqlDatabase',
+ /// 'SqlServerDatabase'
+ /// ARM resource id of the sync agent in the
+ /// sync member.
+ /// SQL Server database id of the
+ /// sync member.
+ /// Server name of the member database in the
+ /// sync member
+ /// Database name of the member database in
+ /// the sync member.
+ /// User name of the member database in the sync
+ /// member.
+ /// Password of the member database in the sync
+ /// member.
+ /// Sync direction of the sync member.
+ /// Possible values include: 'Bidirectional', 'OneWayMemberToHub',
+ /// 'OneWayHubToMember'
+ /// Sync state of the sync member. Possible
+ /// values include: 'SyncInProgress', 'SyncSucceeded', 'SyncFailed',
+ /// 'DisabledTombstoneCleanup', 'DisabledBackupRestore',
+ /// 'SyncSucceededWithWarnings', 'SyncCancelling', 'SyncCancelled',
+ /// 'UnProvisioned', 'Provisioning', 'Provisioned', 'ProvisionFailed',
+ /// 'DeProvisioning', 'DeProvisioned', 'DeProvisionFailed',
+ /// 'Reprovisioning', 'ReprovisionFailed', 'UnReprovisioned'
+ public SyncMember(string id = default(string), string name = default(string), string type = default(string), string databaseType = default(string), string syncAgentId = default(string), System.Guid? sqlServerDatabaseId = default(System.Guid?), string serverName = default(string), string databaseName = default(string), string userName = default(string), string password = default(string), string syncDirection = default(string), string syncState = default(string))
+ : base(id, name, type)
+ {
+ DatabaseType = databaseType;
+ SyncAgentId = syncAgentId;
+ SqlServerDatabaseId = sqlServerDatabaseId;
+ ServerName = serverName;
+ DatabaseName = databaseName;
+ UserName = userName;
+ Password = password;
+ SyncDirection = syncDirection;
+ SyncState = syncState;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets database type of the sync member. Possible values
+ /// include: 'AzureSqlDatabase', 'SqlServerDatabase'
+ ///
+ [JsonProperty(PropertyName = "properties.databaseType")]
+ public string DatabaseType { get; set; }
+
+ ///
+ /// Gets or sets ARM resource id of the sync agent in the sync member.
+ ///
+ [JsonProperty(PropertyName = "properties.syncAgentId")]
+ public string SyncAgentId { get; set; }
+
+ ///
+ /// Gets or sets SQL Server database id of the sync member.
+ ///
+ [JsonProperty(PropertyName = "properties.sqlServerDatabaseId")]
+ public System.Guid? SqlServerDatabaseId { get; set; }
+
+ ///
+ /// Gets or sets server name of the member database in the sync member
+ ///
+ [JsonProperty(PropertyName = "properties.serverName")]
+ public string ServerName { get; set; }
+
+ ///
+ /// Gets or sets database name of the member database in the sync
+ /// member.
+ ///
+ [JsonProperty(PropertyName = "properties.databaseName")]
+ public string DatabaseName { get; set; }
+
+ ///
+ /// Gets or sets user name of the member database in the sync member.
+ ///
+ [JsonProperty(PropertyName = "properties.userName")]
+ public string UserName { get; set; }
+
+ ///
+ /// Gets or sets password of the member database in the sync member.
+ ///
+ [JsonProperty(PropertyName = "properties.password")]
+ public string Password { get; set; }
+
+ ///
+ /// Gets or sets sync direction of the sync member. Possible values
+ /// include: 'Bidirectional', 'OneWayMemberToHub', 'OneWayHubToMember'
+ ///
+ [JsonProperty(PropertyName = "properties.syncDirection")]
+ public string SyncDirection { get; set; }
+
+ ///
+ /// Gets sync state of the sync member. Possible values include:
+ /// 'SyncInProgress', 'SyncSucceeded', 'SyncFailed',
+ /// 'DisabledTombstoneCleanup', 'DisabledBackupRestore',
+ /// 'SyncSucceededWithWarnings', 'SyncCancelling', 'SyncCancelled',
+ /// 'UnProvisioned', 'Provisioning', 'Provisioned', 'ProvisionFailed',
+ /// 'DeProvisioning', 'DeProvisioned', 'DeProvisionFailed',
+ /// 'Reprovisioning', 'ReprovisionFailed', 'UnReprovisioned'
+ ///
+ [JsonProperty(PropertyName = "properties.syncState")]
+ public string SyncState { get; private set; }
+
+ }
+}
diff --git a/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncMemberDbType.cs b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncMemberDbType.cs
new file mode 100644
index 000000000000..2b374432d035
--- /dev/null
+++ b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncMemberDbType.cs
@@ -0,0 +1,23 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Sql.Models
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Sql;
+
+ ///
+ /// Defines values for SyncMemberDbType.
+ ///
+ public static class SyncMemberDbType
+ {
+ public const string AzureSqlDatabase = "AzureSqlDatabase";
+ public const string SqlServerDatabase = "SqlServerDatabase";
+ }
+}
diff --git a/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncMemberState.cs b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncMemberState.cs
new file mode 100644
index 000000000000..0de297c522f6
--- /dev/null
+++ b/src/SDKs/SqlManagement/Management.Sql/Generated/Models/SyncMemberState.cs
@@ -0,0 +1,39 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Sql.Models
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Azure.Management.Sql;
+
+ ///
+ /// Defines values for SyncMemberState.
+ ///
+ public static class SyncMemberState
+ {
+ public const string SyncInProgress = "SyncInProgress";
+ public const string SyncSucceeded = "SyncSucceeded";
+ public const string SyncFailed = "SyncFailed";
+ public const string DisabledTombstoneCleanup = "DisabledTombstoneCleanup";
+ public const string DisabledBackupRestore = "DisabledBackupRestore";
+ public const string SyncSucceededWithWarnings = "SyncSucceededWithWarnings";
+ public const string SyncCancelling = "SyncCancelling";
+ public const string SyncCancelled = "SyncCancelled";
+ public const string UnProvisioned = "UnProvisioned";
+ public const string Provisioning = "Provisioning";
+ public const string Provisioned = "Provisioned";
+ public const string ProvisionFailed = "ProvisionFailed";
+ public const string DeProvisioning = "DeProvisioning";
+ public const string DeProvisioned = "DeProvisioned";
+ public const string DeProvisionFailed = "DeProvisionFailed";
+ public const string Reprovisioning = "Reprovisioning";
+ public const string ReprovisionFailed = "ReprovisionFailed";
+ public const string UnReprovisioned = "UnReprovisioned";
+ }
+}
diff --git a/src/SDKs/SqlManagement/Management.Sql/Generated/SqlManagementClient.cs b/src/SDKs/SqlManagement/Management.Sql/Generated/SqlManagementClient.cs
index 1baad3689eaa..4d56852dd328 100644
--- a/src/SDKs/SqlManagement/Management.Sql/Generated/SqlManagementClient.cs
+++ b/src/SDKs/SqlManagement/Management.Sql/Generated/SqlManagementClient.cs
@@ -231,6 +231,21 @@ public partial class SqlManagementClient : ServiceClient, I
///
public virtual IServerKeysOperations ServerKeys { get; private set; }
+ ///
+ /// Gets the ISyncAgentsOperations.
+ ///
+ public virtual ISyncAgentsOperations SyncAgents { get; private set; }
+
+ ///
+ /// Gets the ISyncGroupsOperations.
+ ///
+ public virtual ISyncGroupsOperations SyncGroups { get; private set; }
+
+ ///
+ /// Gets the ISyncMembersOperations.
+ ///
+ public virtual ISyncMembersOperations SyncMembers { get; private set; }
+
///
/// Gets the IVirtualNetworkRulesOperations.
///
@@ -469,6 +484,9 @@ private void Initialize()
EncryptionProtectors = new EncryptionProtectorsOperations(this);
FailoverGroups = new FailoverGroupsOperations(this);
ServerKeys = new ServerKeysOperations(this);
+ SyncAgents = new SyncAgentsOperations(this);
+ SyncGroups = new SyncGroupsOperations(this);
+ SyncMembers = new SyncMembersOperations(this);
VirtualNetworkRules = new VirtualNetworkRulesOperations(this);
BaseUri = new System.Uri("https://management.azure.com");
AcceptLanguage = "en-US";
diff --git a/src/SDKs/SqlManagement/Management.Sql/Generated/SyncAgentsOperations.cs b/src/SDKs/SqlManagement/Management.Sql/Generated/SyncAgentsOperations.cs
new file mode 100644
index 000000000000..0d9dfc2c26eb
--- /dev/null
+++ b/src/SDKs/SqlManagement/Management.Sql/Generated/SyncAgentsOperations.cs
@@ -0,0 +1,1681 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Sql
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// SyncAgentsOperations operations.
+ ///
+ internal partial class SyncAgentsOperations : IServiceOperations, ISyncAgentsOperations
+ {
+ ///
+ /// Initializes a new instance of the SyncAgentsOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal SyncAgentsOperations(SqlManagementClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the SqlManagementClient
+ ///
+ public SqlManagementClient Client { get; private set; }
+
+ ///
+ /// Gets a sync agent.
+ ///
+ ///
+ /// 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 on which the sync agent is hosted.
+ ///
+ ///
+ /// The name of the sync agent.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string syncAgentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (serverName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "serverName");
+ }
+ if (syncAgentName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "syncAgentName");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ string apiVersion = "2015-05-01-preview";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("serverName", serverName);
+ tracingParameters.Add("syncAgentName", syncAgentName);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName}").ToString();
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName));
+ _url = _url.Replace("{syncAgentName}", System.Uri.EscapeDataString(syncAgentName));
+ _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 (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Creates or updates a sync agent.
+ ///
+ ///
+ /// 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 on which the sync agent is hosted.
+ ///
+ ///
+ /// The name of the sync agent.
+ ///
+ ///
+ /// The requested sync agent resource state.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string syncAgentName, SyncAgent parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ // Send Request
+ AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, syncAgentName, parameters, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Deletes a sync agent.
+ ///
+ ///
+ /// 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 on which the sync agent is hosted.
+ ///
+ ///
+ /// The name of the sync agent.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string syncAgentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ // Send request
+ AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, serverName, syncAgentName, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Lists sync agents in a server.
+ ///
+ ///
+ /// 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 on which the sync agent is hosted.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListByServerWithHttpMessagesAsync(string resourceGroupName, string serverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (serverName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "serverName");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ string apiVersion = "2015-05-01-preview";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("serverName", serverName);
+ 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}/syncAgents").ToString();
+ _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 (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Generates a sync agent key.
+ ///
+ ///
+ /// 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 on which the sync agent is hosted.
+ ///
+ ///
+ /// The name of the sync agent.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> GenerateKeyWithHttpMessagesAsync(string resourceGroupName, string serverName, string syncAgentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (serverName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "serverName");
+ }
+ if (syncAgentName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "syncAgentName");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ string apiVersion = "2015-05-01-preview";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("serverName", serverName);
+ tracingParameters.Add("syncAgentName", syncAgentName);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "GenerateKey", 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}/syncAgents/{syncAgentName}/generateKey").ToString();
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName));
+ _url = _url.Replace("{syncAgentName}", System.Uri.EscapeDataString(syncAgentName));
+ _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 (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Lists databases linked to a sync agent.
+ ///
+ ///
+ /// 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 on which the sync agent is hosted.
+ ///
+ ///
+ /// The name of the sync agent.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListLinkedDatabasesWithHttpMessagesAsync(string resourceGroupName, string serverName, string syncAgentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (serverName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "serverName");
+ }
+ if (syncAgentName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "syncAgentName");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ string apiVersion = "2015-05-01-preview";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("serverName", serverName);
+ tracingParameters.Add("syncAgentName", syncAgentName);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListLinkedDatabases", 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}/syncAgents/{syncAgentName}/linkedDatabases").ToString();
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName));
+ _url = _url.Replace("{syncAgentName}", System.Uri.EscapeDataString(syncAgentName));
+ _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 (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Creates or updates a sync agent.
+ ///
+ ///
+ /// 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 on which the sync agent is hosted.
+ ///
+ ///
+ /// The name of the sync agent.
+ ///
+ ///
+ /// The requested sync agent resource state.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string syncAgentName, SyncAgent parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (serverName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "serverName");
+ }
+ if (syncAgentName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "syncAgentName");
+ }
+ if (parameters == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ string apiVersion = "2015-05-01-preview";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("serverName", serverName);
+ tracingParameters.Add("syncAgentName", syncAgentName);
+ tracingParameters.Add("parameters", parameters);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ 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}/syncAgents/{syncAgentName}").ToString();
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName));
+ _url = _url.Replace("{syncAgentName}", System.Uri.EscapeDataString(syncAgentName));
+ _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 (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("PUT");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(parameters != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 201)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 201)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Deletes a sync agent.
+ ///
+ ///
+ /// 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 on which the sync agent is hosted.
+ ///
+ ///
+ /// The name of the sync agent.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string syncAgentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (serverName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "serverName");
+ }
+ if (syncAgentName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "syncAgentName");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ string apiVersion = "2015-05-01-preview";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("serverName", serverName);
+ tracingParameters.Add("syncAgentName", syncAgentName);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ 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}/syncAgents/{syncAgentName}").ToString();
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName));
+ _url = _url.Replace("{syncAgentName}", System.Uri.EscapeDataString(syncAgentName));
+ _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 (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("DELETE");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Lists sync agents in a server.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListByServerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (nextPageLink == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("nextPageLink", nextPageLink);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListByServerNext", tracingParameters);
+ }
+ // Construct URL
+ string _url = "{nextLink}";
+ _url = _url.Replace("{nextLink}", nextPageLink);
+ List _queryParameters = new List();
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Lists databases linked to a sync agent.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListLinkedDatabasesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (nextPageLink == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("nextPageLink", nextPageLink);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListLinkedDatabasesNext", tracingParameters);
+ }
+ // Construct URL
+ string _url = "{nextLink}";
+ _url = _url.Replace("{nextLink}", nextPageLink);
+ List _queryParameters = new List();
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ }
+}
diff --git a/src/SDKs/SqlManagement/Management.Sql/Generated/SyncAgentsOperationsExtensions.cs b/src/SDKs/SqlManagement/Management.Sql/Generated/SyncAgentsOperationsExtensions.cs
new file mode 100644
index 000000000000..f4f4e5c4d6d9
--- /dev/null
+++ b/src/SDKs/SqlManagement/Management.Sql/Generated/SyncAgentsOperationsExtensions.cs
@@ -0,0 +1,477 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Sql
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Extension methods for SyncAgentsOperations.
+ ///
+ public static partial class SyncAgentsOperationsExtensions
+ {
+ ///
+ /// Gets a sync agent.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server on which the sync agent is hosted.
+ ///
+ ///
+ /// The name of the sync agent.
+ ///
+ public static SyncAgent Get(this ISyncAgentsOperations operations, string resourceGroupName, string serverName, string syncAgentName)
+ {
+ return operations.GetAsync(resourceGroupName, serverName, syncAgentName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets a sync agent.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server on which the sync agent is hosted.
+ ///
+ ///
+ /// The name of the sync agent.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetAsync(this ISyncAgentsOperations operations, string resourceGroupName, string serverName, string syncAgentName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serverName, syncAgentName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Creates or updates a sync agent.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server on which the sync agent is hosted.
+ ///
+ ///
+ /// The name of the sync agent.
+ ///
+ ///
+ /// The requested sync agent resource state.
+ ///
+ public static SyncAgent CreateOrUpdate(this ISyncAgentsOperations operations, string resourceGroupName, string serverName, string syncAgentName, SyncAgent parameters)
+ {
+ return operations.CreateOrUpdateAsync(resourceGroupName, serverName, syncAgentName, parameters).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Creates or updates a sync agent.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server on which the sync agent is hosted.
+ ///
+ ///
+ /// The name of the sync agent.
+ ///
+ ///
+ /// The requested sync agent resource state.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task CreateOrUpdateAsync(this ISyncAgentsOperations operations, string resourceGroupName, string serverName, string syncAgentName, SyncAgent parameters, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, syncAgentName, parameters, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Deletes a sync agent.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server on which the sync agent is hosted.
+ ///
+ ///
+ /// The name of the sync agent.
+ ///
+ public static void Delete(this ISyncAgentsOperations operations, string resourceGroupName, string serverName, string syncAgentName)
+ {
+ operations.DeleteAsync(resourceGroupName, serverName, syncAgentName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Deletes a sync agent.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server on which the sync agent is hosted.
+ ///
+ ///
+ /// The name of the sync agent.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task DeleteAsync(this ISyncAgentsOperations operations, string resourceGroupName, string serverName, string syncAgentName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serverName, syncAgentName, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ }
+
+ ///
+ /// Lists sync agents in a server.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server on which the sync agent is hosted.
+ ///
+ public static IPage ListByServer(this ISyncAgentsOperations operations, string resourceGroupName, string serverName)
+ {
+ return operations.ListByServerAsync(resourceGroupName, serverName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Lists sync agents in a server.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server on which the sync agent is hosted.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListByServerAsync(this ISyncAgentsOperations operations, string resourceGroupName, string serverName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListByServerWithHttpMessagesAsync(resourceGroupName, serverName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Generates a sync agent key.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server on which the sync agent is hosted.
+ ///
+ ///
+ /// The name of the sync agent.
+ ///
+ public static SyncAgentKeyProperties GenerateKey(this ISyncAgentsOperations operations, string resourceGroupName, string serverName, string syncAgentName)
+ {
+ return operations.GenerateKeyAsync(resourceGroupName, serverName, syncAgentName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Generates a sync agent key.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server on which the sync agent is hosted.
+ ///
+ ///
+ /// The name of the sync agent.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GenerateKeyAsync(this ISyncAgentsOperations operations, string resourceGroupName, string serverName, string syncAgentName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GenerateKeyWithHttpMessagesAsync(resourceGroupName, serverName, syncAgentName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Lists databases linked to a sync agent.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server on which the sync agent is hosted.
+ ///
+ ///
+ /// The name of the sync agent.
+ ///
+ public static IPage ListLinkedDatabases(this ISyncAgentsOperations operations, string resourceGroupName, string serverName, string syncAgentName)
+ {
+ return operations.ListLinkedDatabasesAsync(resourceGroupName, serverName, syncAgentName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Lists databases linked to a sync agent.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server on which the sync agent is hosted.
+ ///
+ ///
+ /// The name of the sync agent.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListLinkedDatabasesAsync(this ISyncAgentsOperations operations, string resourceGroupName, string serverName, string syncAgentName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListLinkedDatabasesWithHttpMessagesAsync(resourceGroupName, serverName, syncAgentName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Creates or updates a sync agent.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server on which the sync agent is hosted.
+ ///
+ ///
+ /// The name of the sync agent.
+ ///
+ ///
+ /// The requested sync agent resource state.
+ ///
+ public static SyncAgent BeginCreateOrUpdate(this ISyncAgentsOperations operations, string resourceGroupName, string serverName, string syncAgentName, SyncAgent parameters)
+ {
+ return operations.BeginCreateOrUpdateAsync(resourceGroupName, serverName, syncAgentName, parameters).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Creates or updates a sync agent.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server on which the sync agent is hosted.
+ ///
+ ///
+ /// The name of the sync agent.
+ ///
+ ///
+ /// The requested sync agent resource state.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task BeginCreateOrUpdateAsync(this ISyncAgentsOperations operations, string resourceGroupName, string serverName, string syncAgentName, SyncAgent parameters, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, syncAgentName, parameters, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Deletes a sync agent.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server on which the sync agent is hosted.
+ ///
+ ///
+ /// The name of the sync agent.
+ ///
+ public static void BeginDelete(this ISyncAgentsOperations operations, string resourceGroupName, string serverName, string syncAgentName)
+ {
+ operations.BeginDeleteAsync(resourceGroupName, serverName, syncAgentName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Deletes a sync agent.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group that contains the resource. You can obtain
+ /// this value from the Azure Resource Manager API or the portal.
+ ///
+ ///
+ /// The name of the server on which the sync agent is hosted.
+ ///
+ ///
+ /// The name of the sync agent.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task BeginDeleteAsync(this ISyncAgentsOperations operations, string resourceGroupName, string serverName, string syncAgentName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, serverName, syncAgentName, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ }
+
+ ///
+ /// Lists sync agents in a server.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ public static IPage ListByServerNext(this ISyncAgentsOperations operations, string nextPageLink)
+ {
+ return operations.ListByServerNextAsync(nextPageLink).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Lists sync agents in a server.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListByServerNextAsync(this ISyncAgentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListByServerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Lists databases linked to a sync agent.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ public static IPage ListLinkedDatabasesNext(this ISyncAgentsOperations operations, string nextPageLink)
+ {
+ return operations.ListLinkedDatabasesNextAsync(nextPageLink).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Lists databases linked to a sync agent.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListLinkedDatabasesNextAsync(this ISyncAgentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListLinkedDatabasesNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/src/SDKs/SqlManagement/Management.Sql/Generated/SyncGroupsOperations.cs b/src/SDKs/SqlManagement/Management.Sql/Generated/SyncGroupsOperations.cs
new file mode 100644
index 000000000000..777e3c12f99d
--- /dev/null
+++ b/src/SDKs/SqlManagement/Management.Sql/Generated/SyncGroupsOperations.cs
@@ -0,0 +1,3181 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Sql
+{
+ using Microsoft.Azure;
+ using Microsoft.Azure.Management;
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// SyncGroupsOperations operations.
+ ///
+ internal partial class SyncGroupsOperations : IServiceOperations, ISyncGroupsOperations
+ {
+ ///
+ /// Initializes a new instance of the SyncGroupsOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal SyncGroupsOperations(SqlManagementClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the SqlManagementClient
+ ///
+ public SqlManagementClient Client { get; private set; }
+
+ ///
+ /// Gets a collection of sync database ids.
+ ///
+ ///
+ /// The name of the region where the resource is located.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListSyncDatabaseIdsWithHttpMessagesAsync(string locationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (locationName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "locationName");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ string apiVersion = "2015-05-01-preview";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("locationName", locationName);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListSyncDatabaseIds", 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/{locationName}/syncDatabaseIds").ToString();
+ _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName));
+ _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 (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Refreshes a hub database schema.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public async Task RefreshHubSchemaWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ // Send request
+ AzureOperationResponse _response = await BeginRefreshHubSchemaWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, syncGroupName, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Gets a collection of hub database schemas.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListHubSchemasWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ 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 (syncGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "syncGroupName");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ string apiVersion = "2015-05-01-preview";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("serverName", serverName);
+ tracingParameters.Add("databaseName", databaseName);
+ tracingParameters.Add("syncGroupName", syncGroupName);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListHubSchemas", 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}/syncGroups/{syncGroupName}/hubSchemas").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("{syncGroupName}", System.Uri.EscapeDataString(syncGroupName));
+ _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 (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Gets a collection of sync group logs.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group.
+ ///
+ ///
+ /// Get logs generated after this time.
+ ///
+ ///
+ /// Get logs generated before this time.
+ ///
+ ///
+ /// The types of logs to retrieve. Possible values include: 'All', 'Error',
+ /// 'Warning', 'Success'
+ ///
+ ///
+ /// The continuation token for this operation.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListLogsWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, string startTime, string endTime, string type, string continuationToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ 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 (syncGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "syncGroupName");
+ }
+ if (startTime == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "startTime");
+ }
+ if (endTime == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "endTime");
+ }
+ if (type == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "type");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ string apiVersion = "2015-05-01-preview";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("serverName", serverName);
+ tracingParameters.Add("databaseName", databaseName);
+ tracingParameters.Add("syncGroupName", syncGroupName);
+ tracingParameters.Add("startTime", startTime);
+ tracingParameters.Add("endTime", endTime);
+ tracingParameters.Add("type", type);
+ tracingParameters.Add("continuationToken", continuationToken);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListLogs", 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}/syncGroups/{syncGroupName}/logs").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("{syncGroupName}", System.Uri.EscapeDataString(syncGroupName));
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ List _queryParameters = new List();
+ if (startTime != null)
+ {
+ _queryParameters.Add(string.Format("startTime={0}", System.Uri.EscapeDataString(startTime)));
+ }
+ if (endTime != null)
+ {
+ _queryParameters.Add(string.Format("endTime={0}", System.Uri.EscapeDataString(endTime)));
+ }
+ if (type != null)
+ {
+ _queryParameters.Add(string.Format("type={0}", System.Uri.EscapeDataString(type)));
+ }
+ if (continuationToken != null)
+ {
+ _queryParameters.Add(string.Format("continuationToken={0}", System.Uri.EscapeDataString(continuationToken)));
+ }
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Cancels a sync group synchronization.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task CancelSyncWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ 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 (syncGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "syncGroupName");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ string apiVersion = "2015-05-01-preview";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("serverName", serverName);
+ tracingParameters.Add("databaseName", databaseName);
+ tracingParameters.Add("syncGroupName", syncGroupName);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "CancelSync", 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}/syncGroups/{syncGroupName}/cancelSync").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("{syncGroupName}", System.Uri.EscapeDataString(syncGroupName));
+ _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 (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Triggers a sync group synchronization.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task TriggerSyncWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ 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 (syncGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "syncGroupName");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ string apiVersion = "2015-05-01-preview";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("serverName", serverName);
+ tracingParameters.Add("databaseName", databaseName);
+ tracingParameters.Add("syncGroupName", syncGroupName);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "TriggerSync", 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}/syncGroups/{syncGroupName}/triggerSync").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("{syncGroupName}", System.Uri.EscapeDataString(syncGroupName));
+ _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 (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Gets a sync group.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ 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 (syncGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "syncGroupName");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ string apiVersion = "2015-05-01-preview";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("serverName", serverName);
+ tracingParameters.Add("databaseName", databaseName);
+ tracingParameters.Add("syncGroupName", syncGroupName);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}").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("{syncGroupName}", System.Uri.EscapeDataString(syncGroupName));
+ _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 (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Creates or updates a sync group.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group.
+ ///
+ ///
+ /// The requested sync group resource state.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, SyncGroup parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ // Send Request
+ AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Deletes a sync group.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ // Send request
+ AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, syncGroupName, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Updates a sync group.
+ ///
+ ///
+ /// 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 on which the sync group is hosted.
+ ///
+ ///
+ /// The name of the sync group.
+ ///
+ ///
+ /// The requested sync group resource state.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string syncGroupName, SyncGroup parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ // Send Request
+ AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Lists sync groups under a hub 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 on which the sync group is hosted.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ 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 (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ string apiVersion = "2015-05-01-preview";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("serverName", serverName);
+ tracingParameters.Add("databaseName", databaseName);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", 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}/syncGroups").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)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse