diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/DataMigrationServiceClient.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/DataMigrationServiceClient.cs index f0d28a8f0688..e1cd61a15413 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/DataMigrationServiceClient.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/DataMigrationServiceClient.cs @@ -47,14 +47,19 @@ public partial class DataMigrationServiceClient : ServiceClient - /// Version of the API + /// Subscription ID that identifies an Azure subscription. + /// + public string SubscriptionId { get; set; } + + /// + /// API version to use for the request. /// public string ApiVersion { get; private set; } /// - /// Identifier of the subscription + /// Version of the API /// - public string SubscriptionId { get; set; } + public string ApiVersion1 { get; set; } /// /// The preferred language for the response. @@ -74,6 +79,26 @@ public partial class DataMigrationServiceClient : ServiceClient public bool? GenerateClientRequestId { get; set; } + /// + /// Gets the IDatabaseMigrationsSqlMiOperations. + /// + public virtual IDatabaseMigrationsSqlMiOperations DatabaseMigrationsSqlMi { get; private set; } + + /// + /// Gets the IDatabaseMigrationsSqlVmOperations. + /// + public virtual IDatabaseMigrationsSqlVmOperations DatabaseMigrationsSqlVm { get; private set; } + + /// + /// Gets the IOperations. + /// + public virtual IOperations Operations { get; private set; } + + /// + /// Gets the ISqlMigrationServicesOperations. + /// + public virtual ISqlMigrationServicesOperations SqlMigrationServices { get; private set; } + /// /// Gets the IResourceSkusOperations. /// @@ -104,11 +129,6 @@ public partial class DataMigrationServiceClient : ServiceClient public virtual IUsagesOperations Usages { get; private set; } - /// - /// Gets the IOperations. - /// - public virtual IOperations Operations { get; private set; } - /// /// Gets the IFilesOperations. /// @@ -355,16 +375,19 @@ public DataMigrationServiceClient(System.Uri baseUri, ServiceClientCredentials c /// private void Initialize() { + DatabaseMigrationsSqlMi = new DatabaseMigrationsSqlMiOperations(this); + DatabaseMigrationsSqlVm = new DatabaseMigrationsSqlVmOperations(this); + Operations = new Operations(this); + SqlMigrationServices = new SqlMigrationServicesOperations(this); ResourceSkus = new ResourceSkusOperations(this); Services = new ServicesOperations(this); Tasks = new TasksOperations(this); ServiceTasks = new ServiceTasksOperations(this); Projects = new ProjectsOperations(this); Usages = new UsagesOperations(this); - Operations = new Operations(this); Files = new FilesOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2021-06-30"; + ApiVersion = "2022-01-30-preview"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; @@ -394,6 +417,8 @@ private void Initialize() new Iso8601TimeSpanConverter() } }; + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("commandType")); DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("commandType")); SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("resultType")); diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/DatabaseMigrationsSqlMiOperations.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/DatabaseMigrationsSqlMiOperations.cs new file mode 100644 index 000000000000..8aff9aee2e43 --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/DatabaseMigrationsSqlMiOperations.cs @@ -0,0 +1,996 @@ +// +// 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.DataMigration +{ + 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; + + /// + /// DatabaseMigrationsSqlMiOperations operations. + /// + internal partial class DatabaseMigrationsSqlMiOperations : IServiceOperations, IDatabaseMigrationsSqlMiOperations + { + /// + /// Initializes a new instance of the DatabaseMigrationsSqlMiOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DatabaseMigrationsSqlMiOperations(DataMigrationServiceClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DataMigrationServiceClient + /// + public DataMigrationServiceClient Client { get; private set; } + + /// + /// Retrieve the specified database migration for a given SQL Managed Instance. + /// + /// + /// 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 target database. + /// + /// + /// Optional migration operation ID. If this is provided, then details of + /// migration operation for that ID are retrieved. If not provided (default), + /// then details related to most recent or current operation are retrieved. + /// + /// + /// The child resources to include in the response. + /// + /// + /// 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 managedInstanceName, string targetDbName, System.Guid? migrationOperationId = default(System.Guid?), string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (targetDbName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "targetDbName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("targetDbName", targetDbName); + tracingParameters.Add("migrationOperationId", migrationOperationId); + tracingParameters.Add("expand", expand); + 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/managedInstances/{managedInstanceName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDbName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{targetDbName}", System.Uri.EscapeDataString(targetDbName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (migrationOperationId != null) + { + _queryParameters.Add(string.Format("migrationOperationId={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(migrationOperationId, Client.SerializationSettings).Trim('"')))); + } + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create a new database migration to a given SQL Managed Instance. + /// + /// + /// 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 target database. + /// + /// + /// Details of SqlMigrationService resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string targetDbName, DatabaseMigrationSqlMi parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, targetDbName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Stop in-progress database migration to SQL Managed Instance. + /// + /// + /// 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 target database. + /// + /// + /// Required migration operation ID for which cancel will be initiated. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task CancelWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string targetDbName, MigrationOperationInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginCancelWithHttpMessagesAsync(resourceGroupName, managedInstanceName, targetDbName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Initiate cutover for in-progress online database migration to SQL Managed + /// Instance. + /// + /// + /// 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 target database. + /// + /// + /// Required migration operation ID for which cutover will be initiated. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task CutoverWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string targetDbName, MigrationOperationInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginCutoverWithHttpMessagesAsync(resourceGroupName, managedInstanceName, targetDbName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create a new database migration to a given SQL Managed Instance. + /// + /// + /// 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 target database. + /// + /// + /// Details of SqlMigrationService resource. + /// + /// + /// 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 managedInstanceName, string targetDbName, DatabaseMigrationSqlMi parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (targetDbName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "targetDbName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("targetDbName", targetDbName); + tracingParameters.Add("parameters", parameters); + 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/managedInstances/{managedInstanceName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDbName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{targetDbName}", System.Uri.EscapeDataString(targetDbName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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 != 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; + } + + /// + /// Stop in-progress database migration to SQL Managed Instance. + /// + /// + /// 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 target database. + /// + /// + /// Required migration operation ID for which cancel will be initiated. + /// + /// + /// 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 BeginCancelWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string targetDbName, MigrationOperationInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (targetDbName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "targetDbName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("targetDbName", targetDbName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCancel", 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/managedInstances/{managedInstanceName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDbName}/cancel").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{targetDbName}", System.Uri.EscapeDataString(targetDbName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Initiate cutover for in-progress online database migration to SQL Managed + /// Instance. + /// + /// + /// 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 target database. + /// + /// + /// Required migration operation ID for which cutover will be initiated. + /// + /// + /// 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 BeginCutoverWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string targetDbName, MigrationOperationInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managedInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managedInstanceName"); + } + if (targetDbName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "targetDbName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managedInstanceName", managedInstanceName); + tracingParameters.Add("targetDbName", targetDbName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCutover", 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/managedInstances/{managedInstanceName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDbName}/cutover").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managedInstanceName}", System.Uri.EscapeDataString(managedInstanceName)); + _url = _url.Replace("{targetDbName}", System.Uri.EscapeDataString(targetDbName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/DatabaseMigrationsSqlMiOperationsExtensions.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/DatabaseMigrationsSqlMiOperationsExtensions.cs new file mode 100644 index 000000000000..f78c6d51ddd5 --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/DatabaseMigrationsSqlMiOperationsExtensions.cs @@ -0,0 +1,391 @@ +// +// 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.DataMigration +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DatabaseMigrationsSqlMiOperations. + /// + public static partial class DatabaseMigrationsSqlMiOperationsExtensions + { + /// + /// Retrieve the specified database migration for a given SQL Managed Instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// + /// + /// The name of the target database. + /// + /// + /// Optional migration operation ID. If this is provided, then details of + /// migration operation for that ID are retrieved. If not provided (default), + /// then details related to most recent or current operation are retrieved. + /// + /// + /// The child resources to include in the response. + /// + public static DatabaseMigrationSqlMi Get(this IDatabaseMigrationsSqlMiOperations operations, string resourceGroupName, string managedInstanceName, string targetDbName, System.Guid? migrationOperationId = default(System.Guid?), string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, managedInstanceName, targetDbName, migrationOperationId, expand).GetAwaiter().GetResult(); + } + + /// + /// Retrieve the specified database migration for a given SQL Managed Instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// + /// + /// The name of the target database. + /// + /// + /// Optional migration operation ID. If this is provided, then details of + /// migration operation for that ID are retrieved. If not provided (default), + /// then details related to most recent or current operation are retrieved. + /// + /// + /// The child resources to include in the response. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDatabaseMigrationsSqlMiOperations operations, string resourceGroupName, string managedInstanceName, string targetDbName, System.Guid? migrationOperationId = default(System.Guid?), string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managedInstanceName, targetDbName, migrationOperationId, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create a new database migration to a given SQL Managed Instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// + /// + /// The name of the target database. + /// + /// + /// Details of SqlMigrationService resource. + /// + public static DatabaseMigrationSqlMi CreateOrUpdate(this IDatabaseMigrationsSqlMiOperations operations, string resourceGroupName, string managedInstanceName, string targetDbName, DatabaseMigrationSqlMi parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, managedInstanceName, targetDbName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create a new database migration to a given SQL Managed Instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// + /// + /// The name of the target database. + /// + /// + /// Details of SqlMigrationService resource. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IDatabaseMigrationsSqlMiOperations operations, string resourceGroupName, string managedInstanceName, string targetDbName, DatabaseMigrationSqlMi parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, targetDbName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Stop in-progress database migration to SQL Managed Instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// + /// + /// The name of the target database. + /// + /// + /// Required migration operation ID for which cancel will be initiated. + /// + public static void Cancel(this IDatabaseMigrationsSqlMiOperations operations, string resourceGroupName, string managedInstanceName, string targetDbName, MigrationOperationInput parameters) + { + operations.CancelAsync(resourceGroupName, managedInstanceName, targetDbName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Stop in-progress database migration to SQL Managed Instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// + /// + /// The name of the target database. + /// + /// + /// Required migration operation ID for which cancel will be initiated. + /// + /// + /// The cancellation token. + /// + public static async Task CancelAsync(this IDatabaseMigrationsSqlMiOperations operations, string resourceGroupName, string managedInstanceName, string targetDbName, MigrationOperationInput parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.CancelWithHttpMessagesAsync(resourceGroupName, managedInstanceName, targetDbName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Initiate cutover for in-progress online database migration to SQL Managed + /// Instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// + /// + /// The name of the target database. + /// + /// + /// Required migration operation ID for which cutover will be initiated. + /// + public static void Cutover(this IDatabaseMigrationsSqlMiOperations operations, string resourceGroupName, string managedInstanceName, string targetDbName, MigrationOperationInput parameters) + { + operations.CutoverAsync(resourceGroupName, managedInstanceName, targetDbName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Initiate cutover for in-progress online database migration to SQL Managed + /// Instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// + /// + /// The name of the target database. + /// + /// + /// Required migration operation ID for which cutover will be initiated. + /// + /// + /// The cancellation token. + /// + public static async Task CutoverAsync(this IDatabaseMigrationsSqlMiOperations operations, string resourceGroupName, string managedInstanceName, string targetDbName, MigrationOperationInput parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.CutoverWithHttpMessagesAsync(resourceGroupName, managedInstanceName, targetDbName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Create a new database migration to a given SQL Managed Instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// + /// + /// The name of the target database. + /// + /// + /// Details of SqlMigrationService resource. + /// + public static DatabaseMigrationSqlMi BeginCreateOrUpdate(this IDatabaseMigrationsSqlMiOperations operations, string resourceGroupName, string managedInstanceName, string targetDbName, DatabaseMigrationSqlMi parameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, targetDbName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create a new database migration to a given SQL Managed Instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// + /// + /// The name of the target database. + /// + /// + /// Details of SqlMigrationService resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IDatabaseMigrationsSqlMiOperations operations, string resourceGroupName, string managedInstanceName, string targetDbName, DatabaseMigrationSqlMi parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, managedInstanceName, targetDbName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Stop in-progress database migration to SQL Managed Instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// + /// + /// The name of the target database. + /// + /// + /// Required migration operation ID for which cancel will be initiated. + /// + public static void BeginCancel(this IDatabaseMigrationsSqlMiOperations operations, string resourceGroupName, string managedInstanceName, string targetDbName, MigrationOperationInput parameters) + { + operations.BeginCancelAsync(resourceGroupName, managedInstanceName, targetDbName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Stop in-progress database migration to SQL Managed Instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// + /// + /// The name of the target database. + /// + /// + /// Required migration operation ID for which cancel will be initiated. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCancelAsync(this IDatabaseMigrationsSqlMiOperations operations, string resourceGroupName, string managedInstanceName, string targetDbName, MigrationOperationInput parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginCancelWithHttpMessagesAsync(resourceGroupName, managedInstanceName, targetDbName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Initiate cutover for in-progress online database migration to SQL Managed + /// Instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// + /// + /// The name of the target database. + /// + /// + /// Required migration operation ID for which cutover will be initiated. + /// + public static void BeginCutover(this IDatabaseMigrationsSqlMiOperations operations, string resourceGroupName, string managedInstanceName, string targetDbName, MigrationOperationInput parameters) + { + operations.BeginCutoverAsync(resourceGroupName, managedInstanceName, targetDbName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Initiate cutover for in-progress online database migration to SQL Managed + /// Instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// + /// + /// The name of the target database. + /// + /// + /// Required migration operation ID for which cutover will be initiated. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCutoverAsync(this IDatabaseMigrationsSqlMiOperations operations, string resourceGroupName, string managedInstanceName, string targetDbName, MigrationOperationInput parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginCutoverWithHttpMessagesAsync(resourceGroupName, managedInstanceName, targetDbName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/DatabaseMigrationsSqlVmOperations.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/DatabaseMigrationsSqlVmOperations.cs new file mode 100644 index 000000000000..1f6295056631 --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/DatabaseMigrationsSqlVmOperations.cs @@ -0,0 +1,990 @@ +// +// 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.DataMigration +{ + 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; + + /// + /// DatabaseMigrationsSqlVmOperations operations. + /// + internal partial class DatabaseMigrationsSqlVmOperations : IServiceOperations, IDatabaseMigrationsSqlVmOperations + { + /// + /// Initializes a new instance of the DatabaseMigrationsSqlVmOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DatabaseMigrationsSqlVmOperations(DataMigrationServiceClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DataMigrationServiceClient + /// + public DataMigrationServiceClient Client { get; private set; } + + /// + /// Retrieve the specified database migration for a given SQL VM. + /// + /// + /// 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 target database. + /// + /// + /// Optional migration operation ID. If this is provided, then details of + /// migration operation for that ID are retrieved. If not provided (default), + /// then details related to most recent or current operation are retrieved. + /// + /// + /// The child resources to include in the response. + /// + /// + /// 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 sqlVirtualMachineName, string targetDbName, System.Guid? migrationOperationId = default(System.Guid?), string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sqlVirtualMachineName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlVirtualMachineName"); + } + if (targetDbName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "targetDbName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sqlVirtualMachineName", sqlVirtualMachineName); + tracingParameters.Add("targetDbName", targetDbName); + tracingParameters.Add("migrationOperationId", migrationOperationId); + tracingParameters.Add("expand", expand); + 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.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDbName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sqlVirtualMachineName}", System.Uri.EscapeDataString(sqlVirtualMachineName)); + _url = _url.Replace("{targetDbName}", System.Uri.EscapeDataString(targetDbName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (migrationOperationId != null) + { + _queryParameters.Add(string.Format("migrationOperationId={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(migrationOperationId, Client.SerializationSettings).Trim('"')))); + } + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create a new database migration to a given SQL VM. + /// + /// + /// 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 target database. + /// + /// + /// Details of SqlMigrationService resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string sqlVirtualMachineName, string targetDbName, DatabaseMigrationSqlVm parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, sqlVirtualMachineName, targetDbName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Stop in-progress database migration to SQL VM. + /// + /// + /// 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 target database. + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task CancelWithHttpMessagesAsync(string resourceGroupName, string sqlVirtualMachineName, string targetDbName, MigrationOperationInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginCancelWithHttpMessagesAsync(resourceGroupName, sqlVirtualMachineName, targetDbName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Initiate cutover for in-progress online database migration to SQL VM. + /// + /// + /// 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 target database. + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task CutoverWithHttpMessagesAsync(string resourceGroupName, string sqlVirtualMachineName, string targetDbName, MigrationOperationInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginCutoverWithHttpMessagesAsync(resourceGroupName, sqlVirtualMachineName, targetDbName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create a new database migration to a given SQL VM. + /// + /// + /// 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 target database. + /// + /// + /// Details of SqlMigrationService resource. + /// + /// + /// 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 sqlVirtualMachineName, string targetDbName, DatabaseMigrationSqlVm parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sqlVirtualMachineName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlVirtualMachineName"); + } + if (targetDbName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "targetDbName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sqlVirtualMachineName", sqlVirtualMachineName); + tracingParameters.Add("targetDbName", targetDbName); + tracingParameters.Add("parameters", parameters); + 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.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDbName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sqlVirtualMachineName}", System.Uri.EscapeDataString(sqlVirtualMachineName)); + _url = _url.Replace("{targetDbName}", System.Uri.EscapeDataString(targetDbName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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 != 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; + } + + /// + /// Stop in-progress database migration to SQL VM. + /// + /// + /// 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 target database. + /// + /// + /// + /// + /// 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 BeginCancelWithHttpMessagesAsync(string resourceGroupName, string sqlVirtualMachineName, string targetDbName, MigrationOperationInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sqlVirtualMachineName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlVirtualMachineName"); + } + if (targetDbName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "targetDbName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sqlVirtualMachineName", sqlVirtualMachineName); + tracingParameters.Add("targetDbName", targetDbName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCancel", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDbName}/cancel").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sqlVirtualMachineName}", System.Uri.EscapeDataString(sqlVirtualMachineName)); + _url = _url.Replace("{targetDbName}", System.Uri.EscapeDataString(targetDbName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Initiate cutover for in-progress online database migration to SQL VM. + /// + /// + /// 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 target database. + /// + /// + /// + /// + /// 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 BeginCutoverWithHttpMessagesAsync(string resourceGroupName, string sqlVirtualMachineName, string targetDbName, MigrationOperationInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sqlVirtualMachineName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlVirtualMachineName"); + } + if (targetDbName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "targetDbName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sqlVirtualMachineName", sqlVirtualMachineName); + tracingParameters.Add("targetDbName", targetDbName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCutover", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/providers/Microsoft.DataMigration/databaseMigrations/{targetDbName}/cutover").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sqlVirtualMachineName}", System.Uri.EscapeDataString(sqlVirtualMachineName)); + _url = _url.Replace("{targetDbName}", System.Uri.EscapeDataString(targetDbName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/DatabaseMigrationsSqlVmOperationsExtensions.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/DatabaseMigrationsSqlVmOperationsExtensions.cs new file mode 100644 index 000000000000..c79a54b15518 --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/DatabaseMigrationsSqlVmOperationsExtensions.cs @@ -0,0 +1,379 @@ +// +// 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.DataMigration +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DatabaseMigrationsSqlVmOperations. + /// + public static partial class DatabaseMigrationsSqlVmOperationsExtensions + { + /// + /// Retrieve the specified database migration for a given SQL VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// + /// + /// The name of the target database. + /// + /// + /// Optional migration operation ID. If this is provided, then details of + /// migration operation for that ID are retrieved. If not provided (default), + /// then details related to most recent or current operation are retrieved. + /// + /// + /// The child resources to include in the response. + /// + public static DatabaseMigrationSqlVm Get(this IDatabaseMigrationsSqlVmOperations operations, string resourceGroupName, string sqlVirtualMachineName, string targetDbName, System.Guid? migrationOperationId = default(System.Guid?), string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, sqlVirtualMachineName, targetDbName, migrationOperationId, expand).GetAwaiter().GetResult(); + } + + /// + /// Retrieve the specified database migration for a given SQL VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// + /// + /// The name of the target database. + /// + /// + /// Optional migration operation ID. If this is provided, then details of + /// migration operation for that ID are retrieved. If not provided (default), + /// then details related to most recent or current operation are retrieved. + /// + /// + /// The child resources to include in the response. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDatabaseMigrationsSqlVmOperations operations, string resourceGroupName, string sqlVirtualMachineName, string targetDbName, System.Guid? migrationOperationId = default(System.Guid?), string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, sqlVirtualMachineName, targetDbName, migrationOperationId, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create a new database migration to a given SQL VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// + /// + /// The name of the target database. + /// + /// + /// Details of SqlMigrationService resource. + /// + public static DatabaseMigrationSqlVm CreateOrUpdate(this IDatabaseMigrationsSqlVmOperations operations, string resourceGroupName, string sqlVirtualMachineName, string targetDbName, DatabaseMigrationSqlVm parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, sqlVirtualMachineName, targetDbName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create a new database migration to a given SQL VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// + /// + /// The name of the target database. + /// + /// + /// Details of SqlMigrationService resource. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IDatabaseMigrationsSqlVmOperations operations, string resourceGroupName, string sqlVirtualMachineName, string targetDbName, DatabaseMigrationSqlVm parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, sqlVirtualMachineName, targetDbName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Stop in-progress database migration to SQL VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// + /// + /// The name of the target database. + /// + /// + /// + public static void Cancel(this IDatabaseMigrationsSqlVmOperations operations, string resourceGroupName, string sqlVirtualMachineName, string targetDbName, MigrationOperationInput parameters) + { + operations.CancelAsync(resourceGroupName, sqlVirtualMachineName, targetDbName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Stop in-progress database migration to SQL VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// + /// + /// The name of the target database. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CancelAsync(this IDatabaseMigrationsSqlVmOperations operations, string resourceGroupName, string sqlVirtualMachineName, string targetDbName, MigrationOperationInput parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.CancelWithHttpMessagesAsync(resourceGroupName, sqlVirtualMachineName, targetDbName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Initiate cutover for in-progress online database migration to SQL VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// + /// + /// The name of the target database. + /// + /// + /// + public static void Cutover(this IDatabaseMigrationsSqlVmOperations operations, string resourceGroupName, string sqlVirtualMachineName, string targetDbName, MigrationOperationInput parameters) + { + operations.CutoverAsync(resourceGroupName, sqlVirtualMachineName, targetDbName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Initiate cutover for in-progress online database migration to SQL VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// + /// + /// The name of the target database. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CutoverAsync(this IDatabaseMigrationsSqlVmOperations operations, string resourceGroupName, string sqlVirtualMachineName, string targetDbName, MigrationOperationInput parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.CutoverWithHttpMessagesAsync(resourceGroupName, sqlVirtualMachineName, targetDbName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Create a new database migration to a given SQL VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// + /// + /// The name of the target database. + /// + /// + /// Details of SqlMigrationService resource. + /// + public static DatabaseMigrationSqlVm BeginCreateOrUpdate(this IDatabaseMigrationsSqlVmOperations operations, string resourceGroupName, string sqlVirtualMachineName, string targetDbName, DatabaseMigrationSqlVm parameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, sqlVirtualMachineName, targetDbName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create a new database migration to a given SQL VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// + /// + /// The name of the target database. + /// + /// + /// Details of SqlMigrationService resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IDatabaseMigrationsSqlVmOperations operations, string resourceGroupName, string sqlVirtualMachineName, string targetDbName, DatabaseMigrationSqlVm parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, sqlVirtualMachineName, targetDbName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Stop in-progress database migration to SQL VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// + /// + /// The name of the target database. + /// + /// + /// + public static void BeginCancel(this IDatabaseMigrationsSqlVmOperations operations, string resourceGroupName, string sqlVirtualMachineName, string targetDbName, MigrationOperationInput parameters) + { + operations.BeginCancelAsync(resourceGroupName, sqlVirtualMachineName, targetDbName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Stop in-progress database migration to SQL VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// + /// + /// The name of the target database. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task BeginCancelAsync(this IDatabaseMigrationsSqlVmOperations operations, string resourceGroupName, string sqlVirtualMachineName, string targetDbName, MigrationOperationInput parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginCancelWithHttpMessagesAsync(resourceGroupName, sqlVirtualMachineName, targetDbName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Initiate cutover for in-progress online database migration to SQL VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// + /// + /// The name of the target database. + /// + /// + /// + public static void BeginCutover(this IDatabaseMigrationsSqlVmOperations operations, string resourceGroupName, string sqlVirtualMachineName, string targetDbName, MigrationOperationInput parameters) + { + operations.BeginCutoverAsync(resourceGroupName, sqlVirtualMachineName, targetDbName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Initiate cutover for in-progress online database migration to SQL VM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// + /// + /// The name of the target database. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task BeginCutoverAsync(this IDatabaseMigrationsSqlVmOperations operations, string resourceGroupName, string sqlVirtualMachineName, string targetDbName, MigrationOperationInput parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginCutoverWithHttpMessagesAsync(resourceGroupName, sqlVirtualMachineName, targetDbName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/IDataMigrationServiceClient.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/IDataMigrationServiceClient.cs index a9f68c7a86fb..041c6db62e96 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/IDataMigrationServiceClient.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/IDataMigrationServiceClient.cs @@ -41,14 +41,19 @@ public partial interface IDataMigrationServiceClient : System.IDisposable ServiceClientCredentials Credentials { get; } /// - /// Version of the API + /// Subscription ID that identifies an Azure subscription. + /// + string SubscriptionId { get; set; } + + /// + /// API version to use for the request. /// string ApiVersion { get; } /// - /// Identifier of the subscription + /// Version of the API /// - string SubscriptionId { get; set; } + string ApiVersion1 { get; set; } /// /// The preferred language for the response. @@ -69,6 +74,26 @@ public partial interface IDataMigrationServiceClient : System.IDisposable bool? GenerateClientRequestId { get; set; } + /// + /// Gets the IDatabaseMigrationsSqlMiOperations. + /// + IDatabaseMigrationsSqlMiOperations DatabaseMigrationsSqlMi { get; } + + /// + /// Gets the IDatabaseMigrationsSqlVmOperations. + /// + IDatabaseMigrationsSqlVmOperations DatabaseMigrationsSqlVm { get; } + + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } + + /// + /// Gets the ISqlMigrationServicesOperations. + /// + ISqlMigrationServicesOperations SqlMigrationServices { get; } + /// /// Gets the IResourceSkusOperations. /// @@ -99,11 +124,6 @@ public partial interface IDataMigrationServiceClient : System.IDisposable /// IUsagesOperations Usages { get; } - /// - /// Gets the IOperations. - /// - IOperations Operations { get; } - /// /// Gets the IFilesOperations. /// diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/IDatabaseMigrationsSqlMiOperations.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/IDatabaseMigrationsSqlMiOperations.cs new file mode 100644 index 000000000000..1e6624255cc8 --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/IDatabaseMigrationsSqlMiOperations.cs @@ -0,0 +1,250 @@ +// +// 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.DataMigration +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DatabaseMigrationsSqlMiOperations operations. + /// + public partial interface IDatabaseMigrationsSqlMiOperations + { + /// + /// Retrieve the specified database migration for a given SQL Managed + /// Instance. + /// + /// + /// 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 target database. + /// + /// + /// Optional migration operation ID. If this is provided, then details + /// of migration operation for that ID are retrieved. If not provided + /// (default), then details related to most recent or current operation + /// are retrieved. + /// + /// + /// The child resources to include in the response. + /// + /// + /// 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 managedInstanceName, string targetDbName, System.Guid? migrationOperationId = default(System.Guid?), string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create a new database migration to a given SQL Managed Instance. + /// + /// + /// 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 target database. + /// + /// + /// Details of SqlMigrationService resource. + /// + /// + /// 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 managedInstanceName, string targetDbName, DatabaseMigrationSqlMi parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Stop in-progress database migration to SQL Managed Instance. + /// + /// + /// 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 target database. + /// + /// + /// Required migration operation ID for which cancel will be initiated. + /// + /// + /// 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 CancelWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string targetDbName, MigrationOperationInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Initiate cutover for in-progress online database migration to SQL + /// Managed Instance. + /// + /// + /// 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 target database. + /// + /// + /// Required migration operation ID for which cutover will be + /// initiated. + /// + /// + /// 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 CutoverWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string targetDbName, MigrationOperationInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create a new database migration to a given SQL Managed Instance. + /// + /// + /// 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 target database. + /// + /// + /// Details of SqlMigrationService resource. + /// + /// + /// 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 managedInstanceName, string targetDbName, DatabaseMigrationSqlMi parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Stop in-progress database migration to SQL Managed Instance. + /// + /// + /// 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 target database. + /// + /// + /// Required migration operation ID for which cancel will be initiated. + /// + /// + /// 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 BeginCancelWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string targetDbName, MigrationOperationInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Initiate cutover for in-progress online database migration to SQL + /// Managed Instance. + /// + /// + /// 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 target database. + /// + /// + /// Required migration operation ID for which cutover will be + /// initiated. + /// + /// + /// 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 BeginCutoverWithHttpMessagesAsync(string resourceGroupName, string managedInstanceName, string targetDbName, MigrationOperationInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/IDatabaseMigrationsSqlVmOperations.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/IDatabaseMigrationsSqlVmOperations.cs new file mode 100644 index 000000000000..bde6dd0b8c19 --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/IDatabaseMigrationsSqlVmOperations.cs @@ -0,0 +1,243 @@ +// +// 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.DataMigration +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DatabaseMigrationsSqlVmOperations operations. + /// + public partial interface IDatabaseMigrationsSqlVmOperations + { + /// + /// Retrieve the specified database migration for a given SQL VM. + /// + /// + /// 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 target database. + /// + /// + /// Optional migration operation ID. If this is provided, then details + /// of migration operation for that ID are retrieved. If not provided + /// (default), then details related to most recent or current operation + /// are retrieved. + /// + /// + /// The child resources to include in the response. + /// + /// + /// 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 sqlVirtualMachineName, string targetDbName, System.Guid? migrationOperationId = default(System.Guid?), string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create a new database migration to a given SQL VM. + /// + /// + /// 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 target database. + /// + /// + /// Details of SqlMigrationService resource. + /// + /// + /// 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 sqlVirtualMachineName, string targetDbName, DatabaseMigrationSqlVm parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Stop in-progress database migration to SQL VM. + /// + /// + /// 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 target database. + /// + /// + /// + /// + /// 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 CancelWithHttpMessagesAsync(string resourceGroupName, string sqlVirtualMachineName, string targetDbName, MigrationOperationInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Initiate cutover for in-progress online database migration to SQL + /// VM. + /// + /// + /// 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 target database. + /// + /// + /// + /// + /// 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 CutoverWithHttpMessagesAsync(string resourceGroupName, string sqlVirtualMachineName, string targetDbName, MigrationOperationInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create a new database migration to a given SQL VM. + /// + /// + /// 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 target database. + /// + /// + /// Details of SqlMigrationService resource. + /// + /// + /// 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 sqlVirtualMachineName, string targetDbName, DatabaseMigrationSqlVm parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Stop in-progress database migration to SQL VM. + /// + /// + /// 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 target database. + /// + /// + /// + /// + /// 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 BeginCancelWithHttpMessagesAsync(string resourceGroupName, string sqlVirtualMachineName, string targetDbName, MigrationOperationInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Initiate cutover for in-progress online database migration to SQL + /// VM. + /// + /// + /// 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 target database. + /// + /// + /// + /// + /// 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 BeginCutoverWithHttpMessagesAsync(string resourceGroupName, string sqlVirtualMachineName, string targetDbName, MigrationOperationInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/IOperations.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/IOperations.cs index 4b23a3fd6761..10c2bebc93f3 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/IOperations.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/IOperations.cs @@ -24,19 +24,15 @@ namespace Microsoft.Azure.Management.DataMigration public partial interface IOperations { /// - /// Get available resource provider actions (operations) + /// Lists all of the available SQL Migration REST API operations. /// - /// - /// Lists all available actions exposed by the Database Migration - /// Service resource provider. - /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -45,14 +41,10 @@ public partial interface IOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Get available resource provider actions (operations) + /// Lists all of the available SQL Migration REST API operations. /// - /// - /// Lists all available actions exposed by the Database Migration - /// Service resource provider. - /// /// /// The NextLink from the previous successful call to List operation. /// @@ -62,7 +54,7 @@ public partial interface IOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -71,6 +63,6 @@ public partial interface IOperations /// /// Thrown when a required parameter is null /// - Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/ISqlMigrationServicesOperations.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/ISqlMigrationServicesOperations.cs new file mode 100644 index 000000000000..fc53184b5c97 --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/ISqlMigrationServicesOperations.cs @@ -0,0 +1,475 @@ +// +// 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.DataMigration +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SqlMigrationServicesOperations operations. + /// + public partial interface ISqlMigrationServicesOperations + { + /// + /// Retrieve the Database Migration Service + /// + /// + /// Name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// 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 sqlMigrationServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or Update Database Migration Service. + /// + /// + /// Name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// Details of SqlMigrationService resource. + /// + /// + /// 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 sqlMigrationServiceName, SqlMigrationService parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete Database Migration Service. + /// + /// + /// Name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// 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 sqlMigrationServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update Database Migration Service. + /// + /// + /// Name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// Details of SqlMigrationService resource. + /// + /// + /// 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 sqlMigrationServiceName, SqlMigrationServiceUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieve all SQL migration services in the resource group. + /// + /// + /// Name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieve the List of Authentication Keys for Self Hosted + /// Integration Runtime. + /// + /// + /// Name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// 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> ListAuthKeysWithHttpMessagesAsync(string resourceGroupName, string sqlMigrationServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Regenerate a new set of Authentication Keys for Self Hosted + /// Integration Runtime. + /// + /// + /// Name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// Details of SqlMigrationService resource. + /// + /// + /// 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> RegenerateAuthKeysWithHttpMessagesAsync(string resourceGroupName, string sqlMigrationServiceName, RegenAuthKeys parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete the integration runtime node. + /// + /// + /// Name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// Details of SqlMigrationService resource. + /// + /// + /// 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> DeleteNodeMethodWithHttpMessagesAsync(string resourceGroupName, string sqlMigrationServiceName, DeleteNode parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieve the List of database migrations attached to the service. + /// + /// + /// Name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// 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>> ListMigrationsWithHttpMessagesAsync(string resourceGroupName, string sqlMigrationServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieve the registered Integration Runtime nodes and their + /// monitoring data for a given Database Migration Service. + /// + /// + /// Name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// 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> ListMonitoringDataWithHttpMessagesAsync(string resourceGroupName, string sqlMigrationServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieve all SQL migration services in the subscriptions. + /// + /// + /// 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>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or Update Database Migration Service. + /// + /// + /// Name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// Details of SqlMigrationService resource. + /// + /// + /// 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 sqlMigrationServiceName, SqlMigrationService parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete Database Migration Service. + /// + /// + /// Name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// 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 sqlMigrationServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update Database Migration Service. + /// + /// + /// Name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// Details of SqlMigrationService resource. + /// + /// + /// 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 sqlMigrationServiceName, SqlMigrationServiceUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieve all SQL migration services in the resource 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>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieve the List of database migrations attached to the service. + /// + /// + /// 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>> ListMigrationsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieve all SQL migration services in the subscriptions. + /// + /// + /// 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>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/AuthenticationKeys.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/AuthenticationKeys.cs new file mode 100644 index 000000000000..2e9b419e585e --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/AuthenticationKeys.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataMigration.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An authentication key. + /// + public partial class AuthenticationKeys + { + /// + /// Initializes a new instance of the AuthenticationKeys class. + /// + public AuthenticationKeys() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AuthenticationKeys class. + /// + /// The first authentication key. + /// The second authentication key. + public AuthenticationKeys(string authKey1 = default(string), string authKey2 = default(string)) + { + AuthKey1 = authKey1; + AuthKey2 = authKey2; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the first authentication key. + /// + [JsonProperty(PropertyName = "authKey1")] + public string AuthKey1 { get; set; } + + /// + /// Gets or sets the second authentication key. + /// + [JsonProperty(PropertyName = "authKey2")] + public string AuthKey2 { get; set; } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/AzureActiveDirectoryApp.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/AzureActiveDirectoryApp.cs index faffa382c8d4..3f80c7ee931b 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/AzureActiveDirectoryApp.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/AzureActiveDirectoryApp.cs @@ -35,11 +35,14 @@ public AzureActiveDirectoryApp() /// Key used to authenticate to the Azure Active /// Directory Application /// Tenant id of the customer - public AzureActiveDirectoryApp(string applicationId, string appKey, string tenantId) + /// Ignore checking azure + /// permissions on the AAD app + public AzureActiveDirectoryApp(string applicationId, string appKey, string tenantId, bool? ignoreAzurePermissions = default(bool?)) { ApplicationId = applicationId; AppKey = appKey; TenantId = tenantId; + IgnoreAzurePermissions = ignoreAzurePermissions; CustomInit(); } @@ -68,6 +71,12 @@ public AzureActiveDirectoryApp(string applicationId, string appKey, string tenan [JsonProperty(PropertyName = "tenantId")] public string TenantId { get; set; } + /// + /// Gets or sets ignore checking azure permissions on the AAD app + /// + [JsonProperty(PropertyName = "ignoreAzurePermissions")] + public bool? IgnoreAzurePermissions { get; set; } + /// /// Validate the object. /// diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/AzureBlob.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/AzureBlob.cs new file mode 100644 index 000000000000..717f23cba922 --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/AzureBlob.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataMigration.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Azure Blob Details + /// + public partial class AzureBlob + { + /// + /// Initializes a new instance of the AzureBlob class. + /// + public AzureBlob() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureBlob class. + /// + /// Resource Id of the storage + /// account where backups are stored. + /// Storage Account Key. + /// Blob container name where backups + /// are stored. + public AzureBlob(string storageAccountResourceId = default(string), string accountKey = default(string), string blobContainerName = default(string)) + { + StorageAccountResourceId = storageAccountResourceId; + AccountKey = accountKey; + BlobContainerName = blobContainerName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource Id of the storage account where backups are + /// stored. + /// + [JsonProperty(PropertyName = "storageAccountResourceId")] + public string StorageAccountResourceId { get; set; } + + /// + /// Gets or sets storage Account Key. + /// + [JsonProperty(PropertyName = "accountKey")] + public string AccountKey { get; set; } + + /// + /// Gets or sets blob container name where backups are stored. + /// + [JsonProperty(PropertyName = "blobContainerName")] + public string BlobContainerName { get; set; } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/BackupConfiguration.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/BackupConfiguration.cs new file mode 100644 index 000000000000..726e3f5ee2ac --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/BackupConfiguration.cs @@ -0,0 +1,60 @@ +// +// 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.DataMigration.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Backup Configuration + /// + public partial class BackupConfiguration + { + /// + /// Initializes a new instance of the BackupConfiguration class. + /// + public BackupConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BackupConfiguration class. + /// + /// Source location of backups. + /// Target location for copying + /// backups. + public BackupConfiguration(SourceLocation sourceLocation = default(SourceLocation), TargetLocation targetLocation = default(TargetLocation)) + { + SourceLocation = sourceLocation; + TargetLocation = targetLocation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets source location of backups. + /// + [JsonProperty(PropertyName = "sourceLocation")] + public SourceLocation SourceLocation { get; set; } + + /// + /// Gets or sets target location for copying backups. + /// + [JsonProperty(PropertyName = "targetLocation")] + public TargetLocation TargetLocation { get; set; } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/BlobShare.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/BlobShare.cs index 7751f935446e..5576b690be81 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/BlobShare.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/BlobShare.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Management.DataMigration.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -32,7 +31,7 @@ public BlobShare() /// /// SAS URI of Azure Storage Account /// Container. - public BlobShare(string sasUri) + public BlobShare(string sasUri = default(string)) { SasUri = sasUri; CustomInit(); @@ -49,18 +48,5 @@ public BlobShare(string sasUri) [JsonProperty(PropertyName = "sasUri")] public string SasUri { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (SasUri == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "SasUri"); - } - } } } diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ConnectToSourceMySqlTaskInput.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ConnectToSourceMySqlTaskInput.cs index 493ad9a5b589..dc1b2f19a769 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ConnectToSourceMySqlTaskInput.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ConnectToSourceMySqlTaskInput.cs @@ -40,7 +40,8 @@ public ConnectToSourceMySqlTaskInput() /// validations. Possible values include: 'Default', /// 'MigrationFromSqlServerToAzureDB', /// 'MigrationFromSqlServerToAzureMI', - /// 'MigrationFromMySQLToAzureDBForMySQL' + /// 'MigrationFromMySQLToAzureDBForMySQL', + /// 'MigrationFromSqlServerToAzureVM' /// Flag for whether or not the /// migration is offline public ConnectToSourceMySqlTaskInput(MySqlConnectionInfo sourceConnectionInfo, string targetPlatform = default(string), ServerLevelPermissionsGroup? checkPermissionsGroup = default(ServerLevelPermissionsGroup?), bool? isOfflineMigration = default(bool?)) @@ -74,7 +75,8 @@ public ConnectToSourceMySqlTaskInput() /// Gets or sets permission group for validations. Possible values /// include: 'Default', 'MigrationFromSqlServerToAzureDB', /// 'MigrationFromSqlServerToAzureMI', - /// 'MigrationFromMySQLToAzureDBForMySQL' + /// 'MigrationFromMySQLToAzureDBForMySQL', + /// 'MigrationFromSqlServerToAzureVM' /// [JsonProperty(PropertyName = "checkPermissionsGroup")] public ServerLevelPermissionsGroup? CheckPermissionsGroup { get; set; } diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ConnectToSourceSqlServerTaskInput.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ConnectToSourceSqlServerTaskInput.cs index 94d66fa9342e..008d03e3459e 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ConnectToSourceSqlServerTaskInput.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ConnectToSourceSqlServerTaskInput.cs @@ -39,7 +39,8 @@ public ConnectToSourceSqlServerTaskInput() /// validations. Possible values include: 'Default', /// 'MigrationFromSqlServerToAzureDB', /// 'MigrationFromSqlServerToAzureMI', - /// 'MigrationFromMySQLToAzureDBForMySQL' + /// 'MigrationFromMySQLToAzureDBForMySQL', + /// 'MigrationFromSqlServerToAzureVM' /// Flag for whether to collect /// databases from source server. /// Flag for whether to collect logins from @@ -50,7 +51,9 @@ public ConnectToSourceSqlServerTaskInput() /// TDE Certificate names from source server. /// Flag for whether to validate /// SSIS catalog is reachable on the source server. - public ConnectToSourceSqlServerTaskInput(SqlConnectionInfo sourceConnectionInfo, ServerLevelPermissionsGroup? checkPermissionsGroup = default(ServerLevelPermissionsGroup?), bool? collectDatabases = default(bool?), bool? collectLogins = default(bool?), bool? collectAgentJobs = default(bool?), bool? collectTdeCertificateInfo = default(bool?), bool? validateSsisCatalogOnly = default(bool?)) + /// encrypted key for secure + /// fields + public ConnectToSourceSqlServerTaskInput(SqlConnectionInfo sourceConnectionInfo, ServerLevelPermissionsGroup? checkPermissionsGroup = default(ServerLevelPermissionsGroup?), bool? collectDatabases = default(bool?), bool? collectLogins = default(bool?), bool? collectAgentJobs = default(bool?), bool? collectTdeCertificateInfo = default(bool?), bool? validateSsisCatalogOnly = default(bool?), string encryptedKeyForSecureFields = default(string)) { SourceConnectionInfo = sourceConnectionInfo; CheckPermissionsGroup = checkPermissionsGroup; @@ -59,6 +62,7 @@ public ConnectToSourceSqlServerTaskInput() CollectAgentJobs = collectAgentJobs; CollectTdeCertificateInfo = collectTdeCertificateInfo; ValidateSsisCatalogOnly = validateSsisCatalogOnly; + EncryptedKeyForSecureFields = encryptedKeyForSecureFields; CustomInit(); } @@ -77,7 +81,8 @@ public ConnectToSourceSqlServerTaskInput() /// Gets or sets permission group for validations. Possible values /// include: 'Default', 'MigrationFromSqlServerToAzureDB', /// 'MigrationFromSqlServerToAzureMI', - /// 'MigrationFromMySQLToAzureDBForMySQL' + /// 'MigrationFromMySQLToAzureDBForMySQL', + /// 'MigrationFromSqlServerToAzureVM' /// [JsonProperty(PropertyName = "checkPermissionsGroup")] public ServerLevelPermissionsGroup? CheckPermissionsGroup { get; set; } @@ -116,6 +121,12 @@ public ConnectToSourceSqlServerTaskInput() [JsonProperty(PropertyName = "validateSsisCatalogOnly")] public bool? ValidateSsisCatalogOnly { get; set; } + /// + /// Gets or sets encrypted key for secure fields + /// + [JsonProperty(PropertyName = "encryptedKeyForSecureFields")] + public string EncryptedKeyForSecureFields { get; set; } + /// /// Validate the object. /// diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ConnectToSourceSqlServerTaskProperties.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ConnectToSourceSqlServerTaskProperties.cs index e64a77817aae..479b33748411 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ConnectToSourceSqlServerTaskProperties.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ConnectToSourceSqlServerTaskProperties.cs @@ -47,11 +47,13 @@ public ConnectToSourceSqlServerTaskProperties() /// Task input /// Task output. This is ignored if /// submitted. - public ConnectToSourceSqlServerTaskProperties(IList errors = default(IList), string state = default(string), IList commands = default(IList), IDictionary clientData = default(IDictionary), ConnectToSourceSqlServerTaskInput input = default(ConnectToSourceSqlServerTaskInput), IList output = default(IList)) + /// Task id + public ConnectToSourceSqlServerTaskProperties(IList errors = default(IList), string state = default(string), IList commands = default(IList), IDictionary clientData = default(IDictionary), ConnectToSourceSqlServerTaskInput input = default(ConnectToSourceSqlServerTaskInput), IList output = default(IList), string taskId = default(string)) : base(errors, state, commands, clientData) { Input = input; Output = output; + TaskId = taskId; CustomInit(); } @@ -72,6 +74,12 @@ public ConnectToSourceSqlServerTaskProperties() [JsonProperty(PropertyName = "output")] public IList Output { get; private set; } + /// + /// Gets or sets task id + /// + [JsonProperty(PropertyName = "taskId")] + public string TaskId { get; set; } + /// /// Validate the object. /// diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ConnectToTargetSqlDbTaskInput.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ConnectToTargetSqlDbTaskInput.cs index 2618bcc513cc..95743dd32751 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ConnectToTargetSqlDbTaskInput.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ConnectToTargetSqlDbTaskInput.cs @@ -35,9 +35,12 @@ public ConnectToTargetSqlDbTaskInput() /// /// Connection information for /// target SQL DB - public ConnectToTargetSqlDbTaskInput(SqlConnectionInfo targetConnectionInfo) + /// Boolean flag indicating whether to + /// query object counts for each database on the target server + public ConnectToTargetSqlDbTaskInput(SqlConnectionInfo targetConnectionInfo, bool? queryObjectCounts = default(bool?)) { TargetConnectionInfo = targetConnectionInfo; + QueryObjectCounts = queryObjectCounts; CustomInit(); } @@ -52,6 +55,13 @@ public ConnectToTargetSqlDbTaskInput(SqlConnectionInfo targetConnectionInfo) [JsonProperty(PropertyName = "targetConnectionInfo")] public SqlConnectionInfo TargetConnectionInfo { get; set; } + /// + /// Gets or sets boolean flag indicating whether to query object counts + /// for each database on the target server + /// + [JsonProperty(PropertyName = "queryObjectCounts")] + public bool? QueryObjectCounts { get; set; } + /// /// Validate the object. /// diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ConnectToTargetSqlDbTaskProperties.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ConnectToTargetSqlDbTaskProperties.cs index 27b84db362de..73ea6d1cdb27 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ConnectToTargetSqlDbTaskProperties.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ConnectToTargetSqlDbTaskProperties.cs @@ -47,11 +47,14 @@ public ConnectToTargetSqlDbTaskProperties() /// Task input /// Task output. This is ignored if /// submitted. - public ConnectToTargetSqlDbTaskProperties(IList errors = default(IList), string state = default(string), IList commands = default(IList), IDictionary clientData = default(IDictionary), ConnectToTargetSqlDbTaskInput input = default(ConnectToTargetSqlDbTaskInput), IList output = default(IList)) + /// DateTime in UTC when the task was + /// created + public ConnectToTargetSqlDbTaskProperties(IList errors = default(IList), string state = default(string), IList commands = default(IList), IDictionary clientData = default(IDictionary), ConnectToTargetSqlDbTaskInput input = default(ConnectToTargetSqlDbTaskInput), IList output = default(IList), string createdOn = default(string)) : base(errors, state, commands, clientData) { Input = input; Output = output; + CreatedOn = createdOn; CustomInit(); } @@ -72,6 +75,12 @@ public ConnectToTargetSqlDbTaskProperties() [JsonProperty(PropertyName = "output")] public IList Output { get; private set; } + /// + /// Gets or sets dateTime in UTC when the task was created + /// + [JsonProperty(PropertyName = "createdOn")] + public string CreatedOn { get; set; } + /// /// Validate the object. /// diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/DataMigrationService.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/DataMigrationService.cs index 59ea54c8990c..9f59de8700e5 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/DataMigrationService.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/DataMigrationService.cs @@ -34,16 +34,6 @@ public DataMigrationService() /// /// Initializes a new instance of the DataMigrationService class. /// - /// Resource location. - /// The ID of the - /// Microsoft.Network/virtualNetworks/subnets resource to which the - /// service should be joined - /// Resource ID. - /// Resource name. - /// Resource type. - /// Resource tags. - /// Metadata pertaining to creation and last - /// modification of the resource. /// HTTP strong entity tag value. Ignored if /// submitted /// The resource kind. Only 'vm' (the default) is @@ -54,12 +44,19 @@ public DataMigrationService() /// 'Succeeded', 'Failed' /// The public key of the service, used to /// encrypt secrets sent to the service + /// The ID of the + /// Microsoft.Network/virtualNetworks/subnets resource to which the + /// service should be joined /// The ID of the /// Microsoft.Network/networkInterfaces resource which the service /// have + /// The time delay before the service is + /// auto-stopped when idle. + /// Whether service resources + /// should be deleted when stopped. (Turned on by default) /// Service SKU - public DataMigrationService(string location, string virtualSubnetId, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), SystemData systemData = default(SystemData), string etag = default(string), string kind = default(string), string provisioningState = default(string), string publicKey = default(string), string virtualNicId = default(string), ServiceSku sku = default(ServiceSku)) - : base(location, id, name, type, tags, systemData) + public DataMigrationService(string location = default(string), IDictionary tags = default(IDictionary), string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), string kind = default(string), string provisioningState = default(string), string publicKey = default(string), string virtualSubnetId = default(string), string virtualNicId = default(string), string autoStopDelay = default(string), bool? deleteResourcesOnStop = default(bool?), ServiceSku sku = default(ServiceSku)) + : base(location, tags, id, name, type, systemData) { Etag = etag; Kind = kind; @@ -67,6 +64,8 @@ public DataMigrationService() PublicKey = publicKey; VirtualSubnetId = virtualSubnetId; VirtualNicId = virtualNicId; + AutoStopDelay = autoStopDelay; + DeleteResourcesOnStop = deleteResourcesOnStop; Sku = sku; CustomInit(); } @@ -119,25 +118,25 @@ public DataMigrationService() [JsonProperty(PropertyName = "properties.virtualNicId")] public string VirtualNicId { get; set; } + /// + /// Gets or sets the time delay before the service is auto-stopped when + /// idle. + /// + [JsonProperty(PropertyName = "properties.autoStopDelay")] + public string AutoStopDelay { get; set; } + + /// + /// Gets or sets whether service resources should be deleted when + /// stopped. (Turned on by default) + /// + [JsonProperty(PropertyName = "properties.deleteResourcesOnStop")] + public bool? DeleteResourcesOnStop { get; set; } + /// /// Gets or sets service SKU /// [JsonProperty(PropertyName = "sku")] public ServiceSku Sku { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - if (VirtualSubnetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "VirtualSubnetId"); - } - } } } diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/DataMigrationServiceStatusResponse.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/DataMigrationServiceStatusResponse.cs index c60ea6ddfc24..b417f29a6e6a 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/DataMigrationServiceStatusResponse.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/DataMigrationServiceStatusResponse.cs @@ -34,6 +34,7 @@ public DataMigrationServiceStatusResponse() /// DataMigrationServiceStatusResponse class. /// /// The DMS instance agent version + /// Agent Configuration /// The machine-readable status, such as /// 'Initializing', 'Offline', 'Online', 'Deploying', 'Deleting', /// 'Stopped', 'Stopping', 'Starting', 'FailedToStart', 'FailedToStop' @@ -42,9 +43,10 @@ public DataMigrationServiceStatusResponse() /// 'Standard_D2_v2' /// The list of supported task /// types - public DataMigrationServiceStatusResponse(string agentVersion = default(string), string status = default(string), string vmSize = default(string), IList supportedTaskTypes = default(IList)) + public DataMigrationServiceStatusResponse(string agentVersion = default(string), object agentConfiguration = default(object), string status = default(string), string vmSize = default(string), IList supportedTaskTypes = default(IList)) { AgentVersion = agentVersion; + AgentConfiguration = agentConfiguration; Status = status; VmSize = vmSize; SupportedTaskTypes = supportedTaskTypes; @@ -62,6 +64,12 @@ public DataMigrationServiceStatusResponse() [JsonProperty(PropertyName = "agentVersion")] public string AgentVersion { get; set; } + /// + /// Gets or sets agent Configuration + /// + [JsonProperty(PropertyName = "agentConfiguration")] + public object AgentConfiguration { get; set; } + /// /// Gets or sets the machine-readable status, such as 'Initializing', /// 'Offline', 'Online', 'Deploying', 'Deleting', 'Stopped', diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/DatabaseMigration.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/DatabaseMigration.cs new file mode 100644 index 000000000000..0e586e627376 --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/DatabaseMigration.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataMigration.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Database Migration Resource. + /// + public partial class DatabaseMigration : IResource + { + /// + /// Initializes a new instance of the DatabaseMigration class. + /// + public DatabaseMigration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatabaseMigration class. + /// + /// Metadata pertaining to creation and last + /// modification of the resource. + public DatabaseMigration(SystemData systemData = default(SystemData), DatabaseMigrationProperties properties = default(DatabaseMigrationProperties)) + { + SystemData = systemData; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets metadata pertaining to creation and last modification of the + /// resource. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "properties")] + public DatabaseMigrationProperties Properties { get; set; } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/DatabaseMigrationProperties.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/DatabaseMigrationProperties.cs new file mode 100644 index 000000000000..37d1a9c95a86 --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/DatabaseMigrationProperties.cs @@ -0,0 +1,136 @@ +// +// 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.DataMigration.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Database Migration Resource properties. + /// + public partial class DatabaseMigrationProperties + { + /// + /// Initializes a new instance of the DatabaseMigrationProperties + /// class. + /// + public DatabaseMigrationProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatabaseMigrationProperties + /// class. + /// + /// Resource Id of the target resource (SQL VM or + /// SQL Managed Instance). + /// Provisioning State of migration. + /// ProvisioningState as Succeeded implies that validations have been + /// performed and migration has started. + /// Migration status. + /// Database migration start time. + /// Database migration end time. + /// Source SQL Server connection + /// details. + /// Name of the source + /// database. + /// Resource Id of the Migration + /// Service. + /// ID tracking current migration + /// operation. + /// Error details in case of + /// migration failure. + public DatabaseMigrationProperties(string scope = default(string), string provisioningState = default(string), string migrationStatus = default(string), System.DateTimeOffset? startedOn = default(System.DateTimeOffset?), System.DateTimeOffset? endedOn = default(System.DateTimeOffset?), SqlConnectionInformation sourceSqlConnection = default(SqlConnectionInformation), string sourceDatabaseName = default(string), string migrationService = default(string), string migrationOperationId = default(string), ErrorInfo migrationFailureError = default(ErrorInfo)) + { + Scope = scope; + ProvisioningState = provisioningState; + MigrationStatus = migrationStatus; + StartedOn = startedOn; + EndedOn = endedOn; + SourceSqlConnection = sourceSqlConnection; + SourceDatabaseName = sourceDatabaseName; + MigrationService = migrationService; + MigrationOperationId = migrationOperationId; + MigrationFailureError = migrationFailureError; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource Id of the target resource (SQL VM or SQL + /// Managed Instance). + /// + [JsonProperty(PropertyName = "scope")] + public string Scope { get; set; } + + /// + /// Gets provisioning State of migration. ProvisioningState as + /// Succeeded implies that validations have been performed and + /// migration has started. + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets migration status. + /// + [JsonProperty(PropertyName = "migrationStatus")] + public string MigrationStatus { get; private set; } + + /// + /// Gets database migration start time. + /// + [JsonProperty(PropertyName = "startedOn")] + public System.DateTimeOffset? StartedOn { get; private set; } + + /// + /// Gets database migration end time. + /// + [JsonProperty(PropertyName = "endedOn")] + public System.DateTimeOffset? EndedOn { get; private set; } + + /// + /// Gets or sets source SQL Server connection details. + /// + [JsonProperty(PropertyName = "sourceSqlConnection")] + public SqlConnectionInformation SourceSqlConnection { get; set; } + + /// + /// Gets or sets name of the source database. + /// + [JsonProperty(PropertyName = "sourceDatabaseName")] + public string SourceDatabaseName { get; set; } + + /// + /// Gets or sets resource Id of the Migration Service. + /// + [JsonProperty(PropertyName = "migrationService")] + public string MigrationService { get; set; } + + /// + /// Gets or sets ID tracking current migration operation. + /// + [JsonProperty(PropertyName = "migrationOperationId")] + public string MigrationOperationId { get; set; } + + /// + /// Gets error details in case of migration failure. + /// + [JsonProperty(PropertyName = "migrationFailureError")] + public ErrorInfo MigrationFailureError { get; private set; } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/DatabaseMigrationPropertiesSqlMi.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/DatabaseMigrationPropertiesSqlMi.cs new file mode 100644 index 000000000000..59f0f7a5ea44 --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/DatabaseMigrationPropertiesSqlMi.cs @@ -0,0 +1,110 @@ +// +// 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.DataMigration.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Database Migration Resource properties for SQL Managed Instance. + /// + [Newtonsoft.Json.JsonObject("SqlMi")] + public partial class DatabaseMigrationPropertiesSqlMi : DatabaseMigrationProperties + { + /// + /// Initializes a new instance of the DatabaseMigrationPropertiesSqlMi + /// class. + /// + public DatabaseMigrationPropertiesSqlMi() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatabaseMigrationPropertiesSqlMi + /// class. + /// + /// Resource Id of the target resource (SQL VM or + /// SQL Managed Instance). + /// Provisioning State of migration. + /// ProvisioningState as Succeeded implies that validations have been + /// performed and migration has started. + /// Migration status. + /// Database migration start time. + /// Database migration end time. + /// Source SQL Server connection + /// details. + /// Name of the source + /// database. + /// Resource Id of the Migration + /// Service. + /// ID tracking current migration + /// operation. + /// Error details in case of + /// migration failure. + /// Detailed migration status. Not + /// included by default. + /// Database collation to be used + /// for the target database. + /// Error message for migration + /// provisioning failure, if any. + /// Backup configuration + /// info. + /// Offline configuration. + public DatabaseMigrationPropertiesSqlMi(string scope = default(string), string provisioningState = default(string), string migrationStatus = default(string), System.DateTimeOffset? startedOn = default(System.DateTimeOffset?), System.DateTimeOffset? endedOn = default(System.DateTimeOffset?), SqlConnectionInformation sourceSqlConnection = default(SqlConnectionInformation), string sourceDatabaseName = default(string), string migrationService = default(string), string migrationOperationId = default(string), ErrorInfo migrationFailureError = default(ErrorInfo), MigrationStatusDetails migrationStatusDetails = default(MigrationStatusDetails), string targetDatabaseCollation = default(string), string provisioningError = default(string), BackupConfiguration backupConfiguration = default(BackupConfiguration), OfflineConfiguration offlineConfiguration = default(OfflineConfiguration)) + : base(scope, provisioningState, migrationStatus, startedOn, endedOn, sourceSqlConnection, sourceDatabaseName, migrationService, migrationOperationId, migrationFailureError) + { + MigrationStatusDetails = migrationStatusDetails; + TargetDatabaseCollation = targetDatabaseCollation; + ProvisioningError = provisioningError; + BackupConfiguration = backupConfiguration; + OfflineConfiguration = offlineConfiguration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets detailed migration status. Not included by default. + /// + [JsonProperty(PropertyName = "migrationStatusDetails")] + public MigrationStatusDetails MigrationStatusDetails { get; private set; } + + /// + /// Gets or sets database collation to be used for the target database. + /// + [JsonProperty(PropertyName = "targetDatabaseCollation")] + public string TargetDatabaseCollation { get; set; } + + /// + /// Gets or sets error message for migration provisioning failure, if + /// any. + /// + [JsonProperty(PropertyName = "provisioningError")] + public string ProvisioningError { get; set; } + + /// + /// Gets or sets backup configuration info. + /// + [JsonProperty(PropertyName = "backupConfiguration")] + public BackupConfiguration BackupConfiguration { get; set; } + + /// + /// Gets or sets offline configuration. + /// + [JsonProperty(PropertyName = "offlineConfiguration")] + public OfflineConfiguration OfflineConfiguration { get; set; } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/DatabaseMigrationPropertiesSqlVm.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/DatabaseMigrationPropertiesSqlVm.cs new file mode 100644 index 000000000000..db40e4d564e6 --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/DatabaseMigrationPropertiesSqlVm.cs @@ -0,0 +1,110 @@ +// +// 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.DataMigration.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Database Migration Resource properties for SQL Virtual Machine. + /// + [Newtonsoft.Json.JsonObject("SqlVm")] + public partial class DatabaseMigrationPropertiesSqlVm : DatabaseMigrationProperties + { + /// + /// Initializes a new instance of the DatabaseMigrationPropertiesSqlVm + /// class. + /// + public DatabaseMigrationPropertiesSqlVm() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatabaseMigrationPropertiesSqlVm + /// class. + /// + /// Resource Id of the target resource (SQL VM or + /// SQL Managed Instance). + /// Provisioning State of migration. + /// ProvisioningState as Succeeded implies that validations have been + /// performed and migration has started. + /// Migration status. + /// Database migration start time. + /// Database migration end time. + /// Source SQL Server connection + /// details. + /// Name of the source + /// database. + /// Resource Id of the Migration + /// Service. + /// ID tracking current migration + /// operation. + /// Error details in case of + /// migration failure. + /// Detailed migration status. Not + /// included by default. + /// Database collation to be used + /// for the target database. + /// Error message for migration + /// provisioning failure, if any. + /// Backup configuration + /// info. + /// Offline configuration. + public DatabaseMigrationPropertiesSqlVm(string scope = default(string), string provisioningState = default(string), string migrationStatus = default(string), System.DateTimeOffset? startedOn = default(System.DateTimeOffset?), System.DateTimeOffset? endedOn = default(System.DateTimeOffset?), SqlConnectionInformation sourceSqlConnection = default(SqlConnectionInformation), string sourceDatabaseName = default(string), string migrationService = default(string), string migrationOperationId = default(string), ErrorInfo migrationFailureError = default(ErrorInfo), MigrationStatusDetails migrationStatusDetails = default(MigrationStatusDetails), string targetDatabaseCollation = default(string), string provisioningError = default(string), BackupConfiguration backupConfiguration = default(BackupConfiguration), OfflineConfiguration offlineConfiguration = default(OfflineConfiguration)) + : base(scope, provisioningState, migrationStatus, startedOn, endedOn, sourceSqlConnection, sourceDatabaseName, migrationService, migrationOperationId, migrationFailureError) + { + MigrationStatusDetails = migrationStatusDetails; + TargetDatabaseCollation = targetDatabaseCollation; + ProvisioningError = provisioningError; + BackupConfiguration = backupConfiguration; + OfflineConfiguration = offlineConfiguration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets detailed migration status. Not included by default. + /// + [JsonProperty(PropertyName = "migrationStatusDetails")] + public MigrationStatusDetails MigrationStatusDetails { get; private set; } + + /// + /// Gets or sets database collation to be used for the target database. + /// + [JsonProperty(PropertyName = "targetDatabaseCollation")] + public string TargetDatabaseCollation { get; set; } + + /// + /// Gets or sets error message for migration provisioning failure, if + /// any. + /// + [JsonProperty(PropertyName = "provisioningError")] + public string ProvisioningError { get; set; } + + /// + /// Gets or sets backup configuration info. + /// + [JsonProperty(PropertyName = "backupConfiguration")] + public BackupConfiguration BackupConfiguration { get; set; } + + /// + /// Gets or sets offline configuration. + /// + [JsonProperty(PropertyName = "offlineConfiguration")] + public OfflineConfiguration OfflineConfiguration { get; set; } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/DatabaseMigrationSqlMi.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/DatabaseMigrationSqlMi.cs new file mode 100644 index 000000000000..0c39e803e11c --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/DatabaseMigrationSqlMi.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataMigration.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Database Migration Resource for SQL Managed Instance. + /// + public partial class DatabaseMigrationSqlMi : IResource + { + /// + /// Initializes a new instance of the DatabaseMigrationSqlMi class. + /// + public DatabaseMigrationSqlMi() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatabaseMigrationSqlMi class. + /// + /// Metadata pertaining to creation and last + /// modification of the resource. + public DatabaseMigrationSqlMi(SystemData systemData = default(SystemData), DatabaseMigrationPropertiesSqlMi properties = default(DatabaseMigrationPropertiesSqlMi)) + { + SystemData = systemData; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets metadata pertaining to creation and last modification of the + /// resource. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "properties")] + public DatabaseMigrationPropertiesSqlMi Properties { get; set; } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/DatabaseMigrationSqlVm.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/DatabaseMigrationSqlVm.cs new file mode 100644 index 000000000000..44cc7685c7f5 --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/DatabaseMigrationSqlVm.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataMigration.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Database Migration Resource for SQL Virtual Machine. + /// + public partial class DatabaseMigrationSqlVm : IResource + { + /// + /// Initializes a new instance of the DatabaseMigrationSqlVm class. + /// + public DatabaseMigrationSqlVm() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatabaseMigrationSqlVm class. + /// + /// Metadata pertaining to creation and last + /// modification of the resource. + public DatabaseMigrationSqlVm(SystemData systemData = default(SystemData), DatabaseMigrationPropertiesSqlVm properties = default(DatabaseMigrationPropertiesSqlVm)) + { + SystemData = systemData; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets metadata pertaining to creation and last modification of the + /// resource. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "properties")] + public DatabaseMigrationPropertiesSqlVm Properties { get; set; } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/DeleteNode.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/DeleteNode.cs new file mode 100644 index 000000000000..aa96a72c7ca2 --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/DeleteNode.cs @@ -0,0 +1,60 @@ +// +// 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.DataMigration.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Details of node to be deleted. + /// + public partial class DeleteNode + { + /// + /// Initializes a new instance of the DeleteNode class. + /// + public DeleteNode() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeleteNode class. + /// + /// The name of node to delete. + /// The name of integration + /// runtime. + public DeleteNode(string nodeName = default(string), string integrationRuntimeName = default(string)) + { + NodeName = nodeName; + IntegrationRuntimeName = integrationRuntimeName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of node to delete. + /// + [JsonProperty(PropertyName = "nodeName")] + public string NodeName { get; set; } + + /// + /// Gets or sets the name of integration runtime. + /// + [JsonProperty(PropertyName = "integrationRuntimeName")] + public string IntegrationRuntimeName { get; set; } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ErrorInfo.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ErrorInfo.cs new file mode 100644 index 000000000000..b46514bc5d5c --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ErrorInfo.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataMigration.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error details + /// + public partial class ErrorInfo + { + /// + /// Initializes a new instance of the ErrorInfo class. + /// + public ErrorInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorInfo class. + /// + /// Error code. + /// Error message. + public ErrorInfo(string code = default(string), string message = default(string)) + { + Code = code; + Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/GetUserTablesSqlTaskInput.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/GetUserTablesSqlTaskInput.cs index 6e075886d5ee..695ea700883a 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/GetUserTablesSqlTaskInput.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/GetUserTablesSqlTaskInput.cs @@ -37,10 +37,13 @@ public GetUserTablesSqlTaskInput() /// Server /// List of database names to collect /// tables for - public GetUserTablesSqlTaskInput(SqlConnectionInfo connectionInfo, IList selectedDatabases) + /// encrypted key for secure + /// fields + public GetUserTablesSqlTaskInput(SqlConnectionInfo connectionInfo, IList selectedDatabases, string encryptedKeyForSecureFields = default(string)) { ConnectionInfo = connectionInfo; SelectedDatabases = selectedDatabases; + EncryptedKeyForSecureFields = encryptedKeyForSecureFields; CustomInit(); } @@ -61,6 +64,12 @@ public GetUserTablesSqlTaskInput(SqlConnectionInfo connectionInfo, IList [JsonProperty(PropertyName = "selectedDatabases")] public IList SelectedDatabases { get; set; } + /// + /// Gets or sets encrypted key for secure fields + /// + [JsonProperty(PropertyName = "encryptedKeyForSecureFields")] + public string EncryptedKeyForSecureFields { get; set; } + /// /// Validate the object. /// diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/GetUserTablesSqlTaskProperties.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/GetUserTablesSqlTaskProperties.cs index 0594d218911c..c8815ead6679 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/GetUserTablesSqlTaskProperties.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/GetUserTablesSqlTaskProperties.cs @@ -47,11 +47,13 @@ public GetUserTablesSqlTaskProperties() /// Task input /// Task output. This is ignored if /// submitted. - public GetUserTablesSqlTaskProperties(IList errors = default(IList), string state = default(string), IList commands = default(IList), IDictionary clientData = default(IDictionary), GetUserTablesSqlTaskInput input = default(GetUserTablesSqlTaskInput), IList output = default(IList)) + /// Task id + public GetUserTablesSqlTaskProperties(IList errors = default(IList), string state = default(string), IList commands = default(IList), IDictionary clientData = default(IDictionary), GetUserTablesSqlTaskInput input = default(GetUserTablesSqlTaskInput), IList output = default(IList), string taskId = default(string)) : base(errors, state, commands, clientData) { Input = input; Output = output; + TaskId = taskId; CustomInit(); } @@ -72,6 +74,12 @@ public GetUserTablesSqlTaskProperties() [JsonProperty(PropertyName = "output")] public IList Output { get; private set; } + /// + /// Gets or sets task id + /// + [JsonProperty(PropertyName = "taskId")] + public string TaskId { get; set; } + /// /// Validate the object. /// diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/IntegrationRuntimeMonitoringData.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/IntegrationRuntimeMonitoringData.cs new file mode 100644 index 000000000000..72526c033d9b --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/IntegrationRuntimeMonitoringData.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.DataMigration.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Integration Runtime Monitoring Data. + /// + public partial class IntegrationRuntimeMonitoringData + { + /// + /// Initializes a new instance of the IntegrationRuntimeMonitoringData + /// class. + /// + public IntegrationRuntimeMonitoringData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IntegrationRuntimeMonitoringData + /// class. + /// + /// The name of Integration Runtime. + /// Integration Runtime node monitoring + /// data. + public IntegrationRuntimeMonitoringData(string name = default(string), IList nodes = default(IList)) + { + Name = name; + Nodes = nodes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the name of Integration Runtime. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets integration Runtime node monitoring data. + /// + [JsonProperty(PropertyName = "nodes")] + public IList Nodes { get; private set; } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateMySqlAzureDbForMySqlOfflineTaskInput.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateMySqlAzureDbForMySqlOfflineTaskInput.cs index e22b816db4ef..5e3e67eded43 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateMySqlAzureDbForMySqlOfflineTaskInput.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateMySqlAzureDbForMySqlOfflineTaskInput.cs @@ -46,7 +46,9 @@ public MigrateMySqlAzureDbForMySqlOfflineTaskInput() /// started /// Optional parameters for fine /// tuning the data transfer rate during migration - public MigrateMySqlAzureDbForMySqlOfflineTaskInput(MySqlConnectionInfo sourceConnectionInfo, MySqlConnectionInfo targetConnectionInfo, IList selectedDatabases, bool? makeSourceServerReadOnly = default(bool?), System.DateTimeOffset? startedOn = default(System.DateTimeOffset?), IDictionary optionalAgentSettings = default(IDictionary)) + /// encrypted key for secure + /// fields + public MigrateMySqlAzureDbForMySqlOfflineTaskInput(MySqlConnectionInfo sourceConnectionInfo, MySqlConnectionInfo targetConnectionInfo, IList selectedDatabases, bool? makeSourceServerReadOnly = default(bool?), System.DateTimeOffset? startedOn = default(System.DateTimeOffset?), IDictionary optionalAgentSettings = default(IDictionary), string encryptedKeyForSecureFields = default(string)) { SourceConnectionInfo = sourceConnectionInfo; TargetConnectionInfo = targetConnectionInfo; @@ -54,6 +56,7 @@ public MigrateMySqlAzureDbForMySqlOfflineTaskInput() MakeSourceServerReadOnly = makeSourceServerReadOnly; StartedOn = startedOn; OptionalAgentSettings = optionalAgentSettings; + EncryptedKeyForSecureFields = encryptedKeyForSecureFields; CustomInit(); } @@ -100,6 +103,12 @@ public MigrateMySqlAzureDbForMySqlOfflineTaskInput() [JsonProperty(PropertyName = "optionalAgentSettings")] public IDictionary OptionalAgentSettings { get; set; } + /// + /// Gets or sets encrypted key for secure fields + /// + [JsonProperty(PropertyName = "encryptedKeyForSecureFields")] + public string EncryptedKeyForSecureFields { get; set; } + /// /// Validate the object. /// diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateMySqlAzureDbForMySqlOfflineTaskProperties.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateMySqlAzureDbForMySqlOfflineTaskProperties.cs index 0dda0f5ec440..a3f23611091c 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateMySqlAzureDbForMySqlOfflineTaskProperties.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateMySqlAzureDbForMySqlOfflineTaskProperties.cs @@ -47,11 +47,16 @@ public MigrateMySqlAzureDbForMySqlOfflineTaskProperties() /// Task input /// Task output. This is ignored if /// submitted. - public MigrateMySqlAzureDbForMySqlOfflineTaskProperties(IList errors = default(IList), string state = default(string), IList commands = default(IList), IDictionary clientData = default(IDictionary), MigrateMySqlAzureDbForMySqlOfflineTaskInput input = default(MigrateMySqlAzureDbForMySqlOfflineTaskInput), IList output = default(IList)) + /// whether the task can be cloned or + /// not + /// Task id + public MigrateMySqlAzureDbForMySqlOfflineTaskProperties(IList errors = default(IList), string state = default(string), IList commands = default(IList), IDictionary clientData = default(IDictionary), MigrateMySqlAzureDbForMySqlOfflineTaskInput input = default(MigrateMySqlAzureDbForMySqlOfflineTaskInput), IList output = default(IList), bool? isCloneable = default(bool?), string taskId = default(string)) : base(errors, state, commands, clientData) { Input = input; Output = output; + IsCloneable = isCloneable; + TaskId = taskId; CustomInit(); } @@ -72,6 +77,18 @@ public MigrateMySqlAzureDbForMySqlOfflineTaskProperties() [JsonProperty(PropertyName = "output")] public IList Output { get; private set; } + /// + /// Gets or sets whether the task can be cloned or not + /// + [JsonProperty(PropertyName = "isCloneable")] + public bool? IsCloneable { get; set; } + + /// + /// Gets or sets task id + /// + [JsonProperty(PropertyName = "taskId")] + public string TaskId { get; set; } + /// /// Validate the object. /// diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigratePostgreSqlAzureDbForPostgreSqlSyncDatabaseInput.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigratePostgreSqlAzureDbForPostgreSqlSyncDatabaseInput.cs index cae82f9c1998..fa912f7d3721 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigratePostgreSqlAzureDbForPostgreSqlSyncDatabaseInput.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigratePostgreSqlAzureDbForPostgreSqlSyncDatabaseInput.cs @@ -35,6 +35,7 @@ public MigratePostgreSqlAzureDbForPostgreSqlSyncDatabaseInput() /// MigratePostgreSqlAzureDbForPostgreSqlSyncDatabaseInput class. /// /// Name of the database + /// Result identifier /// Name of target database. Note: /// Target database will be truncated before starting /// migration. @@ -45,9 +46,10 @@ public MigratePostgreSqlAzureDbForPostgreSqlSyncDatabaseInput() /// Target settings to tune target endpoint /// migration behavior /// Tables selected for migration - public MigratePostgreSqlAzureDbForPostgreSqlSyncDatabaseInput(string name = default(string), string targetDatabaseName = default(string), IDictionary migrationSetting = default(IDictionary), IDictionary sourceSetting = default(IDictionary), IDictionary targetSetting = default(IDictionary), IList selectedTables = default(IList)) + public MigratePostgreSqlAzureDbForPostgreSqlSyncDatabaseInput(string name = default(string), string id = default(string), string targetDatabaseName = default(string), IDictionary migrationSetting = default(IDictionary), IDictionary sourceSetting = default(IDictionary), IDictionary targetSetting = default(IDictionary), IList selectedTables = default(IList)) { Name = name; + Id = id; TargetDatabaseName = targetDatabaseName; MigrationSetting = migrationSetting; SourceSetting = sourceSetting; @@ -67,6 +69,12 @@ public MigratePostgreSqlAzureDbForPostgreSqlSyncDatabaseInput() [JsonProperty(PropertyName = "name")] public string Name { get; set; } + /// + /// Gets result identifier + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + /// /// Gets or sets name of target database. Note: Target database will be /// truncated before starting migration. @@ -78,7 +86,7 @@ public MigratePostgreSqlAzureDbForPostgreSqlSyncDatabaseInput() /// Gets or sets migration settings which tune the migration behavior /// [JsonProperty(PropertyName = "migrationSetting")] - public IDictionary MigrationSetting { get; set; } + public IDictionary MigrationSetting { get; set; } /// /// Gets or sets source settings to tune source endpoint migration diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigratePostgreSqlAzureDbForPostgreSqlSyncTaskInput.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigratePostgreSqlAzureDbForPostgreSqlSyncTaskInput.cs index d0289ed27c9e..d921ce2eb5fb 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigratePostgreSqlAzureDbForPostgreSqlSyncTaskInput.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigratePostgreSqlAzureDbForPostgreSqlSyncTaskInput.cs @@ -40,11 +40,16 @@ public MigratePostgreSqlAzureDbForPostgreSqlSyncTaskInput() /// target Azure Database for PostgreSQL /// Connection information for /// source PostgreSQL - public MigratePostgreSqlAzureDbForPostgreSqlSyncTaskInput(IList selectedDatabases, PostgreSqlConnectionInfo targetConnectionInfo, PostgreSqlConnectionInfo sourceConnectionInfo) + /// encrypted key for secure + /// fields + /// Migration start time + public MigratePostgreSqlAzureDbForPostgreSqlSyncTaskInput(IList selectedDatabases, PostgreSqlConnectionInfo targetConnectionInfo, PostgreSqlConnectionInfo sourceConnectionInfo, string encryptedKeyForSecureFields = default(string), System.DateTimeOffset? startedOn = default(System.DateTimeOffset?)) { SelectedDatabases = selectedDatabases; TargetConnectionInfo = targetConnectionInfo; SourceConnectionInfo = sourceConnectionInfo; + EncryptedKeyForSecureFields = encryptedKeyForSecureFields; + StartedOn = startedOn; CustomInit(); } @@ -72,6 +77,18 @@ public MigratePostgreSqlAzureDbForPostgreSqlSyncTaskInput(IList + /// Gets or sets encrypted key for secure fields + /// + [JsonProperty(PropertyName = "encryptedKeyForSecureFields")] + public string EncryptedKeyForSecureFields { get; set; } + + /// + /// Gets migration start time + /// + [JsonProperty(PropertyName = "startedOn")] + public System.DateTimeOffset? StartedOn { get; private set; } + /// /// Validate the object. /// diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigratePostgreSqlAzureDbForPostgreSqlSyncTaskOutputError.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigratePostgreSqlAzureDbForPostgreSqlSyncTaskOutputError.cs index 19287594df4f..ad50dfb2a3f1 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigratePostgreSqlAzureDbForPostgreSqlSyncTaskOutputError.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigratePostgreSqlAzureDbForPostgreSqlSyncTaskOutputError.cs @@ -11,6 +11,8 @@ namespace Microsoft.Azure.Management.DataMigration.Models { using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; [Newtonsoft.Json.JsonObject("ErrorOutput")] @@ -31,10 +33,12 @@ public MigratePostgreSqlAzureDbForPostgreSqlSyncTaskOutputError() /// /// Result identifier /// Migration error - public MigratePostgreSqlAzureDbForPostgreSqlSyncTaskOutputError(string id = default(string), ReportableException error = default(ReportableException)) + /// List of error events + public MigratePostgreSqlAzureDbForPostgreSqlSyncTaskOutputError(string id = default(string), ReportableException error = default(ReportableException), IList events = default(IList)) : base(id) { Error = error; + Events = events; CustomInit(); } @@ -49,5 +53,11 @@ public MigratePostgreSqlAzureDbForPostgreSqlSyncTaskOutputError() [JsonProperty(PropertyName = "error")] public ReportableException Error { get; private set; } + /// + /// Gets or sets list of error events + /// + [JsonProperty(PropertyName = "events")] + public IList Events { get; set; } + } } diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigratePostgreSqlAzureDbForPostgreSqlSyncTaskOutputMigrationLevel.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigratePostgreSqlAzureDbForPostgreSqlSyncTaskOutputMigrationLevel.cs index 9aa648e99382..4fd6e8676bea 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigratePostgreSqlAzureDbForPostgreSqlSyncTaskOutputMigrationLevel.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigratePostgreSqlAzureDbForPostgreSqlSyncTaskOutputMigrationLevel.cs @@ -48,7 +48,8 @@ public MigratePostgreSqlAzureDbForPostgreSqlSyncTaskOutputMigrationLevel() /// Migration status. Possible values include: /// 'UNDEFINED', 'VALIDATING', 'PENDING', 'COMPLETE', /// 'ACTION_REQUIRED', 'FAILED' - public MigratePostgreSqlAzureDbForPostgreSqlSyncTaskOutputMigrationLevel(string id = default(string), System.DateTimeOffset? startedOn = default(System.DateTimeOffset?), System.DateTimeOffset? endedOn = default(System.DateTimeOffset?), string sourceServerVersion = default(string), string sourceServer = default(string), string targetServerVersion = default(string), string targetServer = default(string), string sourceServerType = default(string), string targetServerType = default(string), string state = default(string)) + /// Number of databases to include + public MigratePostgreSqlAzureDbForPostgreSqlSyncTaskOutputMigrationLevel(string id = default(string), System.DateTimeOffset? startedOn = default(System.DateTimeOffset?), System.DateTimeOffset? endedOn = default(System.DateTimeOffset?), string sourceServerVersion = default(string), string sourceServer = default(string), string targetServerVersion = default(string), string targetServer = default(string), string sourceServerType = default(string), string targetServerType = default(string), string state = default(string), double? databaseCount = default(double?)) : base(id) { StartedOn = startedOn; @@ -60,6 +61,7 @@ public MigratePostgreSqlAzureDbForPostgreSqlSyncTaskOutputMigrationLevel() SourceServerType = sourceServerType; TargetServerType = targetServerType; State = state; + DatabaseCount = databaseCount; CustomInit(); } @@ -127,5 +129,11 @@ public MigratePostgreSqlAzureDbForPostgreSqlSyncTaskOutputMigrationLevel() [JsonProperty(PropertyName = "state")] public string State { get; private set; } + /// + /// Gets or sets number of databases to include + /// + [JsonProperty(PropertyName = "databaseCount")] + public double? DatabaseCount { get; set; } + } } diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigratePostgreSqlAzureDbForPostgreSqlSyncTaskProperties.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigratePostgreSqlAzureDbForPostgreSqlSyncTaskProperties.cs index e1a1d666d81d..4576afab11d7 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigratePostgreSqlAzureDbForPostgreSqlSyncTaskProperties.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigratePostgreSqlAzureDbForPostgreSqlSyncTaskProperties.cs @@ -47,11 +47,19 @@ public MigratePostgreSqlAzureDbForPostgreSqlSyncTaskProperties() /// Task input /// Task output. This is ignored if /// submitted. - public MigratePostgreSqlAzureDbForPostgreSqlSyncTaskProperties(IList errors = default(IList), string state = default(string), IList commands = default(IList), IDictionary clientData = default(IDictionary), MigratePostgreSqlAzureDbForPostgreSqlSyncTaskInput input = default(MigratePostgreSqlAzureDbForPostgreSqlSyncTaskInput), IList output = default(IList)) + /// task id + /// DateTime in UTC when the task was + /// created + /// whether the task can be cloned or + /// not + public MigratePostgreSqlAzureDbForPostgreSqlSyncTaskProperties(IList errors = default(IList), string state = default(string), IList commands = default(IList), IDictionary clientData = default(IDictionary), MigratePostgreSqlAzureDbForPostgreSqlSyncTaskInput input = default(MigratePostgreSqlAzureDbForPostgreSqlSyncTaskInput), IList output = default(IList), string taskId = default(string), string createdOn = default(string), bool? isCloneable = default(bool?)) : base(errors, state, commands, clientData) { Input = input; Output = output; + TaskId = taskId; + CreatedOn = createdOn; + IsCloneable = isCloneable; CustomInit(); } @@ -72,6 +80,24 @@ public MigratePostgreSqlAzureDbForPostgreSqlSyncTaskProperties() [JsonProperty(PropertyName = "output")] public IList Output { get; private set; } + /// + /// Gets or sets task id + /// + [JsonProperty(PropertyName = "taskId")] + public string TaskId { get; set; } + + /// + /// Gets or sets dateTime in UTC when the task was created + /// + [JsonProperty(PropertyName = "createdOn")] + public string CreatedOn { get; set; } + + /// + /// Gets or sets whether the task can be cloned or not + /// + [JsonProperty(PropertyName = "isCloneable")] + public bool? IsCloneable { get; set; } + /// /// Validate the object. /// diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSchemaSqlServerSqlDbDatabaseInput.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSchemaSqlServerSqlDbDatabaseInput.cs index 575425e3c54e..97c99815bee6 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSchemaSqlServerSqlDbDatabaseInput.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSchemaSqlServerSqlDbDatabaseInput.cs @@ -33,12 +33,14 @@ public MigrateSchemaSqlServerSqlDbDatabaseInput() /// MigrateSchemaSqlServerSqlDbDatabaseInput class. /// /// Name of source database + /// Id of the source database /// Name of target database /// Database schema migration /// settings - public MigrateSchemaSqlServerSqlDbDatabaseInput(string name = default(string), string targetDatabaseName = default(string), SchemaMigrationSetting schemaSetting = default(SchemaMigrationSetting)) + public MigrateSchemaSqlServerSqlDbDatabaseInput(string name = default(string), string id = default(string), string targetDatabaseName = default(string), SchemaMigrationSetting schemaSetting = default(SchemaMigrationSetting)) { Name = name; + Id = id; TargetDatabaseName = targetDatabaseName; SchemaSetting = schemaSetting; CustomInit(); @@ -55,6 +57,12 @@ public MigrateSchemaSqlServerSqlDbDatabaseInput() [JsonProperty(PropertyName = "name")] public string Name { get; set; } + /// + /// Gets or sets id of the source database + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + /// /// Gets or sets name of target database /// diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSchemaSqlServerSqlDbTaskInput.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSchemaSqlServerSqlDbTaskInput.cs index 2ac5027177c1..77150aa68ea4 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSchemaSqlServerSqlDbTaskInput.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSchemaSqlServerSqlDbTaskInput.cs @@ -40,10 +40,15 @@ public MigrateSchemaSqlServerSqlDbTaskInput() /// Information for connecting to /// target /// Databases to migrate - public MigrateSchemaSqlServerSqlDbTaskInput(SqlConnectionInfo sourceConnectionInfo, SqlConnectionInfo targetConnectionInfo, IList selectedDatabases) + /// encrypted key for secure + /// fields + /// Migration start time + public MigrateSchemaSqlServerSqlDbTaskInput(SqlConnectionInfo sourceConnectionInfo, SqlConnectionInfo targetConnectionInfo, IList selectedDatabases, string encryptedKeyForSecureFields = default(string), string startedOn = default(string)) : base(sourceConnectionInfo, targetConnectionInfo) { SelectedDatabases = selectedDatabases; + EncryptedKeyForSecureFields = encryptedKeyForSecureFields; + StartedOn = startedOn; CustomInit(); } @@ -58,6 +63,18 @@ public MigrateSchemaSqlServerSqlDbTaskInput(SqlConnectionInfo sourceConnectionIn [JsonProperty(PropertyName = "selectedDatabases")] public IList SelectedDatabases { get; set; } + /// + /// Gets or sets encrypted key for secure fields + /// + [JsonProperty(PropertyName = "encryptedKeyForSecureFields")] + public string EncryptedKeyForSecureFields { get; set; } + + /// + /// Gets or sets migration start time + /// + [JsonProperty(PropertyName = "startedOn")] + public string StartedOn { get; set; } + /// /// Validate the object. /// diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSchemaSqlServerSqlDbTaskProperties.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSchemaSqlServerSqlDbTaskProperties.cs index 405e25aca63b..bba5da85247b 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSchemaSqlServerSqlDbTaskProperties.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSchemaSqlServerSqlDbTaskProperties.cs @@ -47,11 +47,19 @@ public MigrateSchemaSqlServerSqlDbTaskProperties() /// Task input /// Task output. This is ignored if /// submitted. - public MigrateSchemaSqlServerSqlDbTaskProperties(IList errors = default(IList), string state = default(string), IList commands = default(IList), IDictionary clientData = default(IDictionary), MigrateSchemaSqlServerSqlDbTaskInput input = default(MigrateSchemaSqlServerSqlDbTaskInput), IList output = default(IList)) + /// DateTime in UTC when the task was + /// created + /// Task id + /// whether the task can be cloned or + /// not + public MigrateSchemaSqlServerSqlDbTaskProperties(IList errors = default(IList), string state = default(string), IList commands = default(IList), IDictionary clientData = default(IDictionary), MigrateSchemaSqlServerSqlDbTaskInput input = default(MigrateSchemaSqlServerSqlDbTaskInput), IList output = default(IList), string createdOn = default(string), string taskId = default(string), bool? isCloneable = default(bool?)) : base(errors, state, commands, clientData) { Input = input; Output = output; + CreatedOn = createdOn; + TaskId = taskId; + IsCloneable = isCloneable; CustomInit(); } @@ -72,6 +80,24 @@ public MigrateSchemaSqlServerSqlDbTaskProperties() [JsonProperty(PropertyName = "output")] public IList Output { get; private set; } + /// + /// Gets or sets dateTime in UTC when the task was created + /// + [JsonProperty(PropertyName = "createdOn")] + public string CreatedOn { get; set; } + + /// + /// Gets or sets task id + /// + [JsonProperty(PropertyName = "taskId")] + public string TaskId { get; set; } + + /// + /// Gets or sets whether the task can be cloned or not + /// + [JsonProperty(PropertyName = "isCloneable")] + public bool? IsCloneable { get; set; } + /// /// Validate the object. /// diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSqlServerSqlDbDatabaseInput.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSqlServerSqlDbDatabaseInput.cs index 5d63a779f68f..431aae30f7a4 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSqlServerSqlDbDatabaseInput.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSqlServerSqlDbDatabaseInput.cs @@ -41,12 +41,17 @@ public MigrateSqlServerSqlDbDatabaseInput() /// Whether to set database read /// only before migration /// Mapping of source to target tables - public MigrateSqlServerSqlDbDatabaseInput(string name = default(string), string targetDatabaseName = default(string), bool? makeSourceDbReadOnly = default(bool?), IDictionary tableMap = default(IDictionary)) + /// Settings selected for DB schema + /// migration. + /// id of the database + public MigrateSqlServerSqlDbDatabaseInput(string name = default(string), string targetDatabaseName = default(string), bool? makeSourceDbReadOnly = default(bool?), IDictionary tableMap = default(IDictionary), object schemaSetting = default(object), string id = default(string)) { Name = name; TargetDatabaseName = targetDatabaseName; MakeSourceDbReadOnly = makeSourceDbReadOnly; TableMap = tableMap; + SchemaSetting = schemaSetting; + Id = id; CustomInit(); } @@ -80,5 +85,17 @@ public MigrateSqlServerSqlDbDatabaseInput() [JsonProperty(PropertyName = "tableMap")] public IDictionary TableMap { get; set; } + /// + /// Gets or sets settings selected for DB schema migration. + /// + [JsonProperty(PropertyName = "schemaSetting")] + public object SchemaSetting { get; set; } + + /// + /// Gets or sets id of the database + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + } } diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSqlServerSqlDbTaskInput.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSqlServerSqlDbTaskInput.cs index 3cb513b27e04..f368beb45f3e 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSqlServerSqlDbTaskInput.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSqlServerSqlDbTaskInput.cs @@ -52,11 +52,17 @@ public MigrateSqlServerSqlDbTaskInput() /// from the Query Plan Cache or Query Store and execute them and /// compares the execution time between the source and target /// database. - public MigrateSqlServerSqlDbTaskInput(SqlConnectionInfo sourceConnectionInfo, SqlConnectionInfo targetConnectionInfo, IList selectedDatabases, MigrationValidationOptions validationOptions = default(MigrationValidationOptions)) + /// Date and time relative to UTC when the + /// migration was started on + /// encrypted key for secure + /// fields + public MigrateSqlServerSqlDbTaskInput(SqlConnectionInfo sourceConnectionInfo, SqlConnectionInfo targetConnectionInfo, IList selectedDatabases, MigrationValidationOptions validationOptions = default(MigrationValidationOptions), string startedOn = default(string), string encryptedKeyForSecureFields = default(string)) : base(sourceConnectionInfo, targetConnectionInfo) { SelectedDatabases = selectedDatabases; ValidationOptions = validationOptions; + StartedOn = startedOn; + EncryptedKeyForSecureFields = encryptedKeyForSecureFields; CustomInit(); } @@ -87,6 +93,19 @@ public MigrateSqlServerSqlDbTaskInput() [JsonProperty(PropertyName = "validationOptions")] public MigrationValidationOptions ValidationOptions { get; set; } + /// + /// Gets or sets date and time relative to UTC when the migration was + /// started on + /// + [JsonProperty(PropertyName = "startedOn")] + public string StartedOn { get; set; } + + /// + /// Gets or sets encrypted key for secure fields + /// + [JsonProperty(PropertyName = "encryptedKeyForSecureFields")] + public string EncryptedKeyForSecureFields { get; set; } + /// /// Validate the object. /// diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSqlServerSqlDbTaskProperties.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSqlServerSqlDbTaskProperties.cs index ac746b10f540..f28d083bddcc 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSqlServerSqlDbTaskProperties.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSqlServerSqlDbTaskProperties.cs @@ -47,11 +47,19 @@ public MigrateSqlServerSqlDbTaskProperties() /// Task input /// Task output. This is ignored if /// submitted. - public MigrateSqlServerSqlDbTaskProperties(IList errors = default(IList), string state = default(string), IList commands = default(IList), IDictionary clientData = default(IDictionary), MigrateSqlServerSqlDbTaskInput input = default(MigrateSqlServerSqlDbTaskInput), IList output = default(IList)) + /// task id + /// whether the task can be cloned or + /// not + /// DateTime in UTC when the task was + /// created + public MigrateSqlServerSqlDbTaskProperties(IList errors = default(IList), string state = default(string), IList commands = default(IList), IDictionary clientData = default(IDictionary), MigrateSqlServerSqlDbTaskInput input = default(MigrateSqlServerSqlDbTaskInput), IList output = default(IList), string taskId = default(string), bool? isCloneable = default(bool?), string createdOn = default(string)) : base(errors, state, commands, clientData) { Input = input; Output = output; + TaskId = taskId; + IsCloneable = isCloneable; + CreatedOn = createdOn; CustomInit(); } @@ -72,6 +80,24 @@ public MigrateSqlServerSqlDbTaskProperties() [JsonProperty(PropertyName = "output")] public IList Output { get; private set; } + /// + /// Gets or sets task id + /// + [JsonProperty(PropertyName = "taskId")] + public string TaskId { get; set; } + + /// + /// Gets or sets whether the task can be cloned or not + /// + [JsonProperty(PropertyName = "isCloneable")] + public bool? IsCloneable { get; set; } + + /// + /// Gets or sets dateTime in UTC when the task was created + /// + [JsonProperty(PropertyName = "createdOn")] + public string CreatedOn { get; set; } + /// /// Validate the object. /// diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSqlServerSqlMIDatabaseInput.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSqlServerSqlMIDatabaseInput.cs index 2d432c469b90..1672e327e787 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSqlServerSqlMIDatabaseInput.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSqlServerSqlMIDatabaseInput.cs @@ -42,12 +42,14 @@ public MigrateSqlServerSqlMIDatabaseInput() /// backing up this database. /// The list of backup files to be used /// in case of existing backups. - public MigrateSqlServerSqlMIDatabaseInput(string name, string restoreDatabaseName, FileShare backupFileShare = default(FileShare), IList backupFilePaths = default(IList)) + /// id of the database + public MigrateSqlServerSqlMIDatabaseInput(string name, string restoreDatabaseName, FileShare backupFileShare = default(FileShare), IList backupFilePaths = default(IList), string id = default(string)) { Name = name; RestoreDatabaseName = restoreDatabaseName; BackupFileShare = backupFileShare; BackupFilePaths = backupFilePaths; + Id = id; CustomInit(); } @@ -82,6 +84,12 @@ public MigrateSqlServerSqlMIDatabaseInput() [JsonProperty(PropertyName = "backupFilePaths")] public IList BackupFilePaths { get; set; } + /// + /// Gets or sets id of the database + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + /// /// Validate the object. /// diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSqlServerSqlMISyncTaskInput.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSqlServerSqlMISyncTaskInput.cs index 8ac2ee4a06da..2897968e323e 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSqlServerSqlMISyncTaskInput.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSqlServerSqlMISyncTaskInput.cs @@ -10,6 +10,7 @@ namespace Microsoft.Azure.Management.DataMigration.Models { + using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; @@ -45,9 +46,12 @@ public MigrateSqlServerSqlMISyncTaskInput() /// Database Managed Instance and the Azure Storage Account /// Backup file share information for all /// selected databases. - public MigrateSqlServerSqlMISyncTaskInput(IList selectedDatabases, string storageResourceId, SqlConnectionInfo sourceConnectionInfo, MiSqlConnectionInfo targetConnectionInfo, AzureActiveDirectoryApp azureApp, FileShare backupFileShare = default(FileShare)) + /// Number of database + /// migrations to start in parallel + public MigrateSqlServerSqlMISyncTaskInput(IList selectedDatabases, string storageResourceId, SqlConnectionInfo sourceConnectionInfo, MiSqlConnectionInfo targetConnectionInfo, AzureActiveDirectoryApp azureApp, FileShare backupFileShare = default(FileShare), double? numberOfParallelDatabaseMigrations = default(double?)) : base(selectedDatabases, storageResourceId, sourceConnectionInfo, targetConnectionInfo, azureApp, backupFileShare) { + NumberOfParallelDatabaseMigrations = numberOfParallelDatabaseMigrations; CustomInit(); } @@ -56,6 +60,12 @@ public MigrateSqlServerSqlMISyncTaskInput() /// partial void CustomInit(); + /// + /// Gets or sets number of database migrations to start in parallel + /// + [JsonProperty(PropertyName = "numberOfParallelDatabaseMigrations")] + public double? NumberOfParallelDatabaseMigrations { get; set; } + /// /// Validate the object. /// diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSqlServerSqlMISyncTaskProperties.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSqlServerSqlMISyncTaskProperties.cs index 9f9a15f691cb..e9d62f772cbc 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSqlServerSqlMISyncTaskProperties.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSqlServerSqlMISyncTaskProperties.cs @@ -47,11 +47,14 @@ public MigrateSqlServerSqlMISyncTaskProperties() /// Task input /// Task output. This is ignored if /// submitted. - public MigrateSqlServerSqlMISyncTaskProperties(IList errors = default(IList), string state = default(string), IList commands = default(IList), IDictionary clientData = default(IDictionary), MigrateSqlServerSqlMISyncTaskInput input = default(MigrateSqlServerSqlMISyncTaskInput), IList output = default(IList)) + /// DateTime in UTC when the task was + /// created + public MigrateSqlServerSqlMISyncTaskProperties(IList errors = default(IList), string state = default(string), IList commands = default(IList), IDictionary clientData = default(IDictionary), MigrateSqlServerSqlMISyncTaskInput input = default(MigrateSqlServerSqlMISyncTaskInput), IList output = default(IList), string createdOn = default(string)) : base(errors, state, commands, clientData) { Input = input; Output = output; + CreatedOn = createdOn; CustomInit(); } @@ -72,5 +75,11 @@ public MigrateSqlServerSqlMISyncTaskProperties() [JsonProperty(PropertyName = "output")] public IList Output { get; private set; } + /// + /// Gets or sets dateTime in UTC when the task was created + /// + [JsonProperty(PropertyName = "createdOn")] + public string CreatedOn { get; set; } + } } diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSqlServerSqlMITaskInput.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSqlServerSqlMITaskInput.cs index f0e9fd6f2780..88e219bd78f5 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSqlServerSqlMITaskInput.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSqlServerSqlMITaskInput.cs @@ -42,6 +42,8 @@ public MigrateSqlServerSqlMITaskInput() /// Databases to migrate /// SAS URI of Azure Storage Account /// Container to be used for storing backup files. + /// Date and time relative to UTC when the + /// migration was started on /// Logins to migrate. /// Agent Jobs to migrate. /// Backup file share information for all @@ -54,16 +56,20 @@ public MigrateSqlServerSqlMITaskInput() /// the format of 'contoso.com' for federated Azure AD or /// 'contoso.onmicrosoft.com' for managed domain, required if and only /// if Windows logins are selected - public MigrateSqlServerSqlMITaskInput(SqlConnectionInfo sourceConnectionInfo, SqlConnectionInfo targetConnectionInfo, IList selectedDatabases, BlobShare backupBlobShare, IList selectedLogins = default(IList), IList selectedAgentJobs = default(IList), FileShare backupFileShare = default(FileShare), string backupMode = default(string), string aadDomainName = default(string)) + /// encrypted key for secure + /// fields + public MigrateSqlServerSqlMITaskInput(SqlConnectionInfo sourceConnectionInfo, SqlConnectionInfo targetConnectionInfo, IList selectedDatabases, BlobShare backupBlobShare, string startedOn = default(string), IList selectedLogins = default(IList), IList selectedAgentJobs = default(IList), FileShare backupFileShare = default(FileShare), string backupMode = default(string), string aadDomainName = default(string), string encryptedKeyForSecureFields = default(string)) : base(sourceConnectionInfo, targetConnectionInfo) { SelectedDatabases = selectedDatabases; + StartedOn = startedOn; SelectedLogins = selectedLogins; SelectedAgentJobs = selectedAgentJobs; BackupFileShare = backupFileShare; BackupBlobShare = backupBlobShare; BackupMode = backupMode; AadDomainName = aadDomainName; + EncryptedKeyForSecureFields = encryptedKeyForSecureFields; CustomInit(); } @@ -78,6 +84,13 @@ public MigrateSqlServerSqlMITaskInput() [JsonProperty(PropertyName = "selectedDatabases")] public IList SelectedDatabases { get; set; } + /// + /// Gets or sets date and time relative to UTC when the migration was + /// started on + /// + [JsonProperty(PropertyName = "startedOn")] + public string StartedOn { get; set; } + /// /// Gets or sets logins to migrate. /// @@ -122,6 +135,12 @@ public MigrateSqlServerSqlMITaskInput() [JsonProperty(PropertyName = "aadDomainName")] public string AadDomainName { get; set; } + /// + /// Gets or sets encrypted key for secure fields + /// + [JsonProperty(PropertyName = "encryptedKeyForSecureFields")] + public string EncryptedKeyForSecureFields { get; set; } + /// /// Validate the object. /// @@ -153,10 +172,6 @@ public override void Validate() { BackupFileShare.Validate(); } - if (BackupBlobShare != null) - { - BackupBlobShare.Validate(); - } } } } diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSqlServerSqlMITaskProperties.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSqlServerSqlMITaskProperties.cs index 1febf0763f28..9490b3467b1a 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSqlServerSqlMITaskProperties.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSqlServerSqlMITaskProperties.cs @@ -47,11 +47,21 @@ public MigrateSqlServerSqlMITaskProperties() /// Task input /// Task output. This is ignored if /// submitted. - public MigrateSqlServerSqlMITaskProperties(IList errors = default(IList), string state = default(string), IList commands = default(IList), IDictionary clientData = default(IDictionary), MigrateSqlServerSqlMITaskInput input = default(MigrateSqlServerSqlMITaskInput), IList output = default(IList)) + /// task id + /// DateTime in UTC when the task was + /// created + /// parent task id + /// whether the task can be cloned or + /// not + public MigrateSqlServerSqlMITaskProperties(IList errors = default(IList), string state = default(string), IList commands = default(IList), IDictionary clientData = default(IDictionary), MigrateSqlServerSqlMITaskInput input = default(MigrateSqlServerSqlMITaskInput), IList output = default(IList), string taskId = default(string), string createdOn = default(string), string parentTaskId = default(string), bool? isCloneable = default(bool?)) : base(errors, state, commands, clientData) { Input = input; Output = output; + TaskId = taskId; + CreatedOn = createdOn; + ParentTaskId = parentTaskId; + IsCloneable = isCloneable; CustomInit(); } @@ -72,6 +82,30 @@ public MigrateSqlServerSqlMITaskProperties() [JsonProperty(PropertyName = "output")] public IList Output { get; private set; } + /// + /// Gets or sets task id + /// + [JsonProperty(PropertyName = "taskId")] + public string TaskId { get; set; } + + /// + /// Gets or sets dateTime in UTC when the task was created + /// + [JsonProperty(PropertyName = "createdOn")] + public string CreatedOn { get; set; } + + /// + /// Gets or sets parent task id + /// + [JsonProperty(PropertyName = "parentTaskId")] + public string ParentTaskId { get; set; } + + /// + /// Gets or sets whether the task can be cloned or not + /// + [JsonProperty(PropertyName = "isCloneable")] + public bool? IsCloneable { get; set; } + /// /// Validate the object. /// diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSyncCompleteCommandProperties.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSyncCompleteCommandProperties.cs index 4778665184bd..c260b99d0821 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSyncCompleteCommandProperties.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrateSyncCompleteCommandProperties.cs @@ -43,11 +43,13 @@ public MigrateSyncCompleteCommandProperties() /// Command input /// Command output. This is ignored if /// submitted. - public MigrateSyncCompleteCommandProperties(IList errors = default(IList), string state = default(string), MigrateSyncCompleteCommandInput input = default(MigrateSyncCompleteCommandInput), MigrateSyncCompleteCommandOutput output = default(MigrateSyncCompleteCommandOutput)) + /// Command id + public MigrateSyncCompleteCommandProperties(IList errors = default(IList), string state = default(string), MigrateSyncCompleteCommandInput input = default(MigrateSyncCompleteCommandInput), MigrateSyncCompleteCommandOutput output = default(MigrateSyncCompleteCommandOutput), string commandId = default(string)) : base(errors, state) { Input = input; Output = output; + CommandId = commandId; CustomInit(); } @@ -68,6 +70,12 @@ public MigrateSyncCompleteCommandProperties() [JsonProperty(PropertyName = "output")] public MigrateSyncCompleteCommandOutput Output { get; private set; } + /// + /// Gets or sets command id + /// + [JsonProperty(PropertyName = "commandId")] + public string CommandId { get; set; } + /// /// Validate the object. /// diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrationOperationInput.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrationOperationInput.cs new file mode 100644 index 000000000000..bb61455e54b7 --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrationOperationInput.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.DataMigration.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Migration Operation Input + /// + public partial class MigrationOperationInput + { + /// + /// Initializes a new instance of the MigrationOperationInput class. + /// + public MigrationOperationInput() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MigrationOperationInput class. + /// + /// ID tracking migration + /// operation. + public MigrationOperationInput(System.Guid? migrationOperationId = default(System.Guid?)) + { + MigrationOperationId = migrationOperationId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets ID tracking migration operation. + /// + [JsonProperty(PropertyName = "migrationOperationId")] + public System.Guid? MigrationOperationId { get; set; } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrationStatusDetails.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrationStatusDetails.cs new file mode 100644 index 000000000000..74f92a53bea2 --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MigrationStatusDetails.cs @@ -0,0 +1,159 @@ +// +// 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.DataMigration.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Detailed status of current migration. + /// + public partial class MigrationStatusDetails + { + /// + /// Initializes a new instance of the MigrationStatusDetails class. + /// + public MigrationStatusDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MigrationStatusDetails class. + /// + /// Current State of Migration. + /// Details of full backup set. + /// Last applied backup set + /// information. + /// Backup sets that are currently + /// active. + /// Files that are not valid backup + /// files. + /// Name of blob container. + /// Whether full backup has been + /// applied to the target database or not. + /// Restore blocking reason, if + /// any + /// Complete restore error + /// message, if any + /// File upload blocking errors, + /// if any. + /// File name that is currently + /// being restored. + /// Last restored file name. + /// Total pending log + /// backups. + public MigrationStatusDetails(string migrationState = default(string), SqlBackupSetInfo fullBackupSetInfo = default(SqlBackupSetInfo), SqlBackupSetInfo lastRestoredBackupSetInfo = default(SqlBackupSetInfo), IList activeBackupSets = default(IList), IList invalidFiles = default(IList), string blobContainerName = default(string), bool? isFullBackupRestored = default(bool?), string restoreBlockingReason = default(string), string completeRestoreErrorMessage = default(string), IList fileUploadBlockingErrors = default(IList), string currentRestoringFilename = default(string), string lastRestoredFilename = default(string), int? pendingLogBackupsCount = default(int?)) + { + MigrationState = migrationState; + FullBackupSetInfo = fullBackupSetInfo; + LastRestoredBackupSetInfo = lastRestoredBackupSetInfo; + ActiveBackupSets = activeBackupSets; + InvalidFiles = invalidFiles; + BlobContainerName = blobContainerName; + IsFullBackupRestored = isFullBackupRestored; + RestoreBlockingReason = restoreBlockingReason; + CompleteRestoreErrorMessage = completeRestoreErrorMessage; + FileUploadBlockingErrors = fileUploadBlockingErrors; + CurrentRestoringFilename = currentRestoringFilename; + LastRestoredFilename = lastRestoredFilename; + PendingLogBackupsCount = pendingLogBackupsCount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets current State of Migration. + /// + [JsonProperty(PropertyName = "migrationState")] + public string MigrationState { get; private set; } + + /// + /// Gets details of full backup set. + /// + [JsonProperty(PropertyName = "fullBackupSetInfo")] + public SqlBackupSetInfo FullBackupSetInfo { get; private set; } + + /// + /// Gets last applied backup set information. + /// + [JsonProperty(PropertyName = "lastRestoredBackupSetInfo")] + public SqlBackupSetInfo LastRestoredBackupSetInfo { get; private set; } + + /// + /// Gets backup sets that are currently active. + /// + [JsonProperty(PropertyName = "activeBackupSets")] + public IList ActiveBackupSets { get; private set; } + + /// + /// Gets files that are not valid backup files. + /// + [JsonProperty(PropertyName = "invalidFiles")] + public IList InvalidFiles { get; private set; } + + /// + /// Gets name of blob container. + /// + [JsonProperty(PropertyName = "blobContainerName")] + public string BlobContainerName { get; private set; } + + /// + /// Gets whether full backup has been applied to the target database or + /// not. + /// + [JsonProperty(PropertyName = "isFullBackupRestored")] + public bool? IsFullBackupRestored { get; private set; } + + /// + /// Gets restore blocking reason, if any + /// + [JsonProperty(PropertyName = "restoreBlockingReason")] + public string RestoreBlockingReason { get; private set; } + + /// + /// Gets complete restore error message, if any + /// + [JsonProperty(PropertyName = "completeRestoreErrorMessage")] + public string CompleteRestoreErrorMessage { get; private set; } + + /// + /// Gets file upload blocking errors, if any. + /// + [JsonProperty(PropertyName = "fileUploadBlockingErrors")] + public IList FileUploadBlockingErrors { get; private set; } + + /// + /// Gets file name that is currently being restored. + /// + [JsonProperty(PropertyName = "currentRestoringFilename")] + public string CurrentRestoringFilename { get; private set; } + + /// + /// Gets last restored file name. + /// + [JsonProperty(PropertyName = "lastRestoredFilename")] + public string LastRestoredFilename { get; private set; } + + /// + /// Gets total pending log backups. + /// + [JsonProperty(PropertyName = "pendingLogBackupsCount")] + public int? PendingLogBackupsCount { get; private set; } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MongoDbConnectionInfo.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MongoDbConnectionInfo.cs index c580f25f16b6..971d0b94c7c5 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MongoDbConnectionInfo.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MongoDbConnectionInfo.cs @@ -35,10 +35,28 @@ public MongoDbConnectionInfo() /// in the userName and password properties /// User name /// Password credential. - public MongoDbConnectionInfo(string connectionString, string userName = default(string), string password = default(string)) + /// Data source + /// Whether to encrypt the + /// connection + /// server brand version + /// server version + /// Whether to trust the server + /// certificate + /// port for server + /// Additional connection + /// settings + public MongoDbConnectionInfo(string connectionString, string userName = default(string), string password = default(string), string dataSource = default(string), bool? encryptConnection = default(bool?), string serverBrandVersion = default(string), string serverVersion = default(string), bool? trustServerCertificate = default(bool?), bool? enforceSSL = default(bool?), int? port = default(int?), string additionalSettings = default(string)) : base(userName, password) { ConnectionString = connectionString; + DataSource = dataSource; + EncryptConnection = encryptConnection; + ServerBrandVersion = serverBrandVersion; + ServerVersion = serverVersion; + TrustServerCertificate = trustServerCertificate; + EnforceSSL = enforceSSL; + Port = port; + AdditionalSettings = additionalSettings; CustomInit(); } @@ -55,6 +73,53 @@ public MongoDbConnectionInfo() [JsonProperty(PropertyName = "connectionString")] public string ConnectionString { get; set; } + /// + /// Gets or sets data source + /// + [JsonProperty(PropertyName = "dataSource")] + public string DataSource { get; set; } + + /// + /// Gets or sets whether to encrypt the connection + /// + [JsonProperty(PropertyName = "encryptConnection")] + public bool? EncryptConnection { get; set; } + + /// + /// Gets or sets server brand version + /// + [JsonProperty(PropertyName = "serverBrandVersion")] + public string ServerBrandVersion { get; set; } + + /// + /// Gets or sets server version + /// + [JsonProperty(PropertyName = "serverVersion")] + public string ServerVersion { get; set; } + + /// + /// Gets or sets whether to trust the server certificate + /// + [JsonProperty(PropertyName = "trustServerCertificate")] + public bool? TrustServerCertificate { get; set; } + + /// + /// + [JsonProperty(PropertyName = "enforceSSL")] + public bool? EnforceSSL { get; set; } + + /// + /// Gets or sets port for server + /// + [JsonProperty(PropertyName = "port")] + public int? Port { get; set; } + + /// + /// Gets or sets additional connection settings + /// + [JsonProperty(PropertyName = "additionalSettings")] + public string AdditionalSettings { get; set; } + /// /// Validate the object. /// diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MongoDbShardKeySetting.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MongoDbShardKeySetting.cs index 9242279c12de..72ac36a1347f 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MongoDbShardKeySetting.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MongoDbShardKeySetting.cs @@ -34,7 +34,7 @@ public MongoDbShardKeySetting() /// /// The fields within the shard key /// Whether the shard key is unique - public MongoDbShardKeySetting(IList fields, bool isUnique) + public MongoDbShardKeySetting(IList fields, bool? isUnique = default(bool?)) { Fields = fields; IsUnique = isUnique; @@ -56,7 +56,7 @@ public MongoDbShardKeySetting(IList fields, bool isUnique) /// Gets or sets whether the shard key is unique /// [JsonProperty(PropertyName = "isUnique")] - public bool IsUnique { get; set; } + public bool? IsUnique { get; set; } /// /// Validate the object. diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MySqlConnectionInfo.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MySqlConnectionInfo.cs index f08a545ebfc3..167230312287 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MySqlConnectionInfo.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/MySqlConnectionInfo.cs @@ -34,14 +34,21 @@ public MySqlConnectionInfo() /// Port for Server /// User name /// Password credential. + /// Data source /// Whether to encrypt the /// connection - public MySqlConnectionInfo(string serverName, int port, string userName = default(string), string password = default(string), bool? encryptConnection = default(bool?)) + /// Authentication type to use for + /// connection. Possible values include: 'None', + /// 'WindowsAuthentication', 'SqlAuthentication', + /// 'ActiveDirectoryIntegrated', 'ActiveDirectoryPassword' + public MySqlConnectionInfo(string serverName, int port, string userName = default(string), string password = default(string), string dataSource = default(string), bool? encryptConnection = default(bool?), string authentication = default(string)) : base(userName, password) { ServerName = serverName; + DataSource = dataSource; Port = port; EncryptConnection = encryptConnection; + Authentication = authentication; CustomInit(); } @@ -56,6 +63,12 @@ public MySqlConnectionInfo() [JsonProperty(PropertyName = "serverName")] public string ServerName { get; set; } + /// + /// Gets or sets data source + /// + [JsonProperty(PropertyName = "dataSource")] + public string DataSource { get; set; } + /// /// Gets or sets port for Server /// @@ -68,6 +81,15 @@ public MySqlConnectionInfo() [JsonProperty(PropertyName = "encryptConnection")] public bool? EncryptConnection { get; set; } + /// + /// Gets or sets authentication type to use for connection. Possible + /// values include: 'None', 'WindowsAuthentication', + /// 'SqlAuthentication', 'ActiveDirectoryIntegrated', + /// 'ActiveDirectoryPassword' + /// + [JsonProperty(PropertyName = "authentication")] + public string Authentication { get; set; } + /// /// Validate the object. /// diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/NodeMonitoringData.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/NodeMonitoringData.cs new file mode 100644 index 000000000000..91e42ab2dc9c --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/NodeMonitoringData.cs @@ -0,0 +1,125 @@ +// +// 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.DataMigration.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class NodeMonitoringData + { + /// + /// Initializes a new instance of the NodeMonitoringData class. + /// + public NodeMonitoringData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NodeMonitoringData class. + /// + /// Unmatched properties from the + /// message are deserialized in this collection. + /// Name of the integration runtime + /// node. + /// Available memory (MB) on the + /// integration runtime node. + /// CPU percentage on the integration + /// runtime node. + /// Maximum concurrent jobs on the + /// integration runtime node. + /// The number of jobs currently + /// running on the integration runtime node. + /// The maximum concurrent jobs in this + /// integration runtime. + /// Sent bytes on the integration runtime + /// node. + /// Received bytes on the integration + /// runtime node. + public NodeMonitoringData(IDictionary additionalProperties = default(IDictionary), string nodeName = default(string), int? availableMemoryInMB = default(int?), int? cpuUtilization = default(int?), int? concurrentJobsLimit = default(int?), int? concurrentJobsRunning = default(int?), int? maxConcurrentJobs = default(int?), double? sentBytes = default(double?), double? receivedBytes = default(double?)) + { + AdditionalProperties = additionalProperties; + NodeName = nodeName; + AvailableMemoryInMB = availableMemoryInMB; + CpuUtilization = cpuUtilization; + ConcurrentJobsLimit = concurrentJobsLimit; + ConcurrentJobsRunning = concurrentJobsRunning; + MaxConcurrentJobs = maxConcurrentJobs; + SentBytes = sentBytes; + ReceivedBytes = receivedBytes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets Unmatched properties from the message are deserialized in + /// this collection. + /// + [JsonProperty(PropertyName = "additionalProperties")] + public IDictionary AdditionalProperties { get; private set; } + + /// + /// Gets name of the integration runtime node. + /// + [JsonProperty(PropertyName = "nodeName")] + public string NodeName { get; private set; } + + /// + /// Gets available memory (MB) on the integration runtime node. + /// + [JsonProperty(PropertyName = "availableMemoryInMB")] + public int? AvailableMemoryInMB { get; private set; } + + /// + /// Gets CPU percentage on the integration runtime node. + /// + [JsonProperty(PropertyName = "cpuUtilization")] + public int? CpuUtilization { get; private set; } + + /// + /// Gets maximum concurrent jobs on the integration runtime node. + /// + [JsonProperty(PropertyName = "concurrentJobsLimit")] + public int? ConcurrentJobsLimit { get; private set; } + + /// + /// Gets the number of jobs currently running on the integration + /// runtime node. + /// + [JsonProperty(PropertyName = "concurrentJobsRunning")] + public int? ConcurrentJobsRunning { get; private set; } + + /// + /// Gets the maximum concurrent jobs in this integration runtime. + /// + [JsonProperty(PropertyName = "maxConcurrentJobs")] + public int? MaxConcurrentJobs { get; private set; } + + /// + /// Gets sent bytes on the integration runtime node. + /// + [JsonProperty(PropertyName = "sentBytes")] + public double? SentBytes { get; private set; } + + /// + /// Gets received bytes on the integration runtime node. + /// + [JsonProperty(PropertyName = "receivedBytes")] + public double? ReceivedBytes { get; private set; } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/OfflineConfiguration.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/OfflineConfiguration.cs new file mode 100644 index 000000000000..1bd7e1c45eda --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/OfflineConfiguration.cs @@ -0,0 +1,66 @@ +// +// 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.DataMigration.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Offline configuration + /// + public partial class OfflineConfiguration + { + /// + /// Initializes a new instance of the OfflineConfiguration class. + /// + public OfflineConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OfflineConfiguration class. + /// + /// Offline migration + /// Last backup name for offline + /// migration. This is optional for migrations from file share. If it + /// is not provided, then the service will determine the last backup + /// file name based on latest backup files present in file + /// share. + public OfflineConfiguration(bool? offline = default(bool?), string lastBackupName = default(string)) + { + Offline = offline; + LastBackupName = lastBackupName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets offline migration + /// + [JsonProperty(PropertyName = "offline")] + public bool? Offline { get; set; } + + /// + /// Gets or sets last backup name for offline migration. This is + /// optional for migrations from file share. If it is not provided, + /// then the service will determine the last backup file name based on + /// latest backup files present in file share. + /// + [JsonProperty(PropertyName = "lastBackupName")] + public string LastBackupName { get; set; } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/OperationOrigin.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/OperationOrigin.cs new file mode 100644 index 000000000000..2e7b8a246fb8 --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/OperationOrigin.cs @@ -0,0 +1,22 @@ +// +// 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.DataMigration.Models +{ + + /// + /// Defines values for OperationOrigin. + /// + public static class OperationOrigin + { + public const string User = "user"; + public const string System = "system"; + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/OperationsDefinition.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/OperationsDefinition.cs new file mode 100644 index 000000000000..4786b3a9e4ae --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/OperationsDefinition.cs @@ -0,0 +1,78 @@ +// +// 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.DataMigration.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class OperationsDefinition + { + /// + /// Initializes a new instance of the OperationsDefinition class. + /// + public OperationsDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationsDefinition class. + /// + /// Indicates whether the operation is a + /// data action + /// Possible values include: 'user', + /// 'system' + public OperationsDefinition(string name = default(string), bool? isDataAction = default(bool?), OperationsDisplayDefinition display = default(OperationsDisplayDefinition), string origin = default(string), IDictionary properties = default(IDictionary)) + { + Name = name; + IsDataAction = isDataAction; + Display = display; + Origin = origin; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets or sets indicates whether the operation is a data action + /// + [JsonProperty(PropertyName = "isDataAction")] + public bool? IsDataAction { get; set; } + + /// + /// + [JsonProperty(PropertyName = "display")] + public OperationsDisplayDefinition Display { get; private set; } + + /// + /// Gets possible values include: 'user', 'system' + /// + [JsonProperty(PropertyName = "origin")] + public string Origin { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "properties")] + public IDictionary Properties { get; private set; } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/OperationsDisplayDefinition.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/OperationsDisplayDefinition.cs new file mode 100644 index 000000000000..73fc82324a3d --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/OperationsDisplayDefinition.cs @@ -0,0 +1,66 @@ +// +// 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.DataMigration.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class OperationsDisplayDefinition + { + /// + /// Initializes a new instance of the OperationsDisplayDefinition + /// class. + /// + public OperationsDisplayDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationsDisplayDefinition + /// class. + /// + public OperationsDisplayDefinition(string provider = default(string), string resource = default(string), string operation = default(string), string description = default(string)) + { + Provider = provider; + Resource = resource; + Operation = operation; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; private set; } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/PostgreSqlConnectionInfo.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/PostgreSqlConnectionInfo.cs index 46c1c16451d9..4639c7ad8d30 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/PostgreSqlConnectionInfo.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/PostgreSqlConnectionInfo.cs @@ -34,19 +34,33 @@ public PostgreSqlConnectionInfo() /// Port for Server /// User name /// Password credential. + /// Data source + /// server version /// Name of the database /// Whether to encrypt the /// connection /// Whether to trust the server /// certificate - public PostgreSqlConnectionInfo(string serverName, int port, string userName = default(string), string password = default(string), string databaseName = default(string), bool? encryptConnection = default(bool?), bool? trustServerCertificate = default(bool?)) + /// Additional connection + /// settings + /// server brand version + /// Authentication type to use for + /// connection. Possible values include: 'None', + /// 'WindowsAuthentication', 'SqlAuthentication', + /// 'ActiveDirectoryIntegrated', 'ActiveDirectoryPassword' + public PostgreSqlConnectionInfo(string serverName, int port, string userName = default(string), string password = default(string), string dataSource = default(string), string serverVersion = default(string), string databaseName = default(string), bool? encryptConnection = default(bool?), bool? trustServerCertificate = default(bool?), string additionalSettings = default(string), string serverBrandVersion = default(string), string authentication = default(string)) : base(userName, password) { ServerName = serverName; + DataSource = dataSource; + ServerVersion = serverVersion; DatabaseName = databaseName; Port = port; EncryptConnection = encryptConnection; TrustServerCertificate = trustServerCertificate; + AdditionalSettings = additionalSettings; + ServerBrandVersion = serverBrandVersion; + Authentication = authentication; CustomInit(); } @@ -61,6 +75,18 @@ public PostgreSqlConnectionInfo() [JsonProperty(PropertyName = "serverName")] public string ServerName { get; set; } + /// + /// Gets or sets data source + /// + [JsonProperty(PropertyName = "dataSource")] + public string DataSource { get; set; } + + /// + /// Gets or sets server version + /// + [JsonProperty(PropertyName = "serverVersion")] + public string ServerVersion { get; set; } + /// /// Gets or sets name of the database /// @@ -85,6 +111,27 @@ public PostgreSqlConnectionInfo() [JsonProperty(PropertyName = "trustServerCertificate")] public bool? TrustServerCertificate { get; set; } + /// + /// Gets or sets additional connection settings + /// + [JsonProperty(PropertyName = "additionalSettings")] + public string AdditionalSettings { get; set; } + + /// + /// Gets or sets server brand version + /// + [JsonProperty(PropertyName = "serverBrandVersion")] + public string ServerBrandVersion { get; set; } + + /// + /// Gets or sets authentication type to use for connection. Possible + /// values include: 'None', 'WindowsAuthentication', + /// 'SqlAuthentication', 'ActiveDirectoryIntegrated', + /// 'ActiveDirectoryPassword' + /// + [JsonProperty(PropertyName = "authentication")] + public string Authentication { get; set; } + /// /// Validate the object. /// diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/Project.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/Project.cs index 84455bac85c1..63c4fa70544e 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/Project.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/Project.cs @@ -34,19 +34,15 @@ public Project() /// /// Initializes a new instance of the Project class. /// - /// Resource location. /// Source platform for the project. /// Possible values include: 'SQL', 'MySQL', 'PostgreSql', 'MongoDb', /// 'Unknown' /// Target platform for the project. /// Possible values include: 'SQLDB', 'SQLMI', 'AzureDbForMySql', /// 'AzureDbForPostgreSql', 'MongoDb', 'Unknown' - /// Resource ID. - /// Resource name. - /// Resource type. - /// Resource tags. - /// Metadata pertaining to creation and last - /// modification of the resource. + /// Field that defines the Azure + /// active directory application info, used to connect to the target + /// Azure resource /// UTC Date and time when project was /// created /// Information for connecting to @@ -56,16 +52,20 @@ public Project() /// List of DatabaseInfo /// The project's provisioning state. /// Possible values include: 'Deleting', 'Succeeded' - public Project(string location, string sourcePlatform, string targetPlatform, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), SystemData systemData = default(SystemData), System.DateTimeOffset? creationTime = default(System.DateTimeOffset?), ConnectionInfo sourceConnectionInfo = default(ConnectionInfo), ConnectionInfo targetConnectionInfo = default(ConnectionInfo), IList databasesInfo = default(IList), string provisioningState = default(string)) - : base(location, id, name, type, tags, systemData) + /// HTTP strong entity tag value. This is ignored if + /// submitted. + public Project(string sourcePlatform, string targetPlatform, string location = default(string), IDictionary tags = default(IDictionary), string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), AzureActiveDirectoryApp azureAuthenticationInfo = default(AzureActiveDirectoryApp), System.DateTimeOffset? creationTime = default(System.DateTimeOffset?), ConnectionInfo sourceConnectionInfo = default(ConnectionInfo), ConnectionInfo targetConnectionInfo = default(ConnectionInfo), IList databasesInfo = default(IList), string provisioningState = default(string), string etag = default(string)) + : base(location, tags, id, name, type, systemData) { SourcePlatform = sourcePlatform; + AzureAuthenticationInfo = azureAuthenticationInfo; TargetPlatform = targetPlatform; CreationTime = creationTime; SourceConnectionInfo = sourceConnectionInfo; TargetConnectionInfo = targetConnectionInfo; DatabasesInfo = databasesInfo; ProvisioningState = provisioningState; + Etag = etag; CustomInit(); } @@ -81,6 +81,13 @@ public Project() [JsonProperty(PropertyName = "properties.sourcePlatform")] public string SourcePlatform { get; set; } + /// + /// Gets or sets field that defines the Azure active directory + /// application info, used to connect to the target Azure resource + /// + [JsonProperty(PropertyName = "properties.azureAuthenticationInfo")] + public AzureActiveDirectoryApp AzureAuthenticationInfo { get; set; } + /// /// Gets or sets target platform for the project. Possible values /// include: 'SQLDB', 'SQLMI', 'AzureDbForMySql', @@ -120,15 +127,21 @@ public Project() [JsonProperty(PropertyName = "properties.provisioningState")] public string ProvisioningState { get; private set; } + /// + /// Gets or sets HTTP strong entity tag value. This is ignored if + /// submitted. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; set; } + /// /// Validate the object. /// /// /// Thrown if validation fails /// - public override void Validate() + public virtual void Validate() { - base.Validate(); if (SourcePlatform == null) { throw new ValidationException(ValidationRules.CannotBeNull, "SourcePlatform"); @@ -137,6 +150,10 @@ public override void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "TargetPlatform"); } + if (AzureAuthenticationInfo != null) + { + AzureAuthenticationInfo.Validate(); + } if (DatabasesInfo != null) { foreach (var element in DatabasesInfo) diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ProxyResource.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ProxyResource.cs new file mode 100644 index 000000000000..d435a944d6c7 --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ProxyResource.cs @@ -0,0 +1,58 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// 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.DataMigration.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class ProxyResource + { + /// + /// Initializes a new instance of the ProxyResource class. + /// + public ProxyResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProxyResource class. + /// + public ProxyResource(string id = default(string), string name = default(string), string type = default(string)) + { + Id = id; + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/RegenAuthKeys.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/RegenAuthKeys.cs new file mode 100644 index 000000000000..20348bdcffef --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/RegenAuthKeys.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataMigration.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An authentication key to regenerate. + /// + public partial class RegenAuthKeys + { + /// + /// Initializes a new instance of the RegenAuthKeys class. + /// + public RegenAuthKeys() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RegenAuthKeys class. + /// + /// The name of authentication key to + /// generate. + /// The first authentication key. + /// The second authentication key. + public RegenAuthKeys(string keyName = default(string), string authKey1 = default(string), string authKey2 = default(string)) + { + KeyName = keyName; + AuthKey1 = authKey1; + AuthKey2 = authKey2; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of authentication key to generate. + /// + [JsonProperty(PropertyName = "keyName")] + public string KeyName { get; set; } + + /// + /// Gets or sets the first authentication key. + /// + [JsonProperty(PropertyName = "authKey1")] + public string AuthKey1 { get; set; } + + /// + /// Gets or sets the second authentication key. + /// + [JsonProperty(PropertyName = "authKey2")] + public string AuthKey2 { get; set; } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SchemaMigrationSetting.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SchemaMigrationSetting.cs index 92af0c35e725..96b3e5fef23c 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SchemaMigrationSetting.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SchemaMigrationSetting.cs @@ -34,10 +34,13 @@ public SchemaMigrationSetting() /// 'UseStorageFile' /// Resource Identifier of a file resource /// containing the uploaded schema file - public SchemaMigrationSetting(string schemaOption = default(string), string fileId = default(string)) + /// Name of the file resource containing the + /// uploaded schema file + public SchemaMigrationSetting(string schemaOption = default(string), string fileId = default(string), string fileName = default(string)) { SchemaOption = schemaOption; FileId = fileId; + FileName = fileName; CustomInit(); } @@ -60,5 +63,12 @@ public SchemaMigrationSetting() [JsonProperty(PropertyName = "fileId")] public string FileId { get; set; } + /// + /// Gets or sets name of the file resource containing the uploaded + /// schema file + /// + [JsonProperty(PropertyName = "fileName")] + public string FileName { get; set; } + } } diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ServerLevelPermissionsGroup.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ServerLevelPermissionsGroup.cs index fb73b6aa1476..8fa437b3cf15 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ServerLevelPermissionsGroup.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ServerLevelPermissionsGroup.cs @@ -28,7 +28,9 @@ public enum ServerLevelPermissionsGroup [EnumMember(Value = "MigrationFromSqlServerToAzureMI")] MigrationFromSqlServerToAzureMI, [EnumMember(Value = "MigrationFromMySQLToAzureDBForMySQL")] - MigrationFromMySQLToAzureDBForMySQL + MigrationFromMySQLToAzureDBForMySQL, + [EnumMember(Value = "MigrationFromSqlServerToAzureVM")] + MigrationFromSqlServerToAzureVM } internal static class ServerLevelPermissionsGroupEnumExtension { @@ -49,6 +51,8 @@ internal static string ToSerializedValue(this ServerLevelPermissionsGroup value) return "MigrationFromSqlServerToAzureMI"; case ServerLevelPermissionsGroup.MigrationFromMySQLToAzureDBForMySQL: return "MigrationFromMySQLToAzureDBForMySQL"; + case ServerLevelPermissionsGroup.MigrationFromSqlServerToAzureVM: + return "MigrationFromSqlServerToAzureVM"; } return null; } @@ -65,6 +69,8 @@ internal static string ToSerializedValue(this ServerLevelPermissionsGroup value) return ServerLevelPermissionsGroup.MigrationFromSqlServerToAzureMI; case "MigrationFromMySQLToAzureDBForMySQL": return ServerLevelPermissionsGroup.MigrationFromMySQLToAzureDBForMySQL; + case "MigrationFromSqlServerToAzureVM": + return ServerLevelPermissionsGroup.MigrationFromSqlServerToAzureVM; } return null; } diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ServiceOperationList.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ServiceOperationList.cs new file mode 100644 index 000000000000..70ee46f6fa55 --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ServiceOperationList.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataMigration.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// OData page of action (operation) objects + /// + public partial class ServiceOperationList + { + /// + /// Initializes a new instance of the ServiceOperationList class. + /// + public ServiceOperationList() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceOperationList class. + /// + /// List of actions + /// URL to load the next page of actions + public ServiceOperationList(IList value = default(IList), string nextLink = default(string)) + { + Value = value; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of actions + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + /// + /// Gets or sets URL to load the next page of actions + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; set; } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SourceLocation.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SourceLocation.cs new file mode 100644 index 000000000000..4eb69834a331 --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SourceLocation.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataMigration.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Source Location details of backups. + /// + public partial class SourceLocation + { + /// + /// Initializes a new instance of the SourceLocation class. + /// + public SourceLocation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SourceLocation class. + /// + /// Source File share. + /// Source Azure Blob. + public SourceLocation(SqlFileShare fileShare = default(SqlFileShare), AzureBlob azureBlob = default(AzureBlob)) + { + FileShare = fileShare; + AzureBlob = azureBlob; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets source File share. + /// + [JsonProperty(PropertyName = "fileShare")] + public SqlFileShare FileShare { get; set; } + + /// + /// Gets or sets source Azure Blob. + /// + [JsonProperty(PropertyName = "azureBlob")] + public AzureBlob AzureBlob { get; set; } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SqlBackupFileInfo.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SqlBackupFileInfo.cs new file mode 100644 index 000000000000..58a362d8049f --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SqlBackupFileInfo.cs @@ -0,0 +1,110 @@ +// +// 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.DataMigration.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Information of backup file + /// + public partial class SqlBackupFileInfo + { + /// + /// Initializes a new instance of the SqlBackupFileInfo class. + /// + public SqlBackupFileInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlBackupFileInfo class. + /// + /// File name. + /// Status of the file. (Initial, Uploading, + /// Uploaded, Restoring, Restored or Skipped) + /// File size in bytes + /// Bytes read + /// Bytes written + /// Copy throughput in KBps + /// Copy Duration in seconds + /// Media family sequence + /// number + public SqlBackupFileInfo(string fileName = default(string), string status = default(string), long? totalSize = default(long?), long? dataRead = default(long?), long? dataWritten = default(long?), double? copyThroughput = default(double?), int? copyDuration = default(int?), int? familySequenceNumber = default(int?)) + { + FileName = fileName; + Status = status; + TotalSize = totalSize; + DataRead = dataRead; + DataWritten = dataWritten; + CopyThroughput = copyThroughput; + CopyDuration = copyDuration; + FamilySequenceNumber = familySequenceNumber; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets file name. + /// + [JsonProperty(PropertyName = "fileName")] + public string FileName { get; private set; } + + /// + /// Gets status of the file. (Initial, Uploading, Uploaded, Restoring, + /// Restored or Skipped) + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + /// + /// Gets file size in bytes + /// + [JsonProperty(PropertyName = "totalSize")] + public long? TotalSize { get; private set; } + + /// + /// Gets bytes read + /// + [JsonProperty(PropertyName = "dataRead")] + public long? DataRead { get; private set; } + + /// + /// Gets bytes written + /// + [JsonProperty(PropertyName = "dataWritten")] + public long? DataWritten { get; private set; } + + /// + /// Gets copy throughput in KBps + /// + [JsonProperty(PropertyName = "copyThroughput")] + public double? CopyThroughput { get; private set; } + + /// + /// Gets copy Duration in seconds + /// + [JsonProperty(PropertyName = "copyDuration")] + public int? CopyDuration { get; private set; } + + /// + /// Gets media family sequence number + /// + [JsonProperty(PropertyName = "familySequenceNumber")] + public int? FamilySequenceNumber { get; private set; } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SqlBackupSetInfo.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SqlBackupSetInfo.cs new file mode 100644 index 000000000000..ad6f91353ee7 --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SqlBackupSetInfo.cs @@ -0,0 +1,136 @@ +// +// 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.DataMigration.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Information of backup set + /// + public partial class SqlBackupSetInfo + { + /// + /// Initializes a new instance of the SqlBackupSetInfo class. + /// + public SqlBackupSetInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlBackupSetInfo class. + /// + /// Backup set id. + /// First LSN of the backup set. + /// Last LSN of the backup set. + /// Backup type. + /// List of files in the backup + /// set. + /// Backup start date. + /// Backup end time. + /// Whether this backup set has been + /// restored or not. + /// Has Backup Checksums + /// Media family count + /// The reasons why the backup set is + /// ignored + public SqlBackupSetInfo(System.Guid? backupSetId = default(System.Guid?), string firstLSN = default(string), string lastLSN = default(string), string backupType = default(string), IList listOfBackupFiles = default(IList), System.DateTimeOffset? backupStartDate = default(System.DateTimeOffset?), System.DateTimeOffset? backupFinishDate = default(System.DateTimeOffset?), bool? isBackupRestored = default(bool?), bool? hasBackupChecksums = default(bool?), int? familyCount = default(int?), IList ignoreReasons = default(IList)) + { + BackupSetId = backupSetId; + FirstLSN = firstLSN; + LastLSN = lastLSN; + BackupType = backupType; + ListOfBackupFiles = listOfBackupFiles; + BackupStartDate = backupStartDate; + BackupFinishDate = backupFinishDate; + IsBackupRestored = isBackupRestored; + HasBackupChecksums = hasBackupChecksums; + FamilyCount = familyCount; + IgnoreReasons = ignoreReasons; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets backup set id. + /// + [JsonProperty(PropertyName = "backupSetId")] + public System.Guid? BackupSetId { get; private set; } + + /// + /// Gets first LSN of the backup set. + /// + [JsonProperty(PropertyName = "firstLSN")] + public string FirstLSN { get; private set; } + + /// + /// Gets last LSN of the backup set. + /// + [JsonProperty(PropertyName = "lastLSN")] + public string LastLSN { get; private set; } + + /// + /// Gets backup type. + /// + [JsonProperty(PropertyName = "backupType")] + public string BackupType { get; private set; } + + /// + /// Gets list of files in the backup set. + /// + [JsonProperty(PropertyName = "listOfBackupFiles")] + public IList ListOfBackupFiles { get; private set; } + + /// + /// Gets backup start date. + /// + [JsonProperty(PropertyName = "backupStartDate")] + public System.DateTimeOffset? BackupStartDate { get; private set; } + + /// + /// Gets backup end time. + /// + [JsonProperty(PropertyName = "backupFinishDate")] + public System.DateTimeOffset? BackupFinishDate { get; private set; } + + /// + /// Gets whether this backup set has been restored or not. + /// + [JsonProperty(PropertyName = "isBackupRestored")] + public bool? IsBackupRestored { get; private set; } + + /// + /// Gets has Backup Checksums + /// + [JsonProperty(PropertyName = "hasBackupChecksums")] + public bool? HasBackupChecksums { get; private set; } + + /// + /// Gets media family count + /// + [JsonProperty(PropertyName = "familyCount")] + public int? FamilyCount { get; private set; } + + /// + /// Gets the reasons why the backup set is ignored + /// + [JsonProperty(PropertyName = "ignoreReasons")] + public IList IgnoreReasons { get; private set; } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SqlConnectionInfo.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SqlConnectionInfo.cs index 35cc40bfa018..5b045ea08c4e 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SqlConnectionInfo.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SqlConnectionInfo.cs @@ -34,6 +34,12 @@ public SqlConnectionInfo() /// Protocol:MachineName\SQLServerInstanceName,PortNumber /// User name /// Password credential. + /// name of the server + /// Port for Server + /// server version + /// server brand version + /// Represents the ID of an HTTP resource + /// represented by an Azure resource provider. /// Authentication type to use for /// connection. Possible values include: 'None', /// 'WindowsAuthentication', 'SqlAuthentication', @@ -46,10 +52,15 @@ public SqlConnectionInfo() /// certificate /// Server platform type for connection. /// Possible values include: 'SqlOnPrem' - public SqlConnectionInfo(string dataSource, string userName = default(string), string password = default(string), string authentication = default(string), bool? encryptConnection = default(bool?), string additionalSettings = default(string), bool? trustServerCertificate = default(bool?), string platform = default(string)) + public SqlConnectionInfo(string dataSource, string userName = default(string), string password = default(string), string serverName = default(string), int? port = default(int?), string serverVersion = default(string), string serverBrandVersion = default(string), string resourceId = default(string), string authentication = default(string), bool? encryptConnection = default(bool?), string additionalSettings = default(string), bool? trustServerCertificate = default(bool?), string platform = default(string)) : base(userName, password) { DataSource = dataSource; + ServerName = serverName; + Port = port; + ServerVersion = serverVersion; + ServerBrandVersion = serverBrandVersion; + ResourceId = resourceId; Authentication = authentication; EncryptConnection = encryptConnection; AdditionalSettings = additionalSettings; @@ -70,6 +81,37 @@ public SqlConnectionInfo() [JsonProperty(PropertyName = "dataSource")] public string DataSource { get; set; } + /// + /// Gets or sets name of the server + /// + [JsonProperty(PropertyName = "serverName")] + public string ServerName { get; set; } + + /// + /// Gets or sets port for Server + /// + [JsonProperty(PropertyName = "port")] + public int? Port { get; set; } + + /// + /// Gets or sets server version + /// + [JsonProperty(PropertyName = "serverVersion")] + public string ServerVersion { get; set; } + + /// + /// Gets or sets server brand version + /// + [JsonProperty(PropertyName = "serverBrandVersion")] + public string ServerBrandVersion { get; set; } + + /// + /// Gets or sets represents the ID of an HTTP resource represented by + /// an Azure resource provider. + /// + [JsonProperty(PropertyName = "resourceId")] + public string ResourceId { get; set; } + /// /// Gets or sets authentication type to use for connection. Possible /// values include: 'None', 'WindowsAuthentication', diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SqlConnectionInformation.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SqlConnectionInformation.cs new file mode 100644 index 000000000000..91146f0c56f5 --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SqlConnectionInformation.cs @@ -0,0 +1,93 @@ +// +// 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.DataMigration.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Source SQL Connection + /// + public partial class SqlConnectionInformation + { + /// + /// Initializes a new instance of the SqlConnectionInformation class. + /// + public SqlConnectionInformation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlConnectionInformation class. + /// + /// Data source. + /// Authentication type. + /// User name to connect to source SQL. + /// Password to connect to source SQL. + /// Whether to encrypt connection or + /// not. + /// Whether to trust server + /// certificate or not. + public SqlConnectionInformation(string dataSource = default(string), string authentication = default(string), string userName = default(string), string password = default(string), bool? encryptConnection = default(bool?), bool? trustServerCertificate = default(bool?)) + { + DataSource = dataSource; + Authentication = authentication; + UserName = userName; + Password = password; + EncryptConnection = encryptConnection; + TrustServerCertificate = trustServerCertificate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets data source. + /// + [JsonProperty(PropertyName = "dataSource")] + public string DataSource { get; set; } + + /// + /// Gets or sets authentication type. + /// + [JsonProperty(PropertyName = "authentication")] + public string Authentication { get; set; } + + /// + /// Gets or sets user name to connect to source SQL. + /// + [JsonProperty(PropertyName = "userName")] + public string UserName { get; set; } + + /// + /// Gets or sets password to connect to source SQL. + /// + [JsonProperty(PropertyName = "password")] + public string Password { get; set; } + + /// + /// Gets or sets whether to encrypt connection or not. + /// + [JsonProperty(PropertyName = "encryptConnection")] + public bool? EncryptConnection { get; set; } + + /// + /// Gets or sets whether to trust server certificate or not. + /// + [JsonProperty(PropertyName = "trustServerCertificate")] + public bool? TrustServerCertificate { get; set; } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SqlFileShare.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SqlFileShare.cs new file mode 100644 index 000000000000..20671beefccd --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SqlFileShare.cs @@ -0,0 +1,72 @@ +// +// 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.DataMigration.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// File share + /// + public partial class SqlFileShare + { + /// + /// Initializes a new instance of the SqlFileShare class. + /// + public SqlFileShare() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlFileShare class. + /// + /// Location as SMB share or local drive where + /// backups are placed. + /// Username to access the file share location + /// for backups. + /// Password for username to access file share + /// location. + public SqlFileShare(string path = default(string), string username = default(string), string password = default(string)) + { + Path = path; + Username = username; + Password = password; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets location as SMB share or local drive where backups are + /// placed. + /// + [JsonProperty(PropertyName = "path")] + public string Path { get; set; } + + /// + /// Gets or sets username to access the file share location for + /// backups. + /// + [JsonProperty(PropertyName = "username")] + public string Username { get; set; } + + /// + /// Gets or sets password for username to access file share location. + /// + [JsonProperty(PropertyName = "password")] + public string Password { get; set; } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SqlMigrationService.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SqlMigrationService.cs new file mode 100644 index 000000000000..83436e091133 --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SqlMigrationService.cs @@ -0,0 +1,65 @@ +// +// 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.DataMigration.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A SQL Migration Service. + /// + [Rest.Serialization.JsonTransformation] + public partial class SqlMigrationService : IResource + { + /// + /// Initializes a new instance of the SqlMigrationService class. + /// + public SqlMigrationService() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlMigrationService class. + /// + /// Provisioning state to track the + /// async operation status. + /// Current state of the + /// Integration runtime. + public SqlMigrationService(string provisioningState = default(string), string integrationRuntimeState = default(string)) + { + ProvisioningState = provisioningState; + IntegrationRuntimeState = integrationRuntimeState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets provisioning state to track the async operation status. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets current state of the Integration runtime. + /// + [JsonProperty(PropertyName = "properties.integrationRuntimeState")] + public string IntegrationRuntimeState { get; private set; } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SqlMigrationServiceUpdate.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SqlMigrationServiceUpdate.cs new file mode 100644 index 000000000000..24d8cd6a17b5 --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SqlMigrationServiceUpdate.cs @@ -0,0 +1,51 @@ +// +// 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.DataMigration.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An update to a SQL Migration Service. + /// + public partial class SqlMigrationServiceUpdate + { + /// + /// Initializes a new instance of the SqlMigrationServiceUpdate class. + /// + public SqlMigrationServiceUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SqlMigrationServiceUpdate class. + /// + public SqlMigrationServiceUpdate(IDictionary tags = default(IDictionary)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SystemData.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SystemData.cs index 7cb24e8c2259..ccd0888a1788 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SystemData.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/SystemData.cs @@ -13,9 +13,6 @@ namespace Microsoft.Azure.Management.DataMigration.Models using Newtonsoft.Json; using System.Linq; - /// - /// Metadata pertaining to creation and last modification of the resource. - /// public partial class SystemData { /// @@ -29,20 +26,10 @@ public SystemData() /// /// Initializes a new instance of the SystemData class. /// - /// The identity that created the - /// resource. - /// The type of identity that created the - /// resource. Possible values include: 'User', 'Application', - /// 'ManagedIdentity', 'Key' - /// The timestamp of resource creation - /// (UTC). - /// The identity that last modified the - /// resource. - /// The type of identity that last - /// modified the resource. Possible values include: 'User', + /// Possible values include: 'User', + /// 'Application', 'ManagedIdentity', 'Key' + /// Possible values include: 'User', /// 'Application', 'ManagedIdentity', 'Key' - /// The timestamp of resource last - /// modification (UTC) public SystemData(string createdBy = default(string), string createdByType = default(string), System.DateTimeOffset? createdAt = default(System.DateTimeOffset?), string lastModifiedBy = default(string), string lastModifiedByType = default(string), System.DateTimeOffset? lastModifiedAt = default(System.DateTimeOffset?)) { CreatedBy = createdBy; @@ -60,41 +47,35 @@ public SystemData() partial void CustomInit(); /// - /// Gets or sets the identity that created the resource. /// [JsonProperty(PropertyName = "createdBy")] public string CreatedBy { get; set; } /// - /// Gets or sets the type of identity that created the resource. - /// Possible values include: 'User', 'Application', 'ManagedIdentity', - /// 'Key' + /// Gets or sets possible values include: 'User', 'Application', + /// 'ManagedIdentity', 'Key' /// [JsonProperty(PropertyName = "createdByType")] public string CreatedByType { get; set; } /// - /// Gets or sets the timestamp of resource creation (UTC). /// [JsonProperty(PropertyName = "createdAt")] public System.DateTimeOffset? CreatedAt { get; set; } /// - /// Gets or sets the identity that last modified the resource. /// [JsonProperty(PropertyName = "lastModifiedBy")] public string LastModifiedBy { get; set; } /// - /// Gets or sets the type of identity that last modified the resource. - /// Possible values include: 'User', 'Application', 'ManagedIdentity', - /// 'Key' + /// Gets or sets possible values include: 'User', 'Application', + /// 'ManagedIdentity', 'Key' /// [JsonProperty(PropertyName = "lastModifiedByType")] public string LastModifiedByType { get; set; } /// - /// Gets or sets the timestamp of resource last modification (UTC) /// [JsonProperty(PropertyName = "lastModifiedAt")] public System.DateTimeOffset? LastModifiedAt { get; set; } diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/TargetLocation.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/TargetLocation.cs new file mode 100644 index 000000000000..d158a0efc8e5 --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/TargetLocation.cs @@ -0,0 +1,60 @@ +// +// 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.DataMigration.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Target Location details for optional copy of backups + /// + public partial class TargetLocation + { + /// + /// Initializes a new instance of the TargetLocation class. + /// + public TargetLocation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TargetLocation class. + /// + /// Resource Id of the storage + /// account copying backups. + /// Storage Account Key. + public TargetLocation(string storageAccountResourceId = default(string), string accountKey = default(string)) + { + StorageAccountResourceId = storageAccountResourceId; + AccountKey = accountKey; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource Id of the storage account copying backups. + /// + [JsonProperty(PropertyName = "storageAccountResourceId")] + public string StorageAccountResourceId { get; set; } + + /// + /// Gets or sets storage Account Key. + /// + [JsonProperty(PropertyName = "accountKey")] + public string AccountKey { get; set; } + + } +} diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/TrackedResource.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/TrackedResource.cs index ad74c7aa7b45..b3625d370c94 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/TrackedResource.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/TrackedResource.cs @@ -11,15 +11,13 @@ namespace Microsoft.Azure.Management.DataMigration.Models { using Microsoft.Rest; + using Microsoft.Rest.Azure; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; - /// - /// ARM tracked top level resource. - /// - public partial class TrackedResource : Resource + public partial class TrackedResource : IResource { /// /// Initializes a new instance of the TrackedResource class. @@ -32,18 +30,13 @@ public TrackedResource() /// /// Initializes a new instance of the TrackedResource class. /// - /// Resource location. - /// Resource ID. - /// Resource name. - /// Resource type. - /// Resource tags. - /// Metadata pertaining to creation and last - /// modification of the resource. - public TrackedResource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), SystemData systemData = default(SystemData)) - : base(id, name, type) + public TrackedResource(string location = default(string), IDictionary tags = default(IDictionary), string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) { - Tags = tags; Location = location; + Tags = tags; + Id = id; + Name = name; + Type = type; SystemData = systemData; CustomInit(); } @@ -54,36 +47,34 @@ public TrackedResource() partial void CustomInit(); /// - /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// /// [JsonProperty(PropertyName = "tags")] public IDictionary Tags { get; set; } /// - /// Gets or sets resource location. /// - [JsonProperty(PropertyName = "location")] - public string Location { get; set; } + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } /// - /// Gets metadata pertaining to creation and last modification of the - /// resource. /// - [JsonProperty(PropertyName = "systemData")] - public SystemData SystemData { get; private set; } + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } /// - /// Validate the object. /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Location == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Location"); - } - } + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + } } diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ValidateMigrationInputSqlServerSqlMITaskInput.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ValidateMigrationInputSqlServerSqlMITaskInput.cs index 5761e5ef3423..f17b94a85ea0 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ValidateMigrationInputSqlServerSqlMITaskInput.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Models/ValidateMigrationInputSqlServerSqlMITaskInput.cs @@ -157,10 +157,6 @@ public virtual void Validate() { BackupFileShare.Validate(); } - if (BackupBlobShare != null) - { - BackupBlobShare.Validate(); - } } } } diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Operations.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Operations.cs index 530822d147b1..3c88264174e0 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Operations.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/Operations.cs @@ -51,19 +51,15 @@ internal Operations(DataMigrationServiceClient client) public DataMigrationServiceClient Client { get; private set; } /// - /// Get available resource provider actions (operations) + /// Lists all of the available SQL Migration REST API operations. /// - /// - /// Lists all available actions exposed by the Database Migration Service - /// resource provider. - /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -78,7 +74,7 @@ internal Operations(DataMigrationServiceClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -162,13 +158,14 @@ internal Operations(DataMigrationServiceClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ApiErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { + ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -178,6 +175,10 @@ internal Operations(DataMigrationServiceClient client) } 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); @@ -190,7 +191,7 @@ internal Operations(DataMigrationServiceClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -203,7 +204,7 @@ internal Operations(DataMigrationServiceClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -223,12 +224,8 @@ internal Operations(DataMigrationServiceClient client) } /// - /// Get available resource provider actions (operations) + /// Lists all of the available SQL Migration REST API operations. /// - /// - /// Lists all available actions exposed by the Database Migration Service - /// resource provider. - /// /// /// The NextLink from the previous successful call to List operation. /// @@ -238,7 +235,7 @@ internal Operations(DataMigrationServiceClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -253,7 +250,7 @@ internal Operations(DataMigrationServiceClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -334,13 +331,14 @@ internal Operations(DataMigrationServiceClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ApiErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ApiError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { + ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -350,6 +348,10 @@ internal Operations(DataMigrationServiceClient client) } 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); @@ -362,7 +364,7 @@ internal Operations(DataMigrationServiceClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -375,7 +377,7 @@ internal Operations(DataMigrationServiceClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/OperationsExtensions.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/OperationsExtensions.cs index 0981b7d03a73..f12dba460139 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/OperationsExtensions.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/OperationsExtensions.cs @@ -22,34 +22,26 @@ namespace Microsoft.Azure.Management.DataMigration public static partial class OperationsExtensions { /// - /// Get available resource provider actions (operations) + /// Lists all of the available SQL Migration REST API operations. /// - /// - /// Lists all available actions exposed by the Database Migration Service - /// resource provider. - /// /// /// The operations group for this extension method. /// - public static IPage List(this IOperations operations) + public static IPage List(this IOperations operations) { return operations.ListAsync().GetAwaiter().GetResult(); } /// - /// Get available resource provider actions (operations) + /// Lists all of the available SQL Migration REST API operations. /// - /// - /// Lists all available actions exposed by the Database Migration Service - /// resource provider. - /// /// /// The operations group for this extension method. /// /// /// The cancellation token. /// - public static async Task> ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { @@ -58,30 +50,22 @@ public static IPage List(this IOperations operations) } /// - /// Get available resource provider actions (operations) + /// Lists all of the available SQL Migration REST API operations. /// - /// - /// Lists all available actions exposed by the Database Migration Service - /// resource provider. - /// /// /// The operations group for this extension method. /// /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListNext(this IOperations operations, string nextPageLink) + public static IPage ListNext(this IOperations operations, string nextPageLink) { return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// - /// Get available resource provider actions (operations) + /// Lists all of the available SQL Migration REST API operations. /// - /// - /// Lists all available actions exposed by the Database Migration Service - /// resource provider. - /// /// /// The operations group for this extension method. /// @@ -91,7 +75,7 @@ public static IPage ListNext(this IOperations operations, stri /// /// The cancellation token. /// - public static async Task> ListNextAsync(this IOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListNextAsync(this IOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/SdkInfo_DataMigrationManagementClient.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/SdkInfo_DataMigrationManagementClient.cs index df39c7e06689..19e385992eb2 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/SdkInfo_DataMigrationManagementClient.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/SdkInfo_DataMigrationManagementClient.cs @@ -19,17 +19,19 @@ public static IEnumerable> ApiInfo_DataMigrationMa { return new Tuple[] { - new Tuple("DataMigration", "Files", "2021-06-30"), - new Tuple("DataMigration", "Operations", "2021-06-30"), - new Tuple("DataMigration", "Projects", "2021-06-30"), - new Tuple("DataMigration", "ResourceSkus", "2021-06-30"), - new Tuple("DataMigration", "ServiceTasks", "2021-06-30"), - new Tuple("DataMigration", "Services", "2021-06-30"), - new Tuple("DataMigration", "Tasks", "2021-06-30"), - new Tuple("DataMigration", "Usages", "2021-06-30"), + new Tuple("DataMigration", "Files", "2022-01-30-preview"), + new Tuple("DataMigration", "Operations", "2022-01-30-preview"), + new Tuple("DataMigration", "Projects", "2022-01-30-preview"), + new Tuple("DataMigration", "ResourceSkus", "2022-01-30-preview"), + new Tuple("DataMigration", "ServiceTasks", "2022-01-30-preview"), + new Tuple("DataMigration", "Services", "2022-01-30-preview"), + new Tuple("DataMigration", "SqlMigrationServices", "2022-01-30-preview"), + new Tuple("DataMigration", "Tasks", "2022-01-30-preview"), + new Tuple("DataMigration", "Usages", "2022-01-30-preview"), + new Tuple("Sql", "DatabaseMigrationsSqlMi", "2022-01-30-preview"), + new Tuple("SqlVirtualMachine", "DatabaseMigrationsSqlVm", "2022-01-30-preview"), }.AsEnumerable(); } } } } - diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/ServicesOperations.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/ServicesOperations.cs index 6340e15ac656..428ef0b266af 100644 --- a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/ServicesOperations.cs +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/ServicesOperations.cs @@ -1617,10 +1617,6 @@ internal ServicesOperations(DataMigrationServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } - if (parameters != null) - { - parameters.Validate(); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); diff --git a/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/SqlMigrationServicesOperations.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/SqlMigrationServicesOperations.cs new file mode 100644 index 000000000000..35246cb0e155 --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/SqlMigrationServicesOperations.cs @@ -0,0 +1,2861 @@ +// +// 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.DataMigration +{ + 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; + + /// + /// SqlMigrationServicesOperations operations. + /// + internal partial class SqlMigrationServicesOperations : IServiceOperations, ISqlMigrationServicesOperations + { + /// + /// Initializes a new instance of the SqlMigrationServicesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SqlMigrationServicesOperations(DataMigrationServiceClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DataMigrationServiceClient + /// + public DataMigrationServiceClient Client { get; private set; } + + /// + /// Retrieve the Database Migration Service + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// 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 sqlMigrationServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sqlMigrationServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlMigrationServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sqlMigrationServiceName", sqlMigrationServiceName); + 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.DataMigration/sqlMigrationServices/{sqlMigrationServiceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sqlMigrationServiceName}", System.Uri.EscapeDataString(sqlMigrationServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or Update Database Migration Service. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// Details of SqlMigrationService resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string sqlMigrationServiceName, SqlMigrationService parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, sqlMigrationServiceName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete Database Migration Service. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string sqlMigrationServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, sqlMigrationServiceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update Database Migration Service. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// Details of SqlMigrationService resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string sqlMigrationServiceName, SqlMigrationServiceUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, sqlMigrationServiceName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieve all SQL migration services in the resource group. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", 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.DataMigration/sqlMigrationServices").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieve the List of Authentication Keys for Self Hosted Integration + /// Runtime. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// 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> ListAuthKeysWithHttpMessagesAsync(string resourceGroupName, string sqlMigrationServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sqlMigrationServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlMigrationServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sqlMigrationServiceName", sqlMigrationServiceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListAuthKeys", 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.DataMigration/sqlMigrationServices/{sqlMigrationServiceName}/listAuthKeys").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sqlMigrationServiceName}", System.Uri.EscapeDataString(sqlMigrationServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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; + } + + /// + /// Regenerate a new set of Authentication Keys for Self Hosted Integration + /// Runtime. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// Details of SqlMigrationService resource. + /// + /// + /// 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> RegenerateAuthKeysWithHttpMessagesAsync(string resourceGroupName, string sqlMigrationServiceName, RegenAuthKeys parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sqlMigrationServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlMigrationServiceName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sqlMigrationServiceName", sqlMigrationServiceName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "RegenerateAuthKeys", 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.DataMigration/sqlMigrationServices/{sqlMigrationServiceName}/regenerateAuthKeys").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sqlMigrationServiceName}", System.Uri.EscapeDataString(sqlMigrationServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + 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; + } + + /// + /// Delete the integration runtime node. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// Details of SqlMigrationService resource. + /// + /// + /// 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> DeleteNodeMethodWithHttpMessagesAsync(string resourceGroupName, string sqlMigrationServiceName, DeleteNode parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sqlMigrationServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlMigrationServiceName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sqlMigrationServiceName", sqlMigrationServiceName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DeleteNodeMethod", 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.DataMigration/sqlMigrationServices/{sqlMigrationServiceName}/deleteNode").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sqlMigrationServiceName}", System.Uri.EscapeDataString(sqlMigrationServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + 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; + } + + /// + /// Retrieve the List of database migrations attached to the service. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// 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>> ListMigrationsWithHttpMessagesAsync(string resourceGroupName, string sqlMigrationServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sqlMigrationServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlMigrationServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sqlMigrationServiceName", sqlMigrationServiceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListMigrations", 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.DataMigration/sqlMigrationServices/{sqlMigrationServiceName}/listMigrations").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sqlMigrationServiceName}", System.Uri.EscapeDataString(sqlMigrationServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieve the registered Integration Runtime nodes and their monitoring data + /// for a given Database Migration Service. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// 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> ListMonitoringDataWithHttpMessagesAsync(string resourceGroupName, string sqlMigrationServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sqlMigrationServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlMigrationServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sqlMigrationServiceName", sqlMigrationServiceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListMonitoringData", 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.DataMigration/sqlMigrationServices/{sqlMigrationServiceName}/listMonitoringData").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sqlMigrationServiceName}", System.Uri.EscapeDataString(sqlMigrationServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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; + } + + /// + /// Retrieve all SQL migration services in the subscriptions. + /// + /// + /// 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>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.DataMigration/sqlMigrationServices").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or Update Database Migration Service. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// Details of SqlMigrationService resource. + /// + /// + /// 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 sqlMigrationServiceName, SqlMigrationService parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sqlMigrationServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlMigrationServiceName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sqlMigrationServiceName", sqlMigrationServiceName); + tracingParameters.Add("parameters", parameters); + 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.DataMigration/sqlMigrationServices/{sqlMigrationServiceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sqlMigrationServiceName}", System.Uri.EscapeDataString(sqlMigrationServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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 != 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; + } + + /// + /// Delete Database Migration Service. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// 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 sqlMigrationServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sqlMigrationServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlMigrationServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sqlMigrationServiceName", sqlMigrationServiceName); + 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.DataMigration/sqlMigrationServices/{sqlMigrationServiceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sqlMigrationServiceName}", System.Uri.EscapeDataString(sqlMigrationServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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; + } + + /// + /// Update Database Migration Service. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// Details of SqlMigrationService resource. + /// + /// + /// 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string sqlMigrationServiceName, SqlMigrationServiceUpdate parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (sqlMigrationServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sqlMigrationServiceName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("sqlMigrationServiceName", sqlMigrationServiceName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataMigration/sqlMigrationServices/{sqlMigrationServiceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{sqlMigrationServiceName}", System.Uri.EscapeDataString(sqlMigrationServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _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 != 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; + } + + /// + /// Retrieve all SQL migration services in the resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(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, "ListByResourceGroupNext", 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; + } + + /// + /// Retrieve the List of database migrations attached to the service. + /// + /// + /// 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>> ListMigrationsNextWithHttpMessagesAsync(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, "ListMigrationsNext", 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; + } + + /// + /// Retrieve all SQL migration services in the subscriptions. + /// + /// + /// 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>> ListBySubscriptionNextWithHttpMessagesAsync(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, "ListBySubscriptionNext", 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/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/SqlMigrationServicesOperationsExtensions.cs b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/SqlMigrationServicesOperationsExtensions.cs new file mode 100644 index 000000000000..27f05fe5e2ab --- /dev/null +++ b/sdk/datamigration/Microsoft.Azure.Management.DataMigration/src/Generated/SqlMigrationServicesOperationsExtensions.cs @@ -0,0 +1,731 @@ +// +// 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.DataMigration +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SqlMigrationServicesOperations. + /// + public static partial class SqlMigrationServicesOperationsExtensions + { + /// + /// Retrieve the Database Migration Service + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + public static SqlMigrationService Get(this ISqlMigrationServicesOperations operations, string resourceGroupName, string sqlMigrationServiceName) + { + return operations.GetAsync(resourceGroupName, sqlMigrationServiceName).GetAwaiter().GetResult(); + } + + /// + /// Retrieve the Database Migration Service + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISqlMigrationServicesOperations operations, string resourceGroupName, string sqlMigrationServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, sqlMigrationServiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or Update Database Migration Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// Details of SqlMigrationService resource. + /// + public static SqlMigrationService CreateOrUpdate(this ISqlMigrationServicesOperations operations, string resourceGroupName, string sqlMigrationServiceName, SqlMigrationService parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, sqlMigrationServiceName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create or Update Database Migration Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// Details of SqlMigrationService resource. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ISqlMigrationServicesOperations operations, string resourceGroupName, string sqlMigrationServiceName, SqlMigrationService parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, sqlMigrationServiceName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete Database Migration Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + public static void Delete(this ISqlMigrationServicesOperations operations, string resourceGroupName, string sqlMigrationServiceName) + { + operations.DeleteAsync(resourceGroupName, sqlMigrationServiceName).GetAwaiter().GetResult(); + } + + /// + /// Delete Database Migration Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ISqlMigrationServicesOperations operations, string resourceGroupName, string sqlMigrationServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, sqlMigrationServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Update Database Migration Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// Details of SqlMigrationService resource. + /// + public static SqlMigrationService Update(this ISqlMigrationServicesOperations operations, string resourceGroupName, string sqlMigrationServiceName, SqlMigrationServiceUpdate parameters) + { + return operations.UpdateAsync(resourceGroupName, sqlMigrationServiceName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update Database Migration Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// Details of SqlMigrationService resource. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ISqlMigrationServicesOperations operations, string resourceGroupName, string sqlMigrationServiceName, SqlMigrationServiceUpdate parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, sqlMigrationServiceName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieve all SQL migration services in the resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + public static IPage ListByResourceGroup(this ISqlMigrationServicesOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Retrieve all SQL migration services in the resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this ISqlMigrationServicesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieve the List of Authentication Keys for Self Hosted Integration + /// Runtime. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + public static AuthenticationKeys ListAuthKeys(this ISqlMigrationServicesOperations operations, string resourceGroupName, string sqlMigrationServiceName) + { + return operations.ListAuthKeysAsync(resourceGroupName, sqlMigrationServiceName).GetAwaiter().GetResult(); + } + + /// + /// Retrieve the List of Authentication Keys for Self Hosted Integration + /// Runtime. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// The cancellation token. + /// + public static async Task ListAuthKeysAsync(this ISqlMigrationServicesOperations operations, string resourceGroupName, string sqlMigrationServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListAuthKeysWithHttpMessagesAsync(resourceGroupName, sqlMigrationServiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Regenerate a new set of Authentication Keys for Self Hosted Integration + /// Runtime. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// Details of SqlMigrationService resource. + /// + public static RegenAuthKeys RegenerateAuthKeys(this ISqlMigrationServicesOperations operations, string resourceGroupName, string sqlMigrationServiceName, RegenAuthKeys parameters) + { + return operations.RegenerateAuthKeysAsync(resourceGroupName, sqlMigrationServiceName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Regenerate a new set of Authentication Keys for Self Hosted Integration + /// Runtime. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// Details of SqlMigrationService resource. + /// + /// + /// The cancellation token. + /// + public static async Task RegenerateAuthKeysAsync(this ISqlMigrationServicesOperations operations, string resourceGroupName, string sqlMigrationServiceName, RegenAuthKeys parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.RegenerateAuthKeysWithHttpMessagesAsync(resourceGroupName, sqlMigrationServiceName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete the integration runtime node. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// Details of SqlMigrationService resource. + /// + public static DeleteNode DeleteNodeMethod(this ISqlMigrationServicesOperations operations, string resourceGroupName, string sqlMigrationServiceName, DeleteNode parameters) + { + return operations.DeleteNodeMethodAsync(resourceGroupName, sqlMigrationServiceName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Delete the integration runtime node. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// Details of SqlMigrationService resource. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteNodeMethodAsync(this ISqlMigrationServicesOperations operations, string resourceGroupName, string sqlMigrationServiceName, DeleteNode parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteNodeMethodWithHttpMessagesAsync(resourceGroupName, sqlMigrationServiceName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieve the List of database migrations attached to the service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + public static IPage ListMigrations(this ISqlMigrationServicesOperations operations, string resourceGroupName, string sqlMigrationServiceName) + { + return operations.ListMigrationsAsync(resourceGroupName, sqlMigrationServiceName).GetAwaiter().GetResult(); + } + + /// + /// Retrieve the List of database migrations attached to the service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// The cancellation token. + /// + public static async Task> ListMigrationsAsync(this ISqlMigrationServicesOperations operations, string resourceGroupName, string sqlMigrationServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListMigrationsWithHttpMessagesAsync(resourceGroupName, sqlMigrationServiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieve the registered Integration Runtime nodes and their monitoring data + /// for a given Database Migration Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + public static IntegrationRuntimeMonitoringData ListMonitoringData(this ISqlMigrationServicesOperations operations, string resourceGroupName, string sqlMigrationServiceName) + { + return operations.ListMonitoringDataAsync(resourceGroupName, sqlMigrationServiceName).GetAwaiter().GetResult(); + } + + /// + /// Retrieve the registered Integration Runtime nodes and their monitoring data + /// for a given Database Migration Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// The cancellation token. + /// + public static async Task ListMonitoringDataAsync(this ISqlMigrationServicesOperations operations, string resourceGroupName, string sqlMigrationServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListMonitoringDataWithHttpMessagesAsync(resourceGroupName, sqlMigrationServiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieve all SQL migration services in the subscriptions. + /// + /// + /// The operations group for this extension method. + /// + public static IPage ListBySubscription(this ISqlMigrationServicesOperations operations) + { + return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); + } + + /// + /// Retrieve all SQL migration services in the subscriptions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this ISqlMigrationServicesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or Update Database Migration Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// Details of SqlMigrationService resource. + /// + public static SqlMigrationService BeginCreateOrUpdate(this ISqlMigrationServicesOperations operations, string resourceGroupName, string sqlMigrationServiceName, SqlMigrationService parameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, sqlMigrationServiceName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create or Update Database Migration Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// Details of SqlMigrationService resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this ISqlMigrationServicesOperations operations, string resourceGroupName, string sqlMigrationServiceName, SqlMigrationService parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, sqlMigrationServiceName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete Database Migration Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + public static void BeginDelete(this ISqlMigrationServicesOperations operations, string resourceGroupName, string sqlMigrationServiceName) + { + operations.BeginDeleteAsync(resourceGroupName, sqlMigrationServiceName).GetAwaiter().GetResult(); + } + + /// + /// Delete Database Migration Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this ISqlMigrationServicesOperations operations, string resourceGroupName, string sqlMigrationServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, sqlMigrationServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Update Database Migration Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// Details of SqlMigrationService resource. + /// + public static SqlMigrationService BeginUpdate(this ISqlMigrationServicesOperations operations, string resourceGroupName, string sqlMigrationServiceName, SqlMigrationServiceUpdate parameters) + { + return operations.BeginUpdateAsync(resourceGroupName, sqlMigrationServiceName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update Database Migration Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the resource. You can obtain this + /// value from the Azure Resource Manager API or the portal. + /// + /// + /// Name of the SQL Migration Service. + /// + /// + /// Details of SqlMigrationService resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this ISqlMigrationServicesOperations operations, string resourceGroupName, string sqlMigrationServiceName, SqlMigrationServiceUpdate parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, sqlMigrationServiceName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieve all SQL migration services in the resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this ISqlMigrationServicesOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Retrieve all SQL migration services in the resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this ISqlMigrationServicesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieve the List of database migrations attached to the service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListMigrationsNext(this ISqlMigrationServicesOperations operations, string nextPageLink) + { + return operations.ListMigrationsNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Retrieve the List of database migrations attached to the service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListMigrationsNextAsync(this ISqlMigrationServicesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListMigrationsNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieve all SQL migration services in the subscriptions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySubscriptionNext(this ISqlMigrationServicesOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Retrieve all SQL migration services in the subscriptions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionNextAsync(this ISqlMigrationServicesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +}