diff --git a/src/Microsoft.SqlTools.ServiceLayer/DisasterRecovery/Contracts/RestoreConfigInfoRequest.cs b/src/Microsoft.SqlTools.ServiceLayer/DisasterRecovery/Contracts/RestoreConfigInfoRequest.cs
new file mode 100644
index 00000000..8de0931c
--- /dev/null
+++ b/src/Microsoft.SqlTools.ServiceLayer/DisasterRecovery/Contracts/RestoreConfigInfoRequest.cs
@@ -0,0 +1,43 @@
+//
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+//
+
+using System.Collections.Generic;
+using Microsoft.SqlTools.Hosting.Protocol.Contracts;
+
+namespace Microsoft.SqlTools.ServiceLayer.DisasterRecovery.Contracts
+{
+ public class RestoreConfigInfoRequestParams
+ {
+ ///
+ /// The Uri to find the connection to do the restore operations
+ ///
+ public string OwnerUri { get; set; }
+ }
+
+ public class RestoreConfigInfoResponse
+ {
+ public RestoreConfigInfoResponse()
+ {
+ ConfigInfo = new Dictionary();
+ }
+
+ ///
+ /// Config Info
+ ///
+ public Dictionary ConfigInfo { get; set; }
+
+ ///
+ /// Errors occurred while creating the restore config info
+ ///
+ public string ErrorMessage { get; set; }
+ }
+
+ public class RestoreConfigInfoRequest
+ {
+ public static readonly
+ RequestType Type =
+ RequestType.Create("disasterrecovery/restoreconfiginfo");
+ }
+}
diff --git a/src/Microsoft.SqlTools.ServiceLayer/DisasterRecovery/Contracts/RestorePlanDetailInfo.cs b/src/Microsoft.SqlTools.ServiceLayer/DisasterRecovery/Contracts/RestorePlanDetailInfo.cs
new file mode 100644
index 00000000..ea0d3757
--- /dev/null
+++ b/src/Microsoft.SqlTools.ServiceLayer/DisasterRecovery/Contracts/RestorePlanDetailInfo.cs
@@ -0,0 +1,52 @@
+//
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+//
+
+namespace Microsoft.SqlTools.ServiceLayer.DisasterRecovery.Contracts
+{
+ ///
+ /// Class to include the plan detail
+ ///
+ public class RestorePlanDetailInfo
+ {
+ ///
+ /// The name of the option from RestoreOptionsHelper
+ ///
+ public string Name { get; set; }
+
+ ///
+ /// The current value of the option
+ ///
+ public object CurrentValue { get; set; }
+
+ ///
+ /// Indicates whether the option is read only or can be changed in client
+ ///
+ public bool IsReadOnly { get; set; }
+
+ ///
+ /// Indicates whether the option should be visibile in client
+ ///
+ public bool IsVisiable { get; set; }
+
+ ///
+ /// The default value of the option
+ ///
+ public object DefaultValue { get; set; }
+
+ internal static RestorePlanDetailInfo Create(string name, object currentValue, bool isReadOnly = false, bool isVisible = true, object defaultValue = null)
+ {
+ return new RestorePlanDetailInfo
+ {
+ CurrentValue = currentValue,
+ IsReadOnly = isReadOnly,
+ Name = name,
+ IsVisiable = isVisible,
+ DefaultValue = defaultValue
+ };
+ }
+ }
+
+
+}
diff --git a/src/Microsoft.SqlTools.ServiceLayer/DisasterRecovery/Contracts/RestorePlanRequest.cs b/src/Microsoft.SqlTools.ServiceLayer/DisasterRecovery/Contracts/RestorePlanRequest.cs
new file mode 100644
index 00000000..b7987407
--- /dev/null
+++ b/src/Microsoft.SqlTools.ServiceLayer/DisasterRecovery/Contracts/RestorePlanRequest.cs
@@ -0,0 +1,90 @@
+//
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+//
+
+using System.Collections.Generic;
+using Microsoft.SqlTools.Hosting.Protocol.Contracts;
+
+namespace Microsoft.SqlTools.ServiceLayer.DisasterRecovery.Contracts
+{
+ ///
+ /// Database file info
+ ///
+ public class RestoreDatabaseFileInfo
+ {
+ ///
+ /// File type (Rows Data, Log ...)
+ ///
+ public string FileType { get; set; }
+
+ ///
+ /// Logical Name
+ ///
+ public string LogicalFileName { get; set; }
+
+ ///
+ /// Original location of the file to restore to
+ ///
+ public string OriginalFileName { get; set; }
+
+ ///
+ /// The file to restore to
+ ///
+ public string RestoreAsFileName { get; set; }
+ }
+
+ ///
+ /// Restore Plan Response
+ ///
+ public class RestorePlanResponse
+ {
+ ///
+ /// Restore session id, can be used in restore request to use an existing restore plan
+ ///
+ public string SessionId { get; set; }
+
+
+ ///
+ /// The list of backup sets to restore
+ ///
+ public DatabaseFileInfo[] BackupSetsToRestore { get; set; }
+
+ ///
+ /// Indicates whether the restore operation is supported
+ ///
+ public bool CanRestore { get; set; }
+
+ ///
+ /// Errors occurred while creating restore plan
+ ///
+ public string ErrorMessage { get; set; }
+
+ ///
+ /// The db files included in the backup file
+ ///
+ public IEnumerable DbFiles { get; set; }
+
+ ///
+ /// Database names extracted from backup sets
+ ///
+ public string[] DatabaseNamesFromBackupSets { get; set; }
+
+ ///
+ /// For testing purpose to verify the target database
+ ///
+ internal string DatabaseName { get; set; }
+
+ ///
+ /// Plan details
+ ///
+ public Dictionary PlanDetails { get; set; }
+ }
+
+ public class RestorePlanRequest
+ {
+ public static readonly
+ RequestType Type =
+ RequestType.Create("disasterrecovery/restoreplan");
+ }
+}
diff --git a/src/Microsoft.SqlTools.ServiceLayer/DisasterRecovery/Contracts/RestoreRequest.cs b/src/Microsoft.SqlTools.ServiceLayer/DisasterRecovery/Contracts/RestoreRequest.cs
index a3281333..2f376d1f 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/DisasterRecovery/Contracts/RestoreRequest.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/DisasterRecovery/Contracts/RestoreRequest.cs
@@ -3,113 +3,10 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
-using System.Collections.Generic;
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
-using Microsoft.SqlTools.ServiceLayer.Utility;
namespace Microsoft.SqlTools.ServiceLayer.DisasterRecovery.Contracts
{
- ///
- /// Restore request parameters
- ///
- public class RestoreParams : GeneralRequestDetails
- {
- ///
- /// Restore session id. The parameter is optional and if passed, an existing plan will be used
- ///
- internal string SessionId
- {
- get
- {
- return GetOptionValue(RestoreOptionsHelper.SessionId);
- }
- set
- {
- SetOptionValue(RestoreOptionsHelper.SessionId, value);
- }
- }
-
- ///
- /// The Uri to find the connection to do the restore operations
- ///
- public string OwnerUri { get; set; }
-
- ///
- /// Comma delimited list of backup files
- ///
- internal string BackupFilePaths
- {
- get
- {
- return GetOptionValue(RestoreOptionsHelper.BackupFilePaths);
- }
- set
- {
- SetOptionValue(RestoreOptionsHelper.BackupFilePaths, value);
- }
- }
-
- ///
- /// Target Database name to restore to
- ///
- internal string TargetDatabaseName
- {
- get
- {
- return GetOptionValue(RestoreOptionsHelper.TargetDatabaseName);
- }
- set
- {
- SetOptionValue(RestoreOptionsHelper.TargetDatabaseName, value);
- }
- }
-
- ///
- /// Source Database name to restore from
- ///
- internal string SourceDatabaseName
- {
- get
- {
- return GetOptionValue(RestoreOptionsHelper.SourceDatabaseName);
- }
- set
- {
- SetOptionValue(RestoreOptionsHelper.SourceDatabaseName, value);
- }
- }
-
- ///
- /// If set to true, the db files will be relocated to default data location in the server
- ///
- internal bool RelocateDbFiles
- {
- get
- {
- return GetOptionValue(RestoreOptionsHelper.RelocateDbFiles);
- }
- set
- {
- SetOptionValue(RestoreOptionsHelper.RelocateDbFiles, value);
- }
- }
-
- ///
- /// Ids of the backup set to restore
- ///
- internal string[] SelectedBackupSets
- {
- get
- {
- return GetOptionValue(RestoreOptionsHelper.SelectedBackupSets);
- }
- set
- {
- SetOptionValue(RestoreOptionsHelper.SelectedBackupSets, value);
- }
- }
- }
-
///
/// Restore response
///
@@ -132,78 +29,7 @@ namespace Microsoft.SqlTools.ServiceLayer.DisasterRecovery.Contracts
public string ErrorMessage { get; set; }
}
- ///
- /// Database file info
- ///
- public class RestoreDatabaseFileInfo
- {
- ///
- /// File type (Rows Data, Log ...)
- ///
- public string FileType { get; set; }
-
- ///
- /// Logical Name
- ///
- public string LogicalFileName { get; set; }
-
- ///
- /// Original location of the file to restore to
- ///
- public string OriginalFileName { get; set; }
-
- ///
- /// The file to restore to
- ///
- public string RestoreAsFileName { get; set; }
- }
-
- ///
- /// Restore Plan Response
- ///
- public class RestorePlanResponse
- {
- ///
- /// Restore session id, can be used in restore request to use an existing restore plan
- ///
- public string SessionId { get; set; }
-
-
- ///
- /// The list of backup sets to restore
- ///
- public DatabaseFileInfo[] BackupSetsToRestore { get; set; }
-
- ///
- /// Indicates whether the restore operation is supported
- ///
- public bool CanRestore { get; set; }
-
- ///
- /// Errors occurred while creating restore plan
- ///
- public string ErrorMessage { get; set; }
-
- ///
- /// The db files included in the backup file
- ///
- public IEnumerable DbFiles { get; set; }
-
- ///
- /// Database names extracted from backup sets
- ///
- public string[] DatabaseNamesFromBackupSets { get; set; }
-
- ///
- /// For testing purpose to verify the target database
- ///
- internal string DatabaseName { get; set; }
-
- ///
- /// Plan details
- ///
- public Dictionary PlanDetails { get; set; }
- }
+
public class RestoreRequest
{
@@ -212,10 +38,5 @@ namespace Microsoft.SqlTools.ServiceLayer.DisasterRecovery.Contracts
RequestType.Create("disasterrecovery/restore");
}
- public class RestorePlanRequest
- {
- public static readonly
- RequestType Type =
- RequestType.Create("disasterrecovery/restoreplan");
- }
+
}
diff --git a/src/Microsoft.SqlTools.ServiceLayer/DisasterRecovery/Contracts/RestoreRequestParams.cs b/src/Microsoft.SqlTools.ServiceLayer/DisasterRecovery/Contracts/RestoreRequestParams.cs
new file mode 100644
index 00000000..b761ced1
--- /dev/null
+++ b/src/Microsoft.SqlTools.ServiceLayer/DisasterRecovery/Contracts/RestoreRequestParams.cs
@@ -0,0 +1,145 @@
+//
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+//
+
+using System.Collections.Generic;
+using Microsoft.SqlTools.ServiceLayer.Utility;
+using Newtonsoft.Json.Linq;
+
+namespace Microsoft.SqlTools.ServiceLayer.DisasterRecovery.Contracts
+{
+ ///
+ /// Restore request parameters
+ ///
+ public class RestoreParams : GeneralRequestDetails
+ {
+ ///
+ /// Restore session id. The parameter is optional and if passed, an existing plan will be used
+ ///
+ internal string SessionId
+ {
+ get
+ {
+ return GetOptionValue(RestoreOptionsHelper.SessionId);
+ }
+ set
+ {
+ SetOptionValue(RestoreOptionsHelper.SessionId, value);
+ }
+ }
+
+ ///
+ /// The Uri to find the connection to do the restore operations
+ ///
+ public string OwnerUri { get; set; }
+
+ ///
+ /// Comma delimited list of backup files
+ ///
+ internal string BackupFilePaths
+ {
+ get
+ {
+ return GetOptionValue(RestoreOptionsHelper.BackupFilePaths);
+ }
+ set
+ {
+ SetOptionValue(RestoreOptionsHelper.BackupFilePaths, value);
+ }
+ }
+
+ ///
+ /// Target Database name to restore to
+ ///
+ internal string TargetDatabaseName
+ {
+ get
+ {
+ return GetOptionValue(RestoreOptionsHelper.TargetDatabaseName);
+ }
+ set
+ {
+ SetOptionValue(RestoreOptionsHelper.TargetDatabaseName, value);
+ }
+ }
+
+ ///
+ /// Source Database name to restore from
+ ///
+ internal string SourceDatabaseName
+ {
+ get
+ {
+ return GetOptionValue(RestoreOptionsHelper.SourceDatabaseName);
+ }
+ set
+ {
+ SetOptionValue(RestoreOptionsHelper.SourceDatabaseName, value);
+ }
+ }
+
+ ///
+ /// If set to true, the db files will be relocated to default data location in the server
+ ///
+ internal bool RelocateDbFiles
+ {
+ get
+ {
+ return GetOptionValue(RestoreOptionsHelper.RelocateDbFiles);
+ }
+ set
+ {
+ SetOptionValue(RestoreOptionsHelper.RelocateDbFiles, value);
+ }
+ }
+
+ ///
+ /// If set to true, the backup files will be used to create restore plan otehrwise the source database name will be used
+ ///
+ internal bool ReadHeaderFromMedia
+ {
+ get
+ {
+ //Default is true for now for backward compatibility
+ return Options.ContainsKey(RestoreOptionsHelper.ReadHeaderFromMedia) ? GetOptionValue(RestoreOptionsHelper.ReadHeaderFromMedia) : true;
+ }
+ set
+ {
+ SetOptionValue(RestoreOptionsHelper.ReadHeaderFromMedia, value);
+ }
+ }
+
+ ///
+ /// Ids of the selected backup set to restore. If null, all backup sets will be selected. If empty list,
+ /// no backup sets will be selected
+ ///
+ internal IEnumerable SelectedBackupSets
+ {
+ get
+ {
+ var selectedBackupSets = GetOptionValue