diff --git a/setup/azurecmdfiles.wxi b/setup/azurecmdfiles.wxi index 9cc07e911733..08a8009a019f 100644 --- a/setup/azurecmdfiles.wxi +++ b/setup/azurecmdfiles.wxi @@ -2002,9 +2002,6 @@ - - - @@ -5717,7 +5714,6 @@ - diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Commands.RecoveryServices.Backup.Helpers.csproj b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Commands.RecoveryServices.Backup.Helpers.csproj index b38be2e5f402..40ebf1109649 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Commands.RecoveryServices.Backup.Helpers.csproj +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Commands.RecoveryServices.Backup.Helpers.csproj @@ -36,7 +36,7 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - + False ..\..\..\packages\Microsoft.Azure.Management.RecoveryServices.Backup.0.1.0-preview\lib\net40\Microsoft.Azure.Management.RecoveryServices.Backup.dll @@ -52,12 +52,12 @@ - + - + @@ -65,10 +65,6 @@ {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common - - {b758fec1-35c1-4f93-a954-66dd33f6e0ec} - Commands.RecoveryServices.Backup.HydraAdapter - {5e675749-6139-464a-904c-59c0ffdfec82} Commands.RecoveryServices.Backup.Logger diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Conversions/ConversionHelpers.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Conversions/ConversionHelpers.cs index 74c582766393..49629494ae96 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Conversions/ConversionHelpers.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Conversions/ConversionHelpers.cs @@ -19,25 +19,25 @@ using System.Threading.Tasks; using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models; using Microsoft.Azure.Commands.RecoveryServices.Backup.Properties; -using Microsoft.Azure.Management.RecoveryServices.Backup.Models; +using ServiceClientModel = Microsoft.Azure.Management.RecoveryServices.Backup.Models; namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Helpers { public class ConversionHelpers { #region containers - public static AzureRmRecoveryServicesBackupContainerBase GetContainerModel(ProtectionContainerResource protectionContainer) + public static ContainerBase GetContainerModel(ServiceClientModel.ProtectionContainerResource protectionContainer) { - AzureRmRecoveryServicesBackupContainerBase containerModel = null; + ContainerBase containerModel = null; if (protectionContainer != null && protectionContainer.Properties != null) { - if (protectionContainer.Properties.GetType().IsSubclassOf(typeof(AzureIaaSVMProtectionContainer))) + if (protectionContainer.Properties.GetType().IsSubclassOf(typeof(ServiceClientModel.AzureIaaSVMProtectionContainer))) { - containerModel = new AzureRmRecoveryServicesBackupIaasVmContainer(protectionContainer); + containerModel = new AzureVmContainer(protectionContainer); } - if (protectionContainer.Properties.GetType() == typeof(MabProtectionContainer)) + if (protectionContainer.Properties.GetType() == typeof(ServiceClientModel.MabProtectionContainer)) { containerModel = new AzureRmRecoveryServicesBackupMabContainer(protectionContainer); } @@ -46,18 +46,18 @@ public static AzureRmRecoveryServicesBackupContainerBase GetContainerModel(Prote return containerModel; } - public static AzureRmRecoveryServicesBackupEngineBase GetBackupEngineModel(BackupEngineResource backupEngine) + public static BackupEngineBase GetBackupEngineModel(ServiceClientModel.BackupEngineResource backupEngine) { - AzureRmRecoveryServicesBackupEngineBase backupEngineModel = null; + BackupEngineBase backupEngineModel = null; if (backupEngine != null && backupEngine.Properties != null) { - if (backupEngine.Properties.GetType() == (typeof(DpmBackupEngine))) + if (backupEngine.Properties.GetType() == (typeof(ServiceClientModel.DpmBackupEngine))) { - backupEngineModel = new AzureRmRecoveryServicesBackupDpmBackupEngine(backupEngine); + backupEngineModel = new DpmBackupEngine(backupEngine); } - else if (backupEngine.Properties.GetType() == (typeof(AzureBackupServerEngine))) + else if (backupEngine.Properties.GetType() == (typeof(ServiceClientModel.AzureBackupServerEngine))) { backupEngineModel = new AzureRmRecoveryServicesBackupAzureBackupServerEngine(backupEngine); } @@ -66,9 +66,9 @@ public static AzureRmRecoveryServicesBackupEngineBase GetBackupEngineModel(Backu return backupEngineModel; } - public static List GetContainerModelList(IEnumerable protectionContainers) + public static List GetContainerModelList(IEnumerable protectionContainers) { - List containerModels = new List(); + List containerModels = new List(); foreach (var protectionContainer in protectionContainers) { @@ -78,9 +78,9 @@ public static List GetContainerModel return containerModels; } - public static List GetBackupEngineModelList(IEnumerable backupEngines) + public static List GetBackupEngineModelList(IEnumerable backupEngines) { - List backupEngineModel = new List(); + List backupEngineModel = new List(); foreach (var backupEngine in backupEngines) { @@ -93,75 +93,75 @@ public static List GetBackupEngineModel #endregion #region policy - public static AzureRmRecoveryServicesBackupPolicyBase GetPolicyModel(ProtectionPolicyResource hydraResponse) + public static PolicyBase GetPolicyModel(ServiceClientModel.ProtectionPolicyResource serviceClientResponse) { - AzureRmRecoveryServicesBackupPolicyBase policyModel = null; + PolicyBase policyModel = null; - if (hydraResponse == null || hydraResponse.Properties == null) + if (serviceClientResponse == null || serviceClientResponse.Properties == null) { - Logger.Instance.WriteDebug("Policy Hydra response is Null/Empty"); - throw new ArgumentException(Resources.EmptyHydraResponseException); + Logger.Instance.WriteDebug("Policy Service Client response is Null/Empty"); + throw new ArgumentException(Resources.EmptyServiceClientResponseException); } - if (hydraResponse.Properties.GetType() == typeof(AzureIaaSVMProtectionPolicy)) + if (serviceClientResponse.Properties.GetType() == typeof(ServiceClientModel.AzureIaaSVMProtectionPolicy)) { - if (((AzureIaaSVMProtectionPolicy)hydraResponse.Properties).RetentionPolicy.GetType() != - typeof(LongTermRetentionPolicy)) + if (((ServiceClientModel.AzureIaaSVMProtectionPolicy)serviceClientResponse.Properties).RetentionPolicy.GetType() != + typeof(ServiceClientModel.LongTermRetentionPolicy)) { Logger.Instance.WriteDebug("Unknown RetentionPolicy object received: " + - ((AzureIaaSVMProtectionPolicy)hydraResponse.Properties).RetentionPolicy.GetType()); + ((ServiceClientModel.AzureIaaSVMProtectionPolicy)serviceClientResponse.Properties).RetentionPolicy.GetType()); Logger.Instance.WriteWarning(Resources.UpdateToNewAzurePowershellWarning); return null; } - if (((AzureIaaSVMProtectionPolicy)hydraResponse.Properties).SchedulePolicy.GetType() != - typeof(SimpleSchedulePolicy)) + if (((ServiceClientModel.AzureIaaSVMProtectionPolicy)serviceClientResponse.Properties).SchedulePolicy.GetType() != + typeof(ServiceClientModel.SimpleSchedulePolicy)) { Logger.Instance.WriteDebug("Unknown SchedulePolicy object received: " + - ((AzureIaaSVMProtectionPolicy)hydraResponse.Properties).SchedulePolicy.GetType()); + ((ServiceClientModel.AzureIaaSVMProtectionPolicy)serviceClientResponse.Properties).SchedulePolicy.GetType()); Logger.Instance.WriteWarning(Resources.UpdateToNewAzurePowershellWarning); return null; } - policyModel = new AzureRmRecoveryServicesBackupIaasVmPolicy(); - AzureRmRecoveryServicesBackupIaasVmPolicy iaasPolicyModel = policyModel as AzureRmRecoveryServicesBackupIaasVmPolicy; + policyModel = new AzureVmPolicy(); + AzureVmPolicy iaasPolicyModel = policyModel as AzureVmPolicy; iaasPolicyModel.WorkloadType = Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.WorkloadType.AzureVM; iaasPolicyModel.BackupManagementType = Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.BackupManagementType.AzureVM; - iaasPolicyModel.RetentionPolicy = PolicyHelpers.GetPSLongTermRetentionPolicy((LongTermRetentionPolicy) - ((AzureIaaSVMProtectionPolicy)hydraResponse.Properties).RetentionPolicy); - iaasPolicyModel.SchedulePolicy = PolicyHelpers.GetPSSimpleSchedulePolicy((SimpleSchedulePolicy) - ((AzureIaaSVMProtectionPolicy)hydraResponse.Properties).SchedulePolicy); + iaasPolicyModel.RetentionPolicy = PolicyHelpers.GetPSLongTermRetentionPolicy((ServiceClientModel.LongTermRetentionPolicy) + ((ServiceClientModel.AzureIaaSVMProtectionPolicy)serviceClientResponse.Properties).RetentionPolicy); + iaasPolicyModel.SchedulePolicy = PolicyHelpers.GetPSSimpleSchedulePolicy((ServiceClientModel.SimpleSchedulePolicy) + ((ServiceClientModel.AzureIaaSVMProtectionPolicy)serviceClientResponse.Properties).SchedulePolicy); } else { // we will enter this case when service supports new workload and customer // still using old version of azure powershell. Trace warning message, ignore and return Logger.Instance.WriteDebug("Unknown Policy object received: " + - hydraResponse.Properties.GetType()); + serviceClientResponse.Properties.GetType()); Logger.Instance.WriteWarning(Resources.UpdateToNewAzurePowershellWarning); return null; } - policyModel.Name = hydraResponse.Name; - policyModel.Id = hydraResponse.Id; + policyModel.Name = serviceClientResponse.Name; + policyModel.Id = serviceClientResponse.Id; return policyModel; } - public static List GetPolicyModelList( - ProtectionPolicyListResponse hydraListResponse) + public static List GetPolicyModelList( + ServiceClientModel.ProtectionPolicyListResponse serviceClientListResponse) { - if (hydraListResponse == null || hydraListResponse.ItemList == null || - hydraListResponse.ItemList.Value == null || hydraListResponse.ItemList.Value.Count == 0) + if (serviceClientListResponse == null || serviceClientListResponse.ItemList == null || + serviceClientListResponse.ItemList.Value == null || serviceClientListResponse.ItemList.Value.Count == 0) { Logger.Instance.WriteDebug("Received empty list of policies from service"); return null; } - List policyModels = new List(); - AzureRmRecoveryServicesBackupPolicyBase policyModel = null; + List policyModels = new List(); + PolicyBase policyModel = null; - foreach (ProtectionPolicyResource resource in hydraListResponse.ItemList.Value) + foreach (ServiceClientModel.ProtectionPolicyResource resource in serviceClientListResponse.ItemList.Value) { policyModel = GetPolicyModel(resource); if (policyModel != null) @@ -178,17 +178,17 @@ public static List GetPolicyModelList( #region Item - public static AzureRmRecoveryServicesBackupItemBase GetItemModel(ProtectedItemResource protectedItem) + public static ItemBase GetItemModel(ServiceClientModel.ProtectedItemResource protectedItem) { - AzureRmRecoveryServicesBackupItemBase itemModel = null; + ItemBase itemModel = null; if (protectedItem != null && protectedItem.Properties != null) { - if (protectedItem.Properties.GetType().IsSubclassOf(typeof(AzureIaaSVMProtectedItem))) + if (protectedItem.Properties.GetType().IsSubclassOf(typeof(ServiceClientModel.AzureIaaSVMProtectedItem))) { string policyName = null; - string policyId = ((AzureIaaSVMProtectedItem)protectedItem.Properties).PolicyId; + string policyId = ((ServiceClientModel.AzureIaaSVMProtectedItem)protectedItem.Properties).PolicyId; if (!string.IsNullOrEmpty(policyId)) { Dictionary keyValueDict = @@ -200,7 +200,7 @@ public static AzureRmRecoveryServicesBackupItemBase GetItemModel(ProtectedItemRe HelperUtils.ParseUri(protectedItem.Id), protectedItem.Id); - itemModel = new AzureRmRecoveryServicesBackupIaasVmItem( + itemModel = new AzureVmItem( protectedItem, IdUtils.GetNameFromUri(containerUri), Cmdlets.Models.ContainerType.AzureVM, @@ -211,9 +211,9 @@ public static AzureRmRecoveryServicesBackupItemBase GetItemModel(ProtectedItemRe return itemModel; } - public static List GetItemModelList(IEnumerable protectedItems) + public static List GetItemModelList(IEnumerable protectedItems) { - List itemModels = new List(); + List itemModels = new List(); foreach (var protectedItem in protectedItems) { diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Conversions/JobConversions.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Conversions/JobConversions.cs index 97ce98f5bccb..033fa2cafd76 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Conversions/JobConversions.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Conversions/JobConversions.cs @@ -22,45 +22,45 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Helpers { public class JobConversions { - #region Hydra to PS convertors + #region ServiceClient to PS convertors /// /// This function returns either job object or job details object based on - /// what hydra object contains. - /// To elaborate, if hydra job's ExtendedInfo is filled then this function will + /// what ServiceClient object contains. + /// To elaborate, if ServiceClient job's ExtendedInfo is filled then this function will /// return a job details object. Otherwise it will return a job object. /// - /// + /// /// - public static CmdletModel.AzureRmRecoveryServicesBackupJobBase GetPSJob(JobResponse hydraJob) + public static CmdletModel.JobBase GetPSJob(JobResponse serviceClientJob) { - return GetPSJob(hydraJob.Item); + return GetPSJob(serviceClientJob.Item); } - public static CmdletModel.AzureRmRecoveryServicesBackupJobBase GetPSJob(JobResource hydraJob) + public static CmdletModel.JobBase GetPSJob(JobResource serviceClientJob) { - CmdletModel.AzureRmRecoveryServicesBackupJobBase response = null; + CmdletModel.JobBase response = null; - // hydra doesn't initialize Properties if the type of job is not known to current version of hydra. - if (hydraJob.Properties == null) + // ServiceClient doesn't initialize Properties if the type of job is not known to current version of ServiceClient. + if (serviceClientJob.Properties == null) { Logger.Instance.WriteWarning(Resources.UnsupportedJobWarning); } - else if (hydraJob.Properties.GetType() == typeof(AzureIaaSVMJob)) + else if (serviceClientJob.Properties.GetType() == typeof(AzureIaaSVMJob)) { - response = GetPSAzureVmJob(hydraJob); + response = GetPSAzureVmJob(serviceClientJob); } return response; } - public static void AddHydraJobsToPSList(JobListResponse hydraJobs, List psJobs, ref int jobsCount) + public static void AddServiceClientJobsToPSList(JobListResponse serviceClientJobs, List psJobs, ref int jobsCount) { - if (hydraJobs.ItemList != null && hydraJobs.ItemList.Value != null) + if (serviceClientJobs.ItemList != null && serviceClientJobs.ItemList.Value != null) { - foreach (var job in hydraJobs.ItemList.Value) + foreach (var job in serviceClientJobs.ItemList.Value) { - CmdletModel.AzureRmRecoveryServicesBackupJobBase convertedJob = GetPSJob(job); + CmdletModel.JobBase convertedJob = GetPSJob(job); if (convertedJob != null) { jobsCount++; @@ -72,22 +72,22 @@ public static void AddHydraJobsToPSList(JobListResponse hydraJobs, List(); + response.ErrorDetails = new List(); foreach (var vmError in vmJob.ErrorDetails) { response.ErrorDetails.Add(GetPSAzureVmErrorInfo(vmError)); @@ -110,8 +110,8 @@ private static CmdletModel.AzureRmRecoveryServicesBackupAzureVmJob GetPSAzureVmJ // fill extended info if present if (vmJob.ExtendedInfo != null) { - CmdletModel.AzureRmRecoveryServicesBackupAzureVmJobDetails detailedResponse = - response as CmdletModel.AzureRmRecoveryServicesBackupAzureVmJobDetails; + CmdletModel.AzureVmJobDetails detailedResponse = + response as CmdletModel.AzureVmJobDetails; detailedResponse.DynamicErrorMessage = vmJob.ExtendedInfo.DynamicErrorMessage; if (vmJob.ExtendedInfo.PropertyBag != null) @@ -125,10 +125,10 @@ private static CmdletModel.AzureRmRecoveryServicesBackupAzureVmJob GetPSAzureVmJ if (vmJob.ExtendedInfo.TasksList != null) { - detailedResponse.SubTasks = new List(); + detailedResponse.SubTasks = new List(); foreach (var vmJobTask in vmJob.ExtendedInfo.TasksList) { - detailedResponse.SubTasks.Add(new CmdletModel.AzureRmRecoveryServicesBackupAzureVmJobSubTask() + detailedResponse.SubTasks.Add(new CmdletModel.AzureVmJobSubTask() { Name = vmJobTask.TaskId, Status = vmJobTask.Status @@ -140,15 +140,15 @@ private static CmdletModel.AzureRmRecoveryServicesBackupAzureVmJob GetPSAzureVmJ return response; } - private static CmdletModel.AzureRmRecoveryServicesBackupAzureVmJobErrorInfo GetPSAzureVmErrorInfo(AzureIaaSVMErrorInfo hydraError) + private static CmdletModel.AzureVmJobErrorInfo GetPSAzureVmErrorInfo(AzureIaaSVMErrorInfo serviceClientError) { - CmdletModel.AzureRmRecoveryServicesBackupAzureVmJobErrorInfo psErrorInfo = new CmdletModel.AzureRmRecoveryServicesBackupAzureVmJobErrorInfo(); - psErrorInfo.ErrorCode = hydraError.ErrorCode; - psErrorInfo.ErrorMessage = hydraError.ErrorString; - if (hydraError.Recommendations != null) + CmdletModel.AzureVmJobErrorInfo psErrorInfo = new CmdletModel.AzureVmJobErrorInfo(); + psErrorInfo.ErrorCode = serviceClientError.ErrorCode; + psErrorInfo.ErrorMessage = serviceClientError.ErrorString; + if (serviceClientError.Recommendations != null) { psErrorInfo.Recommendations = new List(); - psErrorInfo.Recommendations.AddRange(hydraError.Recommendations); + psErrorInfo.Recommendations.AddRange(serviceClientError.Recommendations); } return psErrorInfo; diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Conversions/RecoveryPointConversions.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Conversions/RecoveryPointConversions.cs index 1ecaf56f88a8..45da55f1b7e7 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Conversions/RecoveryPointConversions.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Conversions/RecoveryPointConversions.cs @@ -13,7 +13,7 @@ // ---------------------------------------------------------------------------------- using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models; -using Microsoft.Azure.Management.RecoveryServices.Backup.Models; +using ServiceClientModel = Microsoft.Azure.Management.RecoveryServices.Backup.Models; using System; using System.Collections.Generic; using Microsoft.Azure.Commands.RecoveryServices.Backup.Properties; @@ -23,7 +23,7 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Helpers { public class RecoveryPointConversions { - public static List GetPSAzureRecoveryPoints(RecoveryPointListResponse rpList, AzureRmRecoveryServicesBackupIaasVmItem item) + public static List GetPSAzureRecoveryPoints(ServiceClientModel.RecoveryPointListResponse rpList, AzureVmItem item) { if (rpList == null || rpList.RecoveryPointList == null || rpList.RecoveryPointList.RecoveryPoints == null) { @@ -34,13 +34,13 @@ public static List GetPSAzureRec string containerUri = HelperUtils.GetContainerUri(uriDict, item.Id); string protectedItemName = HelperUtils.GetProtectedItemUri(uriDict, item.Id); - List result = new List(); - foreach (RecoveryPointResource rp in rpList.RecoveryPointList.RecoveryPoints) + List result = new List(); + foreach (ServiceClientModel.RecoveryPointResource rp in rpList.RecoveryPointList.RecoveryPoints) { - RecoveryPoint recPoint = rp.Properties as RecoveryPoint; + ServiceClientModel.RecoveryPoint recPoint = rp.Properties as ServiceClientModel.RecoveryPoint; DateTime recPointTime = DateTime.ParseExact(recPoint.RecoveryPointTime, @"MM/dd/yyyy HH:mm:ss", CultureInfo.InvariantCulture); - AzureRmRecoveryServicesBackupIaasVmRecoveryPoint rpBase = new AzureRmRecoveryServicesBackupIaasVmRecoveryPoint() + AzureVmRecoveryPoint rpBase = new AzureVmRecoveryPoint() { RecoveryPointId = rp.Name, BackupManagementType = item.BackupManagementType, @@ -60,20 +60,20 @@ public static List GetPSAzureRec return result; } - public static AzureRmRecoveryServicesBackupRecoveryPointBase GetPSAzureRecoveryPoints(RecoveryPointResponse rpResponse, AzureRmRecoveryServicesBackupIaasVmItem item) + public static RecoveryPointBase GetPSAzureRecoveryPoints(ServiceClientModel.RecoveryPointResponse rpResponse, AzureVmItem item) { if (rpResponse == null || rpResponse.RecPoint == null) { throw new ArgumentNullException(Resources.GetRPResponseIsNull); } - RecoveryPoint recPoint = rpResponse.RecPoint.Properties as RecoveryPoint; + ServiceClientModel.RecoveryPoint recPoint = rpResponse.RecPoint.Properties as ServiceClientModel.RecoveryPoint; Dictionary uriDict = HelperUtils.ParseUri(item.Id); string containerUri = HelperUtils.GetContainerUri(uriDict, item.Id); string protectedItemName = HelperUtils.GetProtectedItemUri(uriDict, item.Id); DateTime recPointTime = DateTime.ParseExact(recPoint.RecoveryPointTime, @"MM/dd/yyyy HH:mm:ss", CultureInfo.InvariantCulture); - AzureRmRecoveryServicesBackupIaasVmRecoveryPoint result = new AzureRmRecoveryServicesBackupIaasVmRecoveryPoint() + AzureVmRecoveryPoint result = new AzureVmRecoveryPoint() { RecoveryPointId = rpResponse.RecPoint.Name, BackupManagementType = item.BackupManagementType, diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Conversions/RetentionPolicyConversions.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Conversions/RetentionPolicyConversions.cs index 19daca50d062..e18a054362d4 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Conversions/RetentionPolicyConversions.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Conversions/RetentionPolicyConversions.cs @@ -18,48 +18,48 @@ using System.Threading.Tasks; using System.Collections.Generic; using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models; -using HydraModels = Microsoft.Azure.Management.RecoveryServices.Backup.Models; +using ServiceClientModel = Microsoft.Azure.Management.RecoveryServices.Backup.Models; using Microsoft.Azure.Commands.RecoveryServices.Backup.Properties; namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Helpers { public partial class PolicyHelpers { - #region HydraToPSObject conversions + #region ServiceClientToPSObject conversions #region public - public static AzureRmRecoveryServicesBackupLongTermRetentionPolicy GetPSLongTermRetentionPolicy( - HydraModels.LongTermRetentionPolicy hydraRetPolicy) + public static LongTermRetentionPolicy GetPSLongTermRetentionPolicy( + ServiceClientModel.LongTermRetentionPolicy serviceClientRetPolicy) { - if(hydraRetPolicy == null) + if(serviceClientRetPolicy == null) { return null; } - AzureRmRecoveryServicesBackupLongTermRetentionPolicy ltrPolicy = new AzureRmRecoveryServicesBackupLongTermRetentionPolicy(); + LongTermRetentionPolicy ltrPolicy = new LongTermRetentionPolicy(); - if(hydraRetPolicy.DailySchedule != null) + if(serviceClientRetPolicy.DailySchedule != null) { ltrPolicy.IsDailyScheduleEnabled = true; - ltrPolicy.DailySchedule = GetPSLTRDailySchedule(hydraRetPolicy.DailySchedule); + ltrPolicy.DailySchedule = GetPSLTRDailySchedule(serviceClientRetPolicy.DailySchedule); } - if (hydraRetPolicy.WeeklySchedule != null) + if (serviceClientRetPolicy.WeeklySchedule != null) { ltrPolicy.IsWeeklyScheduleEnabled = true; - ltrPolicy.WeeklySchedule = GetPSLTRWeeklySchedule(hydraRetPolicy.WeeklySchedule); + ltrPolicy.WeeklySchedule = GetPSLTRWeeklySchedule(serviceClientRetPolicy.WeeklySchedule); } - if (hydraRetPolicy.MonthlySchedule != null) + if (serviceClientRetPolicy.MonthlySchedule != null) { ltrPolicy.IsMonthlyScheduleEnabled = true; - ltrPolicy.MonthlySchedule = GetPSLTRMonthlySchedule(hydraRetPolicy.MonthlySchedule); + ltrPolicy.MonthlySchedule = GetPSLTRMonthlySchedule(serviceClientRetPolicy.MonthlySchedule); } - if (hydraRetPolicy.YearlySchedule != null) + if (serviceClientRetPolicy.YearlySchedule != null) { ltrPolicy.IsYearlyScheduleEnabled = true; - ltrPolicy.YearlySchedule = GetPSLTRYearlySchedule(hydraRetPolicy.YearlySchedule); + ltrPolicy.YearlySchedule = GetPSLTRYearlySchedule(serviceClientRetPolicy.YearlySchedule); } // safe side validate @@ -68,8 +68,8 @@ public static AzureRmRecoveryServicesBackupLongTermRetentionPolicy GetPSLongTerm return ltrPolicy; } - public static AzureRmRecoveryServicesBackupLongTermRetentionPolicy GetPSSimpleRetentionPolicy( - HydraModels.SimpleRetentionPolicy hydraRetPolicy) + public static LongTermRetentionPolicy GetPSSimpleRetentionPolicy( + ServiceClientModel.SimpleRetentionPolicy serviceClientRetPolicy) { throw new NotSupportedException(); } @@ -78,25 +78,25 @@ public static AzureRmRecoveryServicesBackupLongTermRetentionPolicy GetPSSimpleRe #region private - private static int GetRetentionDurationInDays(HydraModels.RetentionDuration retentionDuration) + private static int GetRetentionDurationInDays(ServiceClientModel.RetentionDuration retentionDuration) { int daysCount = 0; switch (retentionDuration.DurationType) { - case HydraModels.RetentionDurationType.Days: + case ServiceClientModel.RetentionDurationType.Days: daysCount = retentionDuration.Count; break; - case HydraModels.RetentionDurationType.Weeks: + case ServiceClientModel.RetentionDurationType.Weeks: daysCount = retentionDuration.Count * PolicyConstants.NumOfDaysInWeek; break; - case HydraModels.RetentionDurationType.Months: + case ServiceClientModel.RetentionDurationType.Months: daysCount = retentionDuration.Count * PolicyConstants.NumOfDaysInMonth; break; - case HydraModels.RetentionDurationType.Years: + case ServiceClientModel.RetentionDurationType.Years: daysCount = retentionDuration.Count * PolicyConstants.NumOfDaysInYear; break; @@ -108,25 +108,25 @@ private static int GetRetentionDurationInDays(HydraModels.RetentionDuration rete return daysCount; } - private static int GetRetentionDurationInWeeks(HydraModels.RetentionDuration retentionDuration) + private static int GetRetentionDurationInWeeks(ServiceClientModel.RetentionDuration retentionDuration) { int weeksCount = 0; switch (retentionDuration.DurationType) { - case HydraModels.RetentionDurationType.Days: + case ServiceClientModel.RetentionDurationType.Days: weeksCount = retentionDuration.Count / PolicyConstants.NumOfDaysInWeek; break; - case HydraModels.RetentionDurationType.Weeks: + case ServiceClientModel.RetentionDurationType.Weeks: weeksCount = retentionDuration.Count; break; - case HydraModels.RetentionDurationType.Months: + case ServiceClientModel.RetentionDurationType.Months: weeksCount = retentionDuration.Count * PolicyConstants.NumOfWeeksInMonth; break; - case HydraModels.RetentionDurationType.Years: + case ServiceClientModel.RetentionDurationType.Years: weeksCount = retentionDuration.Count * PolicyConstants.NumOfWeeksInYear; break; @@ -138,25 +138,25 @@ private static int GetRetentionDurationInWeeks(HydraModels.RetentionDuration ret return weeksCount; } - private static int GetRetentionDurationInMonths(HydraModels.RetentionDuration retentionDuration) + private static int GetRetentionDurationInMonths(ServiceClientModel.RetentionDuration retentionDuration) { int monthsCount = 0; switch (retentionDuration.DurationType) { - case HydraModels.RetentionDurationType.Days: + case ServiceClientModel.RetentionDurationType.Days: monthsCount = retentionDuration.Count / PolicyConstants.NumOfDaysInMonth; break; - case HydraModels.RetentionDurationType.Weeks: + case ServiceClientModel.RetentionDurationType.Weeks: monthsCount = retentionDuration.Count / PolicyConstants.NumOfWeeksInMonth; break; - case HydraModels.RetentionDurationType.Months: + case ServiceClientModel.RetentionDurationType.Months: monthsCount = retentionDuration.Count; break; - case HydraModels.RetentionDurationType.Years: + case ServiceClientModel.RetentionDurationType.Years: monthsCount = retentionDuration.Count * PolicyConstants.NumOfMonthsInYear; break; @@ -168,25 +168,25 @@ private static int GetRetentionDurationInMonths(HydraModels.RetentionDuration re return monthsCount; } - private static int GetRetentionDurationInYears(HydraModels.RetentionDuration retentionDuration) + private static int GetRetentionDurationInYears(ServiceClientModel.RetentionDuration retentionDuration) { int yearsCount = 0; switch (retentionDuration.DurationType) { - case HydraModels.RetentionDurationType.Days: + case ServiceClientModel.RetentionDurationType.Days: yearsCount = retentionDuration.Count / PolicyConstants.NumOfDaysInYear; break; - case HydraModels.RetentionDurationType.Weeks: + case ServiceClientModel.RetentionDurationType.Weeks: yearsCount = retentionDuration.Count / PolicyConstants.NumOfWeeksInYear; break; - case HydraModels.RetentionDurationType.Months: + case ServiceClientModel.RetentionDurationType.Months: yearsCount = retentionDuration.Count / PolicyConstants.NumOfMonthsInYear; break; - case HydraModels.RetentionDurationType.Years: + case ServiceClientModel.RetentionDurationType.Years: yearsCount = retentionDuration.Count; break; @@ -198,96 +198,96 @@ private static int GetRetentionDurationInYears(HydraModels.RetentionDuration ret return yearsCount; } - private static DailyRetentionSchedule GetPSLTRDailySchedule(HydraModels.DailyRetentionSchedule hydraDaily) + private static DailyRetentionSchedule GetPSLTRDailySchedule(ServiceClientModel.DailyRetentionSchedule serviceClientDaily) { - if(hydraDaily == null) + if(serviceClientDaily == null) { return null; } DailyRetentionSchedule psDaily = new DailyRetentionSchedule(); - psDaily.DurationCountInDays = GetRetentionDurationInDays(hydraDaily.RetentionDuration); - psDaily.RetentionTimes = ParseDateTimesToUTC(hydraDaily.RetentionTimes); + psDaily.DurationCountInDays = GetRetentionDurationInDays(serviceClientDaily.RetentionDuration); + psDaily.RetentionTimes = ParseDateTimesToUTC(serviceClientDaily.RetentionTimes); return psDaily; } - private static WeeklyRetentionSchedule GetPSLTRWeeklySchedule(HydraModels.WeeklyRetentionSchedule hydraWeekly) + private static WeeklyRetentionSchedule GetPSLTRWeeklySchedule(ServiceClientModel.WeeklyRetentionSchedule serviceClientWeekly) { - if (hydraWeekly == null) + if (serviceClientWeekly == null) { return null; } WeeklyRetentionSchedule psWeekly = new WeeklyRetentionSchedule(); - psWeekly.DurationCountInWeeks = GetRetentionDurationInWeeks(hydraWeekly.RetentionDuration); - psWeekly.RetentionTimes = ParseDateTimesToUTC(hydraWeekly.RetentionTimes); - psWeekly.DaysOfTheWeek = HelperUtils.GetEnumListFromStringList(hydraWeekly.DaysOfTheWeek); + psWeekly.DurationCountInWeeks = GetRetentionDurationInWeeks(serviceClientWeekly.RetentionDuration); + psWeekly.RetentionTimes = ParseDateTimesToUTC(serviceClientWeekly.RetentionTimes); + psWeekly.DaysOfTheWeek = HelperUtils.GetEnumListFromStringList(serviceClientWeekly.DaysOfTheWeek); return psWeekly; } - private static MonthlyRetentionSchedule GetPSLTRMonthlySchedule(HydraModels.MonthlyRetentionSchedule hydraMonthly) + private static MonthlyRetentionSchedule GetPSLTRMonthlySchedule(ServiceClientModel.MonthlyRetentionSchedule serviceClientMonthly) { - if (hydraMonthly == null) + if (serviceClientMonthly == null) { return null; } MonthlyRetentionSchedule psMonthly = new MonthlyRetentionSchedule(); - psMonthly.DurationCountInMonths = GetRetentionDurationInMonths(hydraMonthly.RetentionDuration); - psMonthly.RetentionTimes = ParseDateTimesToUTC(hydraMonthly.RetentionTimes); + psMonthly.DurationCountInMonths = GetRetentionDurationInMonths(serviceClientMonthly.RetentionDuration); + psMonthly.RetentionTimes = ParseDateTimesToUTC(serviceClientMonthly.RetentionTimes); psMonthly.RetentionScheduleFormatType = (RetentionScheduleFormat)Enum.Parse(typeof(RetentionScheduleFormat), - hydraMonthly.RetentionScheduleFormatType); - psMonthly.RetentionScheduleDaily = GetPSLTRDailyRetentionFormat(hydraMonthly.RetentionScheduleDaily); - psMonthly.RetentionScheduleWeekly = GetPSLTRWeeklyRetentionFormat(hydraMonthly.RetentionScheduleWeekly); + serviceClientMonthly.RetentionScheduleFormatType); + psMonthly.RetentionScheduleDaily = GetPSLTRDailyRetentionFormat(serviceClientMonthly.RetentionScheduleDaily); + psMonthly.RetentionScheduleWeekly = GetPSLTRWeeklyRetentionFormat(serviceClientMonthly.RetentionScheduleWeekly); return psMonthly; } - private static YearlyRetentionSchedule GetPSLTRYearlySchedule(HydraModels.YearlyRetentionSchedule hydraYearly) + private static YearlyRetentionSchedule GetPSLTRYearlySchedule(ServiceClientModel.YearlyRetentionSchedule serviceClientYearly) { - if (hydraYearly == null) + if (serviceClientYearly == null) { return null; } YearlyRetentionSchedule psYearly = new YearlyRetentionSchedule(); - psYearly.DurationCountInYears = GetRetentionDurationInYears(hydraYearly.RetentionDuration); - psYearly.RetentionTimes = ParseDateTimesToUTC(hydraYearly.RetentionTimes); + psYearly.DurationCountInYears = GetRetentionDurationInYears(serviceClientYearly.RetentionDuration); + psYearly.RetentionTimes = ParseDateTimesToUTC(serviceClientYearly.RetentionTimes); psYearly.RetentionScheduleFormatType = (RetentionScheduleFormat)Enum.Parse(typeof(RetentionScheduleFormat), - hydraYearly.RetentionScheduleFormatType); - psYearly.RetentionScheduleDaily = GetPSLTRDailyRetentionFormat(hydraYearly.RetentionScheduleDaily); - psYearly.RetentionScheduleWeekly = GetPSLTRWeeklyRetentionFormat(hydraYearly.RetentionScheduleWeekly); - psYearly.MonthsOfYear = HelperUtils.GetEnumListFromStringList(hydraYearly.MonthsOfYear); + serviceClientYearly.RetentionScheduleFormatType); + psYearly.RetentionScheduleDaily = GetPSLTRDailyRetentionFormat(serviceClientYearly.RetentionScheduleDaily); + psYearly.RetentionScheduleWeekly = GetPSLTRWeeklyRetentionFormat(serviceClientYearly.RetentionScheduleWeekly); + psYearly.MonthsOfYear = HelperUtils.GetEnumListFromStringList(serviceClientYearly.MonthsOfYear); return psYearly; } private static DailyRetentionFormat GetPSLTRDailyRetentionFormat( - HydraModels.DailyRetentionFormat hydraFormat) + ServiceClientModel.DailyRetentionFormat serviceClientFormat) { - if (hydraFormat == null) + if (serviceClientFormat == null) { return null; } DailyRetentionFormat psFormat = new DailyRetentionFormat(); - if (hydraFormat.DaysOfTheMonth != null) + if (serviceClientFormat.DaysOfTheMonth != null) { psFormat.DaysOfTheMonth = new List(); - foreach (HydraModels.Day hydraDay in hydraFormat.DaysOfTheMonth) + foreach (ServiceClientModel.Day serviceClientDay in serviceClientFormat.DaysOfTheMonth) { Day psDay = new Day() { - Date = hydraDay.Date, - IsLast = hydraDay.IsLast + Date = serviceClientDay.Date, + IsLast = serviceClientDay.IsLast }; psFormat.DaysOfTheMonth.Add(psDay); @@ -298,21 +298,21 @@ private static DailyRetentionFormat GetPSLTRDailyRetentionFormat( } private static WeeklyRetentionFormat GetPSLTRWeeklyRetentionFormat( - HydraModels.WeeklyRetentionFormat hydraFormat) + ServiceClientModel.WeeklyRetentionFormat serviceClientFormat) { - if (hydraFormat == null) + if (serviceClientFormat == null) { return null; } WeeklyRetentionFormat psFormat = new WeeklyRetentionFormat(); - if (hydraFormat.DaysOfTheWeek != null) + if (serviceClientFormat.DaysOfTheWeek != null) { - psFormat.DaysOfTheWeek = HelperUtils.GetEnumListFromStringList(hydraFormat.DaysOfTheWeek); + psFormat.DaysOfTheWeek = HelperUtils.GetEnumListFromStringList(serviceClientFormat.DaysOfTheWeek); } - if (hydraFormat.WeeksOfTheMonth != null) + if (serviceClientFormat.WeeksOfTheMonth != null) { - psFormat.WeeksOfTheMonth = HelperUtils.GetEnumListFromStringList(hydraFormat.WeeksOfTheMonth); + psFormat.WeeksOfTheMonth = HelperUtils.GetEnumListFromStringList(serviceClientFormat.WeeksOfTheMonth); } return psFormat; @@ -322,147 +322,147 @@ private static WeeklyRetentionFormat GetPSLTRWeeklyRetentionFormat( #endregion - #region PStoHydraObject conversions - public static HydraModels.LongTermRetentionPolicy GetHydraLongTermRetentionPolicy( - AzureRmRecoveryServicesBackupLongTermRetentionPolicy psRetPolicy) + #region PStoServiceClientObject conversions + public static ServiceClientModel.LongTermRetentionPolicy GetServiceClientLongTermRetentionPolicy( + LongTermRetentionPolicy psRetPolicy) { if(psRetPolicy == null) { return null; } - HydraModels.LongTermRetentionPolicy hydraRetPolicy = new HydraModels.LongTermRetentionPolicy(); + ServiceClientModel.LongTermRetentionPolicy serviceClientRetPolicy = new ServiceClientModel.LongTermRetentionPolicy(); if(psRetPolicy.IsDailyScheduleEnabled) { - hydraRetPolicy.DailySchedule = GetHydraLTRDailySchedule(psRetPolicy.DailySchedule); + serviceClientRetPolicy.DailySchedule = GetServiceClientLTRDailySchedule(psRetPolicy.DailySchedule); } if (psRetPolicy.IsWeeklyScheduleEnabled) { - hydraRetPolicy.WeeklySchedule = GetHydraLTRWeeklySchedule(psRetPolicy.WeeklySchedule); + serviceClientRetPolicy.WeeklySchedule = GetServiceClientLTRWeeklySchedule(psRetPolicy.WeeklySchedule); } if (psRetPolicy.IsMonthlyScheduleEnabled) { - hydraRetPolicy.MonthlySchedule = GetHydraLTRMonthlySchedule(psRetPolicy.MonthlySchedule); + serviceClientRetPolicy.MonthlySchedule = GetServiceClientLTRMonthlySchedule(psRetPolicy.MonthlySchedule); } if (psRetPolicy.IsYearlyScheduleEnabled) { - hydraRetPolicy.YearlySchedule = GetHydraLTRYearlySchedule(psRetPolicy.YearlySchedule); + serviceClientRetPolicy.YearlySchedule = GetServiceClientLTRYearlySchedule(psRetPolicy.YearlySchedule); } - return hydraRetPolicy; + return serviceClientRetPolicy; } - public static HydraModels.SimpleRetentionPolicy GetHydraSimpleRetentionPolicy( - AzureRmRecoveryServicesBackupSimpleSchedulePolicy psRetPolicy) + public static ServiceClientModel.SimpleRetentionPolicy GetServiceClientSimpleRetentionPolicy( + SimpleSchedulePolicy psRetPolicy) { throw new NotSupportedException(); } #region private - private static HydraModels.DailyRetentionSchedule GetHydraLTRDailySchedule(DailyRetentionSchedule psDaily) + private static ServiceClientModel.DailyRetentionSchedule GetServiceClientLTRDailySchedule(DailyRetentionSchedule psDaily) { if (psDaily == null) { return null; } - HydraModels.DailyRetentionSchedule hydraDaily = new HydraModels.DailyRetentionSchedule(); + ServiceClientModel.DailyRetentionSchedule serviceClientDaily = new ServiceClientModel.DailyRetentionSchedule(); - hydraDaily.RetentionDuration = new HydraModels.RetentionDuration() + serviceClientDaily.RetentionDuration = new ServiceClientModel.RetentionDuration() { Count = psDaily.DurationCountInDays, - DurationType = HydraModels.RetentionDurationType.Days + DurationType = ServiceClientModel.RetentionDurationType.Days }; - hydraDaily.RetentionTimes = psDaily.RetentionTimes; + serviceClientDaily.RetentionTimes = psDaily.RetentionTimes; - return hydraDaily; + return serviceClientDaily; } - private static HydraModels.WeeklyRetentionSchedule GetHydraLTRWeeklySchedule(WeeklyRetentionSchedule psWeekly) + private static ServiceClientModel.WeeklyRetentionSchedule GetServiceClientLTRWeeklySchedule(WeeklyRetentionSchedule psWeekly) { if (psWeekly == null) { return null; } - HydraModels.WeeklyRetentionSchedule hydraWeekly = new HydraModels.WeeklyRetentionSchedule(); + ServiceClientModel.WeeklyRetentionSchedule serviceClientWeekly = new ServiceClientModel.WeeklyRetentionSchedule(); - hydraWeekly.RetentionDuration = new HydraModels.RetentionDuration() + serviceClientWeekly.RetentionDuration = new ServiceClientModel.RetentionDuration() { Count = psWeekly.DurationCountInWeeks, - DurationType = HydraModels.RetentionDurationType.Weeks + DurationType = ServiceClientModel.RetentionDurationType.Weeks }; - hydraWeekly.RetentionTimes = psWeekly.RetentionTimes; - hydraWeekly.DaysOfTheWeek = HelperUtils.GetStringListFromEnumList(psWeekly.DaysOfTheWeek); + serviceClientWeekly.RetentionTimes = psWeekly.RetentionTimes; + serviceClientWeekly.DaysOfTheWeek = HelperUtils.GetStringListFromEnumList(psWeekly.DaysOfTheWeek); - return hydraWeekly; + return serviceClientWeekly; } - private static HydraModels.MonthlyRetentionSchedule GetHydraLTRMonthlySchedule(MonthlyRetentionSchedule psMonthly) + private static ServiceClientModel.MonthlyRetentionSchedule GetServiceClientLTRMonthlySchedule(MonthlyRetentionSchedule psMonthly) { if (psMonthly == null) { return null; } - HydraModels.MonthlyRetentionSchedule hydraMonthly = new HydraModels.MonthlyRetentionSchedule(); + ServiceClientModel.MonthlyRetentionSchedule serviceClientMonthly = new ServiceClientModel.MonthlyRetentionSchedule(); - hydraMonthly.RetentionDuration = new HydraModels.RetentionDuration() + serviceClientMonthly.RetentionDuration = new ServiceClientModel.RetentionDuration() { Count = psMonthly.DurationCountInMonths, - DurationType = HydraModels.RetentionDurationType.Months + DurationType = ServiceClientModel.RetentionDurationType.Months }; - hydraMonthly.RetentionTimes = psMonthly.RetentionTimes; + serviceClientMonthly.RetentionTimes = psMonthly.RetentionTimes; - hydraMonthly.RetentionScheduleFormatType = psMonthly.RetentionScheduleFormatType.ToString(); + serviceClientMonthly.RetentionScheduleFormatType = psMonthly.RetentionScheduleFormatType.ToString(); if (psMonthly.RetentionScheduleFormatType == RetentionScheduleFormat.Daily) { - hydraMonthly.RetentionScheduleDaily = GetHydraLTRDailyRetentionFormat(psMonthly.RetentionScheduleDaily); + serviceClientMonthly.RetentionScheduleDaily = GetServiceClientLTRDailyRetentionFormat(psMonthly.RetentionScheduleDaily); } else if (psMonthly.RetentionScheduleFormatType == RetentionScheduleFormat.Weekly) { - hydraMonthly.RetentionScheduleWeekly = GetHydraLTRWeeklyRetentionFormat(psMonthly.RetentionScheduleWeekly); + serviceClientMonthly.RetentionScheduleWeekly = GetServiceClientLTRWeeklyRetentionFormat(psMonthly.RetentionScheduleWeekly); } - return hydraMonthly; + return serviceClientMonthly; } - private static HydraModels.YearlyRetentionSchedule GetHydraLTRYearlySchedule(YearlyRetentionSchedule psYearly) + private static ServiceClientModel.YearlyRetentionSchedule GetServiceClientLTRYearlySchedule(YearlyRetentionSchedule psYearly) { if (psYearly == null) { return null; } - HydraModels.YearlyRetentionSchedule hydraYearly = new HydraModels.YearlyRetentionSchedule(); + ServiceClientModel.YearlyRetentionSchedule serviceClientYearly = new ServiceClientModel.YearlyRetentionSchedule(); - hydraYearly.RetentionDuration = new HydraModels.RetentionDuration() + serviceClientYearly.RetentionDuration = new ServiceClientModel.RetentionDuration() { Count = psYearly.DurationCountInYears, - DurationType = HydraModels.RetentionDurationType.Years + DurationType = ServiceClientModel.RetentionDurationType.Years }; - hydraYearly.RetentionTimes = psYearly.RetentionTimes; + serviceClientYearly.RetentionTimes = psYearly.RetentionTimes; - hydraYearly.RetentionScheduleFormatType = psYearly.RetentionScheduleFormatType.ToString(); + serviceClientYearly.RetentionScheduleFormatType = psYearly.RetentionScheduleFormatType.ToString(); if (psYearly.RetentionScheduleFormatType == RetentionScheduleFormat.Daily) { - hydraYearly.RetentionScheduleDaily = GetHydraLTRDailyRetentionFormat(psYearly.RetentionScheduleDaily); + serviceClientYearly.RetentionScheduleDaily = GetServiceClientLTRDailyRetentionFormat(psYearly.RetentionScheduleDaily); } else if (psYearly.RetentionScheduleFormatType == RetentionScheduleFormat.Weekly) { - hydraYearly.RetentionScheduleWeekly = GetHydraLTRWeeklyRetentionFormat(psYearly.RetentionScheduleWeekly); + serviceClientYearly.RetentionScheduleWeekly = GetServiceClientLTRWeeklyRetentionFormat(psYearly.RetentionScheduleWeekly); } - hydraYearly.MonthsOfYear = HelperUtils.GetStringListFromEnumList(psYearly.MonthsOfYear); + serviceClientYearly.MonthsOfYear = HelperUtils.GetStringListFromEnumList(psYearly.MonthsOfYear); - return hydraYearly; + return serviceClientYearly; } - private static HydraModels.DailyRetentionFormat GetHydraLTRDailyRetentionFormat( + private static ServiceClientModel.DailyRetentionFormat GetServiceClientLTRDailyRetentionFormat( DailyRetentionFormat psFormat) { if (psFormat == null) @@ -470,28 +470,28 @@ private static HydraModels.DailyRetentionFormat GetHydraLTRDailyRetentionFormat( return null; } - HydraModels.DailyRetentionFormat hydraFormat = new HydraModels.DailyRetentionFormat(); + ServiceClientModel.DailyRetentionFormat serviceClientFormat = new ServiceClientModel.DailyRetentionFormat(); if (psFormat.DaysOfTheMonth != null) { - hydraFormat.DaysOfTheMonth = new List(); + serviceClientFormat.DaysOfTheMonth = new List(); foreach (Day psDay in psFormat.DaysOfTheMonth) { - HydraModels.Day hydraDay = new HydraModels.Day() + ServiceClientModel.Day serviceClientDay = new ServiceClientModel.Day() { Date = psDay.Date, IsLast = psDay.IsLast }; - hydraFormat.DaysOfTheMonth.Add(hydraDay); + serviceClientFormat.DaysOfTheMonth.Add(serviceClientDay); } } - return hydraFormat; + return serviceClientFormat; } - private static HydraModels.WeeklyRetentionFormat GetHydraLTRWeeklyRetentionFormat( + private static ServiceClientModel.WeeklyRetentionFormat GetServiceClientLTRWeeklyRetentionFormat( WeeklyRetentionFormat psFormat) { if (psFormat == null) @@ -499,17 +499,17 @@ private static HydraModels.WeeklyRetentionFormat GetHydraLTRWeeklyRetentionForma return null; } - HydraModels.WeeklyRetentionFormat hydraFormat = new HydraModels.WeeklyRetentionFormat(); + ServiceClientModel.WeeklyRetentionFormat serviceClientFormat = new ServiceClientModel.WeeklyRetentionFormat(); if (psFormat.DaysOfTheWeek != null) { - hydraFormat.DaysOfTheWeek = HelperUtils.GetStringListFromEnumList(psFormat.DaysOfTheWeek); + serviceClientFormat.DaysOfTheWeek = HelperUtils.GetStringListFromEnumList(psFormat.DaysOfTheWeek); } if (psFormat.WeeksOfTheMonth != null) { - hydraFormat.WeeksOfTheMonth = HelperUtils.GetStringListFromEnumList(psFormat.WeeksOfTheMonth); + serviceClientFormat.WeeksOfTheMonth = HelperUtils.GetStringListFromEnumList(psFormat.WeeksOfTheMonth); } - return hydraFormat; + return serviceClientFormat; } #endregion diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Conversions/SchedulePolicyConversions.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Conversions/SchedulePolicyConversions.cs index de13dbd58c87..0edd98ab4fdb 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Conversions/SchedulePolicyConversions.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Conversions/SchedulePolicyConversions.cs @@ -18,28 +18,28 @@ using System.Threading.Tasks; using System.Collections.Generic; using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models; -using Microsoft.Azure.Management.RecoveryServices.Backup.Models; +using ServiceClientModel =Microsoft.Azure.Management.RecoveryServices.Backup.Models; namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Helpers { public partial class PolicyHelpers { - #region HydraToPSObject conversions + #region ServiceClientToPSObject conversions - public static AzureRmRecoveryServicesBackupSimpleSchedulePolicy GetPSSimpleSchedulePolicy( - SimpleSchedulePolicy hydraPolicy) + public static SimpleSchedulePolicy GetPSSimpleSchedulePolicy( + ServiceClientModel.SimpleSchedulePolicy serviceClientPolicy) { - if (hydraPolicy == null) + if (serviceClientPolicy == null) { return null; } - AzureRmRecoveryServicesBackupSimpleSchedulePolicy psPolicy = new AzureRmRecoveryServicesBackupSimpleSchedulePolicy(); + SimpleSchedulePolicy psPolicy = new SimpleSchedulePolicy(); - psPolicy.ScheduleRunDays = HelperUtils.GetEnumListFromStringList(hydraPolicy.ScheduleRunDays); + psPolicy.ScheduleRunDays = HelperUtils.GetEnumListFromStringList(serviceClientPolicy.ScheduleRunDays); psPolicy.ScheduleRunFrequency = (ScheduleRunType)Enum.Parse(typeof(ScheduleRunType), - hydraPolicy.ScheduleRunFrequency); - psPolicy.ScheduleRunTimes = ParseDateTimesToUTC(hydraPolicy.ScheduleRunTimes); + serviceClientPolicy.ScheduleRunFrequency); + psPolicy.ScheduleRunTimes = ParseDateTimesToUTC(serviceClientPolicy.ScheduleRunTimes); // safe side validation psPolicy.Validate(); @@ -49,7 +49,7 @@ public static AzureRmRecoveryServicesBackupSimpleSchedulePolicy GetPSSimpleSched #endregion - #region PStoHydraObject conversions + #region PStoServiceClientObject conversions public static List ParseDateTimesToUTC(IList localTimes) { @@ -72,25 +72,25 @@ public static List ParseDateTimesToUTC(IList localTimes) } return utcTimes; - } + } - public static SimpleSchedulePolicy GetHydraSimpleSchedulePolicy( - AzureRmRecoveryServicesBackupSimpleSchedulePolicy psPolicy) + public static ServiceClientModel.SimpleSchedulePolicy GetServiceClientSimpleSchedulePolicy( + SimpleSchedulePolicy psPolicy) { if (psPolicy == null) { return null; } - SimpleSchedulePolicy hydraPolicy = new SimpleSchedulePolicy(); - hydraPolicy.ScheduleRunFrequency = psPolicy.ScheduleRunFrequency.ToString(); + ServiceClientModel.SimpleSchedulePolicy serviceClientPolicy = new ServiceClientModel.SimpleSchedulePolicy(); + serviceClientPolicy.ScheduleRunFrequency = psPolicy.ScheduleRunFrequency.ToString(); if (psPolicy.ScheduleRunFrequency == ScheduleRunType.Weekly) { - hydraPolicy.ScheduleRunDays = HelperUtils.GetStringListFromEnumList(psPolicy.ScheduleRunDays); + serviceClientPolicy.ScheduleRunDays = HelperUtils.GetStringListFromEnumList(psPolicy.ScheduleRunDays); } - hydraPolicy.ScheduleRunTimes = psPolicy.ScheduleRunTimes; + serviceClientPolicy.ScheduleRunTimes = psPolicy.ScheduleRunTimes; - return hydraPolicy; + return serviceClientPolicy; } #endregion diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Utils.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/HelperUtils.cs similarity index 100% rename from src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Utils.cs rename to src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/HelperUtils.cs diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/HydraHelpers.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/ServiceClientHelpers.cs similarity index 78% rename from src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/HydraHelpers.cs rename to src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/ServiceClientHelpers.cs index 597791af26e4..eac53a735f8c 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/HydraHelpers.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/ServiceClientHelpers.cs @@ -20,14 +20,14 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Helpers { - public class HydraConstants + public class ServiceClientConstants { public const string SkipToken = "skipToken"; } - public class HydraHelpers + public class ServiceClientHelpers { - public static string GetHydraProviderType(CmdletModel.ContainerType containerType) + public static string GetServiceClientProviderType(CmdletModel.ContainerType containerType) { string providerType = string.Empty; @@ -43,7 +43,7 @@ public static string GetHydraProviderType(CmdletModel.ContainerType containerTyp return providerType; } - public static string GetHydraProviderType(CmdletModel.WorkloadType workloadType) + public static string GetServiceClientProviderType(CmdletModel.WorkloadType workloadType) { string providerType = string.Empty; @@ -67,9 +67,9 @@ public static void GetSkipTokenFromNextLink(string nextLink, out string skipToke // This is sent by service and we don't expect this to be encoded. // TODO: Need to make sure during testing that this is in fact true. NameValueCollection queryParams = HttpUtility.ParseQueryString(uriObj.Query); - if (queryParams.Get(HydraConstants.SkipToken) != null) + if (queryParams.Get(ServiceClientConstants.SkipToken) != null) { - skipToken = queryParams.Get(HydraConstants.SkipToken); + skipToken = queryParams.Get(ServiceClientConstants.SkipToken); } else { @@ -98,36 +98,36 @@ public static string GetLastIdFromFullId(string fullId) return splitArr[splitArr.Length - 1]; } - public static string GetHydraContainerType(CmdletModel.ContainerType containerType) + public static string GetServiceClientContainerType(CmdletModel.ContainerType containerType) { - string hydraContainerType = string.Empty; + string serviceClientContainerType = string.Empty; switch (containerType) { case CmdletModel.ContainerType.AzureVM: - hydraContainerType = ContainerType.IaasVMContainer.ToString(); + serviceClientContainerType = ContainerType.IaasVMContainer.ToString(); break; default: break; } - return hydraContainerType; + return serviceClientContainerType; } - public static string GetHydraWorkloadType(CmdletModel.WorkloadType workloadType) + public static string GetServiceClientWorkloadType(CmdletModel.WorkloadType workloadType) { - string hydraWorkloadType = string.Empty; + string serviceClientWorkloadType = string.Empty; switch (workloadType) { case CmdletModel.WorkloadType.AzureVM: - hydraWorkloadType = WorkloadType.VM.ToString(); + serviceClientWorkloadType = WorkloadType.VM.ToString(); break; default: break; } - return hydraWorkloadType; + return serviceClientWorkloadType; } } } diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Validations/PolicyValidations.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Validations/PolicyValidations.cs index 588673d603fa..f5719bedc165 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Validations/PolicyValidations.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Validations/PolicyValidations.cs @@ -18,7 +18,6 @@ using System.Threading.Tasks; using System.Collections.Generic; using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models; -using Microsoft.Azure.Management.RecoveryServices.Backup.Models; using Microsoft.Azure.Commands.RecoveryServices.Backup.Properties; namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Helpers @@ -26,8 +25,8 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Helpers public partial class PolicyHelpers { public static void ValidateLongTermRetentionPolicyWithSimpleRetentionPolicy( - AzureRmRecoveryServicesBackupLongTermRetentionPolicy ltrPolicy, - AzureRmRecoveryServicesBackupSimpleSchedulePolicy schPolicy) + LongTermRetentionPolicy ltrPolicy, + SimpleSchedulePolicy schPolicy) { // for daily schedule, daily retention policy is required if (schPolicy.ScheduleRunFrequency == ScheduleRunType.Daily && diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureRmRecoveryServicesAzureVmContainer.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureVmContainer.cs similarity index 89% rename from src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureRmRecoveryServicesAzureVmContainer.cs rename to src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureVmContainer.cs index a4fe25a13a16..7ba555d770b2 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureRmRecoveryServicesAzureVmContainer.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureVmContainer.cs @@ -21,7 +21,7 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models { - public class AzureRmRecoveryServicesBackupIaasVmContainer : AzureRmRecoveryServicesBackupContainerBase + public class AzureVmContainer : ContainerBase { /// /// Resource Group where the Container is present @@ -38,7 +38,7 @@ public class AzureRmRecoveryServicesBackupIaasVmContainer : AzureRmRecoveryServi /// public ContainerRegistrationStatus Status { get; set; } - public AzureRmRecoveryServicesBackupIaasVmContainer(ProtectionContainerResource protectionContainer) + public AzureVmContainer(ProtectionContainerResource protectionContainer) : base(protectionContainer) { AzureIaaSVMProtectionContainer iaasVmProtectionContainer = (AzureIaaSVMProtectionContainer)protectionContainer.Properties; diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureRmRecoveryServicesAzureVmItem.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureVmItem.cs similarity index 88% rename from src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureRmRecoveryServicesAzureVmItem.cs rename to src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureVmItem.cs index 1babffe91a6a..03b7f85729d9 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureRmRecoveryServicesAzureVmItem.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureVmItem.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models /// /// Represents IaaSVM Item Class /// - public class AzureRmRecoveryServicesBackupIaasVmItem : AzureRmRecoveryServicesBackupItemBase + public class AzureVmItem : ItemBase { public string VirtualMachineId { get; set; } @@ -51,9 +51,9 @@ public class AzureRmRecoveryServicesBackupIaasVmItem : AzureRmRecoveryServicesBa /// /// ExtendedInfo for the Item /// /// Represents IaaSVM Item ExtendedInfo Class /// - public class AzureRmRecoveryServicesBackupIaasVmItemExtendedInfo : AzureRmRecoveryServicesBackupItemExtendedInfoBase + public class AzureVmItemExtendedInfo : ItemExtendedInfoBase { /// /// Oldest Recovery Point for the Item diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureRmRecoveryServicesAzureVmJob.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureVmJob.cs similarity index 69% rename from src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureRmRecoveryServicesAzureVmJob.cs rename to src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureVmJob.cs index bef891fd78a0..ac8d277a5293 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureRmRecoveryServicesAzureVmJob.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureVmJob.cs @@ -16,7 +16,7 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models { - public class AzureRmRecoveryServicesBackupAzureVmJob : AzureRmRecoveryServicesBackupJobBase + public class AzureVmJob : JobBase { public bool IsCancellable { get; set; } @@ -24,10 +24,10 @@ public class AzureRmRecoveryServicesBackupAzureVmJob : AzureRmRecoveryServicesBa public string VmVersion { get; set; } - public List ErrorDetails { get; set; } + public List ErrorDetails { get; set; } } - public class AzureRmRecoveryServicesBackupAzureVmJobDetails : AzureRmRecoveryServicesBackupAzureVmJob + public class AzureVmJobDetails : AzureVmJob { /// /// Context sensitive error message that might be helpful in debugging the issue. @@ -37,15 +37,15 @@ public class AzureRmRecoveryServicesBackupAzureVmJobDetails : AzureRmRecoverySer public Dictionary Properties { get; set; } - public List SubTasks { get; set; } + public List SubTasks { get; set; } } - public class AzureRmRecoveryServicesBackupAzureVmJobErrorInfo : AzureRmRecoveryServicesBackupJobErrorInfoBase + public class AzureVmJobErrorInfo : JobErrorInfoBase { public int ErrorCode { get; set; } } - public class AzureRmRecoveryServicesBackupAzureVmJobSubTask : AzureRmRecoveryServicesBackupJobSubTaskBase + public class AzureVmJobSubTask : JobSubTaskBase { } } diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureRmRecoveryServicesAzureVmPolicy.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureVmPolicy.cs similarity index 79% rename from src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureRmRecoveryServicesAzureVmPolicy.cs rename to src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureVmPolicy.cs index b506d5ce93f3..64245734cde5 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureRmRecoveryServicesAzureVmPolicy.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureVmPolicy.cs @@ -20,11 +20,11 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models { - public class AzureRmRecoveryServicesBackupIaasVmPolicy : AzureRmRecoveryServicesBackupPolicyBase + public class AzureVmPolicy : PolicyBase { - public AzureRmRecoveryServicesBackupSchedulePolicyBase SchedulePolicy { get; set; } + public SchedulePolicyBase SchedulePolicy { get; set; } - public AzureRmRecoveryServicesBackupRetentionPolicyBase RetentionPolicy { get; set; } + public RetentionPolicyBase RetentionPolicy { get; set; } public override void Validate() { diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureRmRecoveryServicesAzureVmRecoveryPoint.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureVmRecoveryPoint.cs similarity index 85% rename from src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureRmRecoveryServicesAzureVmRecoveryPoint.cs rename to src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureVmRecoveryPoint.cs index c74dff3b00a8..451645264cdc 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureRmRecoveryServicesAzureVmRecoveryPoint.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureVmRecoveryPoint.cs @@ -20,13 +20,13 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models { - public class AzureRmRecoveryServicesBackupIaasVmRecoveryPoint : AzureRmRecoveryServicesBackupRecoveryPointBase + public class AzureVmRecoveryPoint : RecoveryPointBase { public string RecoveryPointAdditionalInfo { get; set; } public string SourceVMStorageType { get; set; } - public AzureRmRecoveryServicesBackupIaasVmRecoveryPoint() + public AzureVmRecoveryPoint() { } diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/BaseObjects.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/BaseObjects.cs index 668a5e799ae0..655765c1e24f 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/BaseObjects.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/BaseObjects.cs @@ -14,51 +14,51 @@ using System; using System.Collections.Generic; -using Microsoft.Azure.Management.RecoveryServices.Backup.Models; +using ServiceClientModel = Microsoft.Azure.Management.RecoveryServices.Backup.Models; using Microsoft.Azure.Commands.RecoveryServices.Backup.Properties; namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models { - public class AzureRmRecoveryServicesObjectBase + public class ObjectBase { public virtual void Validate() { } } - public class AzureRmRecoveryServicesBackupManagementContext : AzureRmRecoveryServicesObjectBase + public class ManagementContext : ObjectBase { /// /// BackupManagementType /// public BackupManagementType BackupManagementType { get; set; } - public AzureRmRecoveryServicesBackupManagementContext() { } + public ManagementContext() { } - public AzureRmRecoveryServicesBackupManagementContext(string backupManagementType) + public ManagementContext(string backupManagementType) { BackupManagementType = ConversionUtils.GetPsBackupManagementType(backupManagementType); } } - public class AzureRmRecoveryServicesBackupContainerContext : AzureRmRecoveryServicesBackupManagementContext + public class ContainerContext : ManagementContext { public ContainerType ContainerType { get; set; } - public AzureRmRecoveryServicesBackupContainerContext() { } + public ContainerContext() { } - public AzureRmRecoveryServicesBackupContainerContext(ContainerType containerType, string backupManagementType) + public ContainerContext(ContainerType containerType, string backupManagementType) : base(backupManagementType) { ContainerType = containerType; } - public AzureRmRecoveryServicesBackupContainerContext(string backupManagementType) + public ContainerContext(string backupManagementType) : base(backupManagementType) { } } - public class AzureRmRecoveryServicesBackupEngineContext : AzureRmRecoveryServicesBackupManagementContext + public class AzureRmRecoveryServicesBackupEngineContext : ManagementContext { public string BackupEngineType { get; set; } @@ -71,31 +71,31 @@ public AzureRmRecoveryServicesBackupEngineContext(string backupEngineType, strin } } - public class AzureRmRecoveryServicesBackupContainerBase : AzureRmRecoveryServicesBackupContainerContext + public class ContainerBase : ContainerContext { /// /// Container Name /// public string Name { get; set; } - public AzureRmRecoveryServicesBackupContainerBase(ProtectionContainerResource protectionContainer) - : base(ConversionUtils.GetPsContainerType(((ProtectionContainer)protectionContainer.Properties).ContainerType), - ((ProtectionContainer)protectionContainer.Properties).BackupManagementType) + public ContainerBase(ServiceClientModel.ProtectionContainerResource protectionContainer) + : base(ConversionUtils.GetPsContainerType(((ServiceClientModel.ProtectionContainer)protectionContainer.Properties).ContainerType), + ((ServiceClientModel.ProtectionContainer)protectionContainer.Properties).BackupManagementType) { Name = IdUtils.GetNameFromUri(protectionContainer.Name); } } - public class AzureRmRecoveryServicesBackupEngineBase : AzureRmRecoveryServicesBackupEngineContext + public class BackupEngineBase : AzureRmRecoveryServicesBackupEngineContext { /// /// Container Name /// public string Name { get; set; } - public AzureRmRecoveryServicesBackupEngineBase(BackupEngineResource backupEngine) - : base(((BackupEngineBase)backupEngine.Properties).BackupEngineType, - ((BackupEngineBase)backupEngine.Properties).BackupManagementType) + public BackupEngineBase(ServiceClientModel.BackupEngineResource backupEngine) + : base(((ServiceClientModel.BackupEngineBase)backupEngine.Properties).BackupEngineType, + ((ServiceClientModel.BackupEngineBase)backupEngine.Properties).BackupManagementType) { Name = backupEngine.Name; } @@ -104,7 +104,7 @@ public AzureRmRecoveryServicesBackupEngineBase(BackupEngineResource backupEngine /// /// Represents Azure Backup Item Context Class /// - public class AzureRmRecoveryServicesBackupItemContext : AzureRmRecoveryServicesBackupContainerContext + public class ItemContext : ContainerContext { /// /// Workload Type of Item @@ -116,13 +116,13 @@ public class AzureRmRecoveryServicesBackupItemContext : AzureRmRecoveryServicesB /// public string ContainerName { get; set; } - public AzureRmRecoveryServicesBackupItemContext() + public ItemContext() : base() { } - public AzureRmRecoveryServicesBackupItemContext(ProtectedItem protectedItem, + public ItemContext(ServiceClientModel.ProtectedItem protectedItem, string containerName, ContainerType containerType) : base(containerType, protectedItem.BackupManagementType) { @@ -134,7 +134,7 @@ public AzureRmRecoveryServicesBackupItemContext(ProtectedItem protectedItem, /// /// Represents Azure Backup Item Base Class /// - public class AzureRmRecoveryServicesBackupItemBase : AzureRmRecoveryServicesBackupItemContext + public class ItemBase : ItemContext { /// /// Name of the item @@ -151,11 +151,11 @@ public class AzureRmRecoveryServicesBackupItemBase : AzureRmRecoveryServicesBack /// public DateTime? LatestRecoveryPoint { get; set; } - public AzureRmRecoveryServicesBackupItemBase(ProtectedItemResource protectedItemResource, + public ItemBase(ServiceClientModel.ProtectedItemResource protectedItemResource, string containerName, ContainerType containerType) - : base((ProtectedItem)protectedItemResource.Properties, containerName, containerType) + : base((ServiceClientModel.ProtectedItem)protectedItemResource.Properties, containerName, containerType) { - ProtectedItem protectedItem = (ProtectedItem)protectedItemResource.Properties; + ServiceClientModel.ProtectedItem protectedItem = (ServiceClientModel.ProtectedItem)protectedItemResource.Properties; Name = protectedItemResource.Name; Id = protectedItemResource.Id; LatestRecoveryPoint = protectedItem.LastRecoveryPoint; @@ -165,11 +165,11 @@ public AzureRmRecoveryServicesBackupItemBase(ProtectedItemResource protectedItem /// /// Represents Azure Backup Item ExtendedInfo Base Class /// - public class AzureRmRecoveryServicesBackupItemExtendedInfoBase : AzureRmRecoveryServicesObjectBase + public class ItemExtendedInfoBase : ObjectBase { } - public class AzureRmRecoveryServicesBackupRecoveryPointBase : AzureRmRecoveryServicesBackupItemContext + public class RecoveryPointBase : ItemContext { private global::Microsoft.Azure.Management.RecoveryServices.Backup.Models.RecoveryPointResource rp; @@ -199,14 +199,14 @@ public class AzureRmRecoveryServicesBackupRecoveryPointBase : AzureRmRecoverySer /// public DateTime RecoveryPointTime { get; set; } - public AzureRmRecoveryServicesBackupRecoveryPointBase() + public RecoveryPointBase() : base() { } } - public class AzureRmRecoveryServicesBackupPolicyBase : AzureRmRecoveryServicesBackupManagementContext + public class PolicyBase : ManagementContext { public string Name { get; set; } @@ -230,15 +230,15 @@ public override void Validate() } } - public class AzureRmRecoveryServicesBackupRetentionPolicyBase : AzureRmRecoveryServicesObjectBase + public class RetentionPolicyBase : ObjectBase { } - public class AzureRmRecoveryServicesBackupSchedulePolicyBase : AzureRmRecoveryServicesObjectBase + public class SchedulePolicyBase : ObjectBase { } - public class AzureRmRecoveryServicesBackupJobBase : AzureRmRecoveryServicesBackupManagementContext + public class JobBase : ManagementContext { public string ActivityId { get; set; } @@ -260,7 +260,7 @@ public class AzureRmRecoveryServicesBackupJobBase : AzureRmRecoveryServicesBacku /// /// This class contains job error message details. /// - public class AzureRmRecoveryServicesBackupJobErrorInfoBase + public class JobErrorInfoBase { public string ErrorMessage { get; set; } @@ -270,7 +270,7 @@ public class AzureRmRecoveryServicesBackupJobErrorInfoBase /// /// This class contains job sub tasks detail. /// - public class AzureRmRecoveryServicesBackupJobSubTaskBase + public class JobSubTaskBase { public string Name { get; set; } diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/Commands.RecoveryServices.Backup.Models.csproj b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/Commands.RecoveryServices.Backup.Models.csproj index 789edbbbe4f8..98e725fc4006 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/Commands.RecoveryServices.Backup.Models.csproj +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/Commands.RecoveryServices.Backup.Models.csproj @@ -30,7 +30,7 @@ 4 - + False ..\..\..\packages\Microsoft.Azure.Management.RecoveryServices.Backup.0.1.0-preview\lib\net40\Microsoft.Azure.Management.RecoveryServices.Backup.dll @@ -43,18 +43,18 @@ - - + + - - - - + + + + diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/CommonModels/PolicyRetentionObjects.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/CommonModels/PolicyRetentionObjects.cs index 79f086529694..e5dec61d7367 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/CommonModels/PolicyRetentionObjects.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/CommonModels/PolicyRetentionObjects.cs @@ -21,7 +21,7 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models { - public class AzureRmRecoveryServicesBackupLongTermRetentionPolicy : AzureRmRecoveryServicesBackupRetentionPolicyBase + public class LongTermRetentionPolicy : RetentionPolicyBase { public bool IsDailyScheduleEnabled { get; set; } public bool IsWeeklyScheduleEnabled { get; set; } @@ -32,7 +32,7 @@ public class AzureRmRecoveryServicesBackupLongTermRetentionPolicy : AzureRmRecov public MonthlyRetentionSchedule MonthlySchedule { get; set; } public YearlyRetentionSchedule YearlySchedule { get; set; } - public AzureRmRecoveryServicesBackupLongTermRetentionPolicy() + public LongTermRetentionPolicy() { IsDailyScheduleEnabled = false; IsWeeklyScheduleEnabled = false; diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/CommonModels/PolicyScheduleObjects.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/CommonModels/PolicyScheduleObjects.cs index 5322daa00483..f2e41ee3d81e 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/CommonModels/PolicyScheduleObjects.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/CommonModels/PolicyScheduleObjects.cs @@ -21,7 +21,7 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models { - public class AzureRmRecoveryServicesBackupSimpleSchedulePolicy : AzureRmRecoveryServicesBackupSchedulePolicyBase + public class SimpleSchedulePolicy : SchedulePolicyBase { public ScheduleRunType ScheduleRunFrequency { get; set; } diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/DpmModels/AzureRmRecoveryServicesDpmBackupEngine.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/DpmModels/DpmBackupEngine.cs similarity index 77% rename from src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/DpmModels/AzureRmRecoveryServicesDpmBackupEngine.cs rename to src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/DpmModels/DpmBackupEngine.cs index 129d96cc7b59..5f0760f81e2a 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/DpmModels/AzureRmRecoveryServicesDpmBackupEngine.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/DpmModels/DpmBackupEngine.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Management.RecoveryServices.Backup.Models; +using ServiceClientModel = Microsoft.Azure.Management.RecoveryServices.Backup.Models; using System; using System.Collections.Generic; using System.Linq; @@ -21,7 +21,7 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models { - public class AzureRmRecoveryServicesBackupDpmBackupEngine : AzureRmRecoveryServicesBackupEngineBase + public class DpmBackupEngine : BackupEngineBase { /// /// Friendly name of the container @@ -33,16 +33,16 @@ public class AzureRmRecoveryServicesBackupDpmBackupEngine : AzureRmRecoveryServi /// public string Status { get; set; } - public AzureRmRecoveryServicesBackupDpmBackupEngine(BackupEngineResource backupEngine) + public DpmBackupEngine(ServiceClientModel.BackupEngineResource backupEngine) : base(backupEngine) { - BackupEngineBase dpmBackupEngine = (BackupEngineBase)backupEngine.Properties; + ServiceClientModel.BackupEngineBase dpmBackupEngine = (ServiceClientModel.BackupEngineBase)backupEngine.Properties; FriendlyName = dpmBackupEngine.FriendlyName; Status = dpmBackupEngine.RegistrationStatus; } } - public class AzureRmRecoveryServicesBackupAzureBackupServerEngine : AzureRmRecoveryServicesBackupEngineBase + public class AzureRmRecoveryServicesBackupAzureBackupServerEngine : BackupEngineBase { /// /// Friendly name of the container @@ -54,10 +54,10 @@ public class AzureRmRecoveryServicesBackupAzureBackupServerEngine : AzureRmRecov /// public string Status { get; set; } - public AzureRmRecoveryServicesBackupAzureBackupServerEngine(BackupEngineResource backupEngine) + public AzureRmRecoveryServicesBackupAzureBackupServerEngine(ServiceClientModel.BackupEngineResource backupEngine) : base(backupEngine) { - AzureBackupServerEngine azureBackupServerEngine = (AzureBackupServerEngine)backupEngine.Properties; + ServiceClientModel.AzureBackupServerEngine azureBackupServerEngine = (ServiceClientModel.AzureBackupServerEngine)backupEngine.Properties; FriendlyName = azureBackupServerEngine.FriendlyName; Status = azureBackupServerEngine.RegistrationStatus; } diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/MabModels/AzureRmRecoveryServicesMabContainer.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/MabModels/AzureRmRecoveryServicesMabContainer.cs index 4d3a7f123a05..b3ae440672a5 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/MabModels/AzureRmRecoveryServicesMabContainer.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/MabModels/AzureRmRecoveryServicesMabContainer.cs @@ -21,7 +21,7 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models { - public class AzureRmRecoveryServicesBackupMabContainer : AzureRmRecoveryServicesBackupContainerBase + public class AzureRmRecoveryServicesBackupMabContainer : ContainerBase { /// /// Friendly name of the container diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/Properties/Resources.Designer.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/Properties/Resources.Designer.cs index bc9926ac84af..e82d143ffa66 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/Properties/Resources.Designer.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/Properties/Resources.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.34209 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -291,11 +291,11 @@ public static string DiscoveryFailureErrorMessage { } /// - /// Looks up a localized string similar to Empty response received from Service/Hydra. + /// Looks up a localized string similar to Empty response received from Service Client. /// - public static string EmptyHydraResponseException { + public static string EmptyServiceClientResponseException { get { - return ResourceManager.GetString("EmptyHydraResponseException", resourceCulture); + return ResourceManager.GetString("EmptyServiceClientResponseException", resourceCulture); } } diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/Properties/Resources.resx b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/Properties/Resources.resx index cd7ea3e0c80f..725f4142daef 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/Properties/Resources.resx +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/Properties/Resources.resx @@ -180,8 +180,8 @@ Both RetentionPolicy and SchedulePolicy are empty, nothing to update - - Empty response received from Service/Hydra + + Empty response received from Service Client Invalid ProtectionPolicy - either NULL or NOT of type: {0} diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Providers/Commands.RecoveryServices.Backup.Providers.csproj b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Providers/Commands.RecoveryServices.Backup.Providers.csproj index 81a1e9a17e7c..2c6d6bd77694 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Providers/Commands.RecoveryServices.Backup.Providers.csproj +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Providers/Commands.RecoveryServices.Backup.Providers.csproj @@ -40,7 +40,7 @@ False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - + False ..\..\..\packages\Microsoft.Azure.Management.RecoveryServices.Backup.0.1.0-preview\lib\net40\Microsoft.Azure.Management.RecoveryServices.Backup.dll @@ -71,18 +71,10 @@ {3819d8a7-c62c-4c47-8ddd-0332d9ce1252} Commands.ResourceManager.Common - - {604260dc-b392-4cf4-81ec-34b14591e2d2} - Commands.RecoveryServices - {0e1d3f36-e6c8-4764-8c7d-6f9ee537490c} Commands.RecoveryServices.Backup.Helpers - - {b758fec1-35c1-4f93-a954-66dd33f6e0ec} - Commands.RecoveryServices.Backup.HydraAdapter - {5e675749-6139-464a-904c-59c0ffdfec82} Commands.RecoveryServices.Backup.Logger @@ -95,6 +87,10 @@ {5e675749-6139-464a-904c-59c0ffdfec82} Commands.RecoveryServices.Backup.Logger + + {b758fec1-35c1-4f93-a954-66dd33f6e0ec} + Commands.RecoveryServices.Backup.ServiceClientAdapter + diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Providers/IPsBackupProvider.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Providers/IPsBackupProvider.cs index e801b816db95..5cc62ccf909b 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Providers/IPsBackupProvider.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Providers/IPsBackupProvider.cs @@ -12,7 +12,8 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.HydraAdapterNS; +using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ServiceClientAdapterNS; +using CmdletModel = Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models; using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models; using Microsoft.Azure.Management.RecoveryServices.Backup.Models; using System; @@ -25,7 +26,7 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ProviderModel { public interface IPsBackupProvider { - void Initialize(Dictionary providerData, HydraAdapter hydraAdapter); + void Initialize(Dictionary providerData, ServiceClientAdapter serviceClientAdapter); BaseRecoveryServicesJobResponse EnableProtection(); @@ -36,23 +37,23 @@ public interface IPsBackupProvider BaseRecoveryServicesJobResponse TriggerRestore(); ProtectedItemResponse GetProtectedItem(); - - AzureRmRecoveryServicesBackupRecoveryPointBase GetRecoveryPointDetails(); - List ListRecoveryPoints(); + CmdletModel.RecoveryPointBase GetRecoveryPointDetails(); + + List ListRecoveryPoints(); ProtectionPolicyResponse CreatePolicy(); - ProtectionPolicyResponse ModifyPolicy(); + ProtectionPolicyResponse ModifyPolicy(); - AzureRmRecoveryServicesBackupSchedulePolicyBase GetDefaultSchedulePolicyObject(); + SchedulePolicyBase GetDefaultSchedulePolicyObject(); - AzureRmRecoveryServicesBackupRetentionPolicyBase GetDefaultRetentionPolicyObject(); + RetentionPolicyBase GetDefaultRetentionPolicyObject(); - List ListProtectionContainers(); + List ListProtectionContainers(); - List ListBackupManagementServers(); + List ListBackupManagementServers(); - List ListProtectedItems(); + List ListProtectedItems(); } } diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Providers/Providers/DpmPsBackupProvider.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Providers/Providers/DpmPsBackupProvider.cs index 9f0319d240f5..cd5c7724d863 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Providers/Providers/DpmPsBackupProvider.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Providers/Providers/DpmPsBackupProvider.cs @@ -18,21 +18,21 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -using Microsoft.Azure.Management.RecoveryServices.Backup.Models; +using ServiceClientModel = Microsoft.Azure.Management.RecoveryServices.Backup.Models; using Microsoft.Azure.Commands.RecoveryServices.Backup.Helpers; -using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.HydraAdapterNS; +using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ServiceClientAdapterNS; namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ProviderModel { public class DpmPsBackupProvider : IPsBackupProvider { Dictionary ProviderData { get; set; } - HydraAdapter HydraAdapter { get; set; } + ServiceClientAdapter ServiceClientAdapter { get; set; } - public void Initialize(Dictionary providerData, HydraAdapter hydraAdapter) + public void Initialize(Dictionary providerData, ServiceClientAdapter serviceClientAdapter) { this.ProviderData = providerData; - this.HydraAdapter = hydraAdapter; + this.ServiceClientAdapter = serviceClientAdapter; } public Management.RecoveryServices.Backup.Models.BaseRecoveryServicesJobResponse EnableProtection() @@ -60,12 +60,12 @@ public Management.RecoveryServices.Backup.Models.ProtectedItemResponse GetProtec throw new NotImplementedException(); } - public AzureRmRecoveryServicesBackupRecoveryPointBase GetRecoveryPointDetails() + public RecoveryPointBase GetRecoveryPointDetails() { throw new NotImplementedException(); } - public List ListRecoveryPoints() + public List ListRecoveryPoints() { throw new NotImplementedException(); } @@ -75,25 +75,25 @@ public Management.RecoveryServices.Backup.Models.ProtectionPolicyResponse Create throw new NotImplementedException(); } - public ProtectionPolicyResponse ModifyPolicy() + public ServiceClientModel.ProtectionPolicyResponse ModifyPolicy() { throw new NotImplementedException(); } - public List ListProtectionContainers() + public List ListProtectionContainers() { throw new NotImplementedException(); } - public List ListBackupManagementServers() + public List ListBackupManagementServers() { string name = (string)this.ProviderData[ContainerParams.Name]; - BackupEngineListQueryParams queryParams = new BackupEngineListQueryParams(); + ServiceClientModel.BackupEngineListQueryParams queryParams = new ServiceClientModel.BackupEngineListQueryParams(); - var listResponse = HydraAdapter.ListBackupEngines(queryParams); + var listResponse = ServiceClientAdapter.ListBackupEngines(queryParams); - List backupEngineModels = ConversionHelpers.GetBackupEngineModelList(listResponse); + List backupEngineModels = ConversionHelpers.GetBackupEngineModelList(listResponse); return backupEngineModels; } @@ -108,17 +108,17 @@ public void DeletePolicy() throw new NotImplementedException(); } - public AzureRmRecoveryServicesBackupSchedulePolicyBase GetDefaultSchedulePolicyObject() + public SchedulePolicyBase GetDefaultSchedulePolicyObject() { throw new NotImplementedException(); } - public AzureRmRecoveryServicesBackupRetentionPolicyBase GetDefaultRetentionPolicyObject() + public RetentionPolicyBase GetDefaultRetentionPolicyObject() { throw new NotImplementedException(); } - public List ListProtectedItems() + public List ListProtectedItems() { throw new NotImplementedException(); } diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Providers/Providers/IaasVmPsBackupProvider.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Providers/Providers/IaasVmPsBackupProvider.cs index ca148c7a6bb0..7065a7d59d3e 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Providers/Providers/IaasVmPsBackupProvider.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Providers/Providers/IaasVmPsBackupProvider.cs @@ -20,11 +20,13 @@ using System.Text; using System.Threading; using System.Threading.Tasks; +using ServiceClientModel = Microsoft.Azure.Management.RecoveryServices.Backup.Models; using Microsoft.Azure.Management.RecoveryServices.Backup.Models; using Microsoft.Azure.Commands.RecoveryServices.Backup.Helpers; +using CmdletModel = Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models; using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models; using Microsoft.Azure.Commands.RecoveryServices.Backup.Properties; -using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.HydraAdapterNS; +using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ServiceClientAdapterNS; using Microsoft.WindowsAzure.Commands.Utilities.Common; namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ProviderModel @@ -37,12 +39,12 @@ public class IaasVmPsBackupProvider : IPsBackupProvider private const string classicComputeAzureVMVersion = "Microsoft.ClassicCompute"; Dictionary ProviderData { get; set; } - HydraAdapter HydraAdapter { get; set; } + ServiceClientAdapter ServiceClientAdapter { get; set; } - public void Initialize(Dictionary providerData, HydraAdapter hydraAdapter) + public void Initialize(Dictionary providerData, ServiceClientAdapter serviceClientAdapter) { this.ProviderData = providerData; - this.HydraAdapter = hydraAdapter; + this.ServiceClientAdapter = serviceClientAdapter; } public BaseRecoveryServicesJobResponse EnableProtection() @@ -52,13 +54,13 @@ public BaseRecoveryServicesJobResponse EnableProtection() string azureVMResourceGroupName = (string)ProviderData[ItemParams.AzureVMResourceGroupName]; string parameterSetName = (string)ProviderData[ItemParams.ParameterSetName]; - AzureRmRecoveryServicesBackupPolicyBase policy = (AzureRmRecoveryServicesBackupPolicyBase) + PolicyBase policy = (PolicyBase) ProviderData[ItemParams.Policy]; - AzureRmRecoveryServicesBackupItemBase itemBase = (AzureRmRecoveryServicesBackupItemBase) + ItemBase itemBase = (ItemBase) ProviderData[ItemParams.Item]; - AzureRmRecoveryServicesBackupIaasVmItem item = (AzureRmRecoveryServicesBackupIaasVmItem) + AzureVmItem item = (AzureVmItem) ProviderData[ItemParams.Item]; // do validations @@ -92,7 +94,7 @@ public BaseRecoveryServicesJobResponse EnableProtection() protectedItemUri = HelperUtils.GetProtectedItemUri(keyValueDict, item.Id); } - // construct Hydra protectedItem request + // construct Service Client protectedItem request AzureIaaSVMProtectedItem properties; if (isComputeAzureVM == false) @@ -106,7 +108,7 @@ public BaseRecoveryServicesJobResponse EnableProtection() properties.PolicyId = policy.Id; - ProtectedItemCreateOrUpdateRequest hydraRequest = new ProtectedItemCreateOrUpdateRequest() + ProtectedItemCreateOrUpdateRequest serviceClientRequest = new ProtectedItemCreateOrUpdateRequest() { Item = new ProtectedItemResource() { @@ -114,20 +116,20 @@ public BaseRecoveryServicesJobResponse EnableProtection() } }; - return HydraAdapter.CreateOrUpdateProtectedItem( + return ServiceClientAdapter.CreateOrUpdateProtectedItem( containerUri, protectedItemUri, - hydraRequest); + serviceClientRequest); } public BaseRecoveryServicesJobResponse DisableProtection() { bool deleteBackupData = (bool)ProviderData[ItemParams.DeleteBackupData]; - AzureRmRecoveryServicesBackupItemBase itemBase = (AzureRmRecoveryServicesBackupItemBase) + ItemBase itemBase = (ItemBase) ProviderData[ItemParams.Item]; - AzureRmRecoveryServicesBackupIaasVmItem item = (AzureRmRecoveryServicesBackupIaasVmItem) + AzureVmItem item = (AzureVmItem) ProviderData[ItemParams.Item]; // do validations @@ -141,7 +143,7 @@ public BaseRecoveryServicesJobResponse DisableProtection() if (deleteBackupData) { - return HydraAdapter.DeleteProtectedItem( + return ServiceClientAdapter.DeleteProtectedItem( containerUri, protectedItemUri); } @@ -149,7 +151,7 @@ public BaseRecoveryServicesJobResponse DisableProtection() { isComputeAzureVM = IsComputeAzureVM(item.VirtualMachineId); - // construct Hydra protectedItem request + // construct Service Client protectedItem request AzureIaaSVMProtectedItem properties; if (isComputeAzureVM == false) @@ -164,7 +166,7 @@ public BaseRecoveryServicesJobResponse DisableProtection() properties.PolicyId = string.Empty; properties.ProtectionState = ItemProtectionState.ProtectionStopped.ToString(); - ProtectedItemCreateOrUpdateRequest hydraRequest = new ProtectedItemCreateOrUpdateRequest() + ProtectedItemCreateOrUpdateRequest serviceClientRequest = new ProtectedItemCreateOrUpdateRequest() { Item = new ProtectedItemResource() { @@ -172,30 +174,30 @@ public BaseRecoveryServicesJobResponse DisableProtection() } }; - return HydraAdapter.CreateOrUpdateProtectedItem( + return ServiceClientAdapter.CreateOrUpdateProtectedItem( containerUri, protectedItemUri, - hydraRequest); + serviceClientRequest); } } public BaseRecoveryServicesJobResponse TriggerBackup() { - AzureRmRecoveryServicesBackupItemBase item = (AzureRmRecoveryServicesBackupItemBase)ProviderData[ItemParams.Item]; - AzureRmRecoveryServicesBackupIaasVmItem iaasVmItem = item as AzureRmRecoveryServicesBackupIaasVmItem; - return HydraAdapter.TriggerBackup(IdUtils.GetValueByName(iaasVmItem.Id, IdUtils.IdNames.ProtectionContainerName), + ItemBase item = (ItemBase)ProviderData[ItemParams.Item]; + AzureVmItem iaasVmItem = item as AzureVmItem; + return ServiceClientAdapter.TriggerBackup(IdUtils.GetValueByName(iaasVmItem.Id, IdUtils.IdNames.ProtectionContainerName), IdUtils.GetValueByName(iaasVmItem.Id, IdUtils.IdNames.ProtectedItemName)); } public BaseRecoveryServicesJobResponse TriggerRestore() { - AzureRmRecoveryServicesBackupIaasVmRecoveryPoint rp = ProviderData[RestoreBackupItemParams.RecoveryPoint] - as AzureRmRecoveryServicesBackupIaasVmRecoveryPoint; + AzureVmRecoveryPoint rp = ProviderData[RestoreBackupItemParams.RecoveryPoint] + as AzureVmRecoveryPoint; string storageAccountId = ProviderData[RestoreBackupItemParams.StorageAccountId].ToString(); string storageAccountLocation = ProviderData[RestoreBackupItemParams.StorageAccountLocation].ToString(); string storageAccountType = ProviderData[RestoreBackupItemParams.StorageAccountType].ToString(); - var response = HydraAdapter.RestoreDisk(rp, storageAccountId, storageAccountLocation, storageAccountType); + var response = ServiceClientAdapter.RestoreDisk(rp, storageAccountId, storageAccountLocation, storageAccountType); return response; } @@ -204,10 +206,10 @@ public ProtectedItemResponse GetProtectedItem() throw new NotImplementedException(); } - public AzureRmRecoveryServicesBackupRecoveryPointBase GetRecoveryPointDetails() + public CmdletModel.RecoveryPointBase GetRecoveryPointDetails() { - AzureRmRecoveryServicesBackupIaasVmItem item = ProviderData[GetRecoveryPointParams.Item] - as AzureRmRecoveryServicesBackupIaasVmItem; + AzureVmItem item = ProviderData[GetRecoveryPointParams.Item] + as AzureVmItem; string recoveryPointId = ProviderData[GetRecoveryPointParams.RecoveryPointId].ToString(); @@ -215,16 +217,16 @@ public AzureRmRecoveryServicesBackupRecoveryPointBase GetRecoveryPointDetails() string containerUri = HelperUtils.GetContainerUri(uriDict, item.Id); string protectedItemName = HelperUtils.GetProtectedItemUri(uriDict, item.Id); - var rpResponse = HydraAdapter.GetRecoveryPointDetails(containerUri, protectedItemName, recoveryPointId); + var rpResponse = ServiceClientAdapter.GetRecoveryPointDetails(containerUri, protectedItemName, recoveryPointId); return RecoveryPointConversions.GetPSAzureRecoveryPoints(rpResponse, item); } - public List ListRecoveryPoints() + public List ListRecoveryPoints() { DateTime startDate = (DateTime)(ProviderData[GetRecoveryPointParams.StartDate]); DateTime endDate = (DateTime)(ProviderData[GetRecoveryPointParams.EndDate]); - AzureRmRecoveryServicesBackupIaasVmItem item = ProviderData[GetRecoveryPointParams.Item] - as AzureRmRecoveryServicesBackupIaasVmItem; + AzureVmItem item = ProviderData[GetRecoveryPointParams.Item] + as AzureVmItem; Dictionary uriDict = HelperUtils.ParseUri(item.Id); string containerUri = HelperUtils.GetContainerUri(uriDict, item.Id); @@ -242,7 +244,7 @@ public List ListRecoveryPoints() queryFilter.EndDate = CommonHelpers.GetDateTimeStringForService(endDate); RecoveryPointListResponse rpListResponse = null; - rpListResponse = HydraAdapter.GetRecoveryPoints(containerUri, protectedItemName, queryFilter); + rpListResponse = ServiceClientAdapter.GetRecoveryPoints(containerUri, protectedItemName, queryFilter); return RecoveryPointConversions.GetPSAzureRecoveryPoints(rpListResponse, item); } @@ -251,13 +253,13 @@ public ProtectionPolicyResponse CreatePolicy() string policyName = (string)ProviderData[PolicyParams.PolicyName]; Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.WorkloadType workloadType = (Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.WorkloadType)ProviderData[PolicyParams.WorkloadType]; - AzureRmRecoveryServicesBackupRetentionPolicyBase retentionPolicy = + RetentionPolicyBase retentionPolicy = ProviderData.ContainsKey(PolicyParams.RetentionPolicy) ? - (AzureRmRecoveryServicesBackupRetentionPolicyBase)ProviderData[PolicyParams.RetentionPolicy] : + (RetentionPolicyBase)ProviderData[PolicyParams.RetentionPolicy] : null; - AzureRmRecoveryServicesBackupSchedulePolicyBase schedulePolicy = + SchedulePolicyBase schedulePolicy = ProviderData.ContainsKey(PolicyParams.SchedulePolicy) ? - (AzureRmRecoveryServicesBackupSchedulePolicyBase)ProviderData[PolicyParams.SchedulePolicy] : + (SchedulePolicyBase)ProviderData[PolicyParams.SchedulePolicy] : null; // do validations @@ -270,50 +272,50 @@ public ProtectionPolicyResponse CreatePolicy() Logger.Instance.WriteDebug("Validation of Retention policy is successful"); // update the retention times from backupSchedule to retentionPolicy after converting to UTC - CopyScheduleTimeToRetentionTimes((AzureRmRecoveryServicesBackupLongTermRetentionPolicy)retentionPolicy, - (AzureRmRecoveryServicesBackupSimpleSchedulePolicy)schedulePolicy); + CopyScheduleTimeToRetentionTimes((CmdletModel.LongTermRetentionPolicy)retentionPolicy, + (CmdletModel.SimpleSchedulePolicy)schedulePolicy); Logger.Instance.WriteDebug("Copy of RetentionTime from with SchedulePolicy to RetentionPolicy is successful"); // Now validate both RetentionPolicy and SchedulePolicy together PolicyHelpers.ValidateLongTermRetentionPolicyWithSimpleRetentionPolicy( - (AzureRmRecoveryServicesBackupLongTermRetentionPolicy)retentionPolicy, - (AzureRmRecoveryServicesBackupSimpleSchedulePolicy)schedulePolicy); + (CmdletModel.LongTermRetentionPolicy)retentionPolicy, + (CmdletModel.SimpleSchedulePolicy)schedulePolicy); Logger.Instance.WriteDebug("Validation of Retention policy with Schedule policy is successful"); - // construct Hydra policy request - ProtectionPolicyRequest hydraRequest = new ProtectionPolicyRequest() + // construct Service Client policy request + ProtectionPolicyRequest serviceClientRequest = new ProtectionPolicyRequest() { Item = new ProtectionPolicyResource() { Properties = new AzureIaaSVMProtectionPolicy() { - RetentionPolicy = PolicyHelpers.GetHydraLongTermRetentionPolicy( - (AzureRmRecoveryServicesBackupLongTermRetentionPolicy)retentionPolicy), - SchedulePolicy = PolicyHelpers.GetHydraSimpleSchedulePolicy( - (AzureRmRecoveryServicesBackupSimpleSchedulePolicy)schedulePolicy) + RetentionPolicy = PolicyHelpers.GetServiceClientLongTermRetentionPolicy( + (CmdletModel.LongTermRetentionPolicy)retentionPolicy), + SchedulePolicy = PolicyHelpers.GetServiceClientSimpleSchedulePolicy( + (CmdletModel.SimpleSchedulePolicy)schedulePolicy) } } }; - return HydraAdapter.CreateOrUpdateProtectionPolicy( + return ServiceClientAdapter.CreateOrUpdateProtectionPolicy( policyName, - hydraRequest); + serviceClientRequest); } public ProtectionPolicyResponse ModifyPolicy() { - AzureRmRecoveryServicesBackupRetentionPolicyBase retentionPolicy = + RetentionPolicyBase retentionPolicy = ProviderData.ContainsKey(PolicyParams.RetentionPolicy) ? - (AzureRmRecoveryServicesBackupRetentionPolicyBase)ProviderData[PolicyParams.RetentionPolicy] : + (RetentionPolicyBase)ProviderData[PolicyParams.RetentionPolicy] : null; - AzureRmRecoveryServicesBackupSchedulePolicyBase schedulePolicy = + SchedulePolicyBase schedulePolicy = ProviderData.ContainsKey(PolicyParams.SchedulePolicy) ? - (AzureRmRecoveryServicesBackupSchedulePolicyBase)ProviderData[PolicyParams.SchedulePolicy] : + (SchedulePolicyBase)ProviderData[PolicyParams.SchedulePolicy] : null; - AzureRmRecoveryServicesBackupPolicyBase policy = + PolicyBase policy = ProviderData.ContainsKey(PolicyParams.ProtectionPolicy) ? - (AzureRmRecoveryServicesBackupPolicyBase)ProviderData[PolicyParams.ProtectionPolicy] : + (PolicyBase)ProviderData[PolicyParams.ProtectionPolicy] : null; // do validations @@ -330,48 +332,48 @@ public ProtectionPolicyResponse ModifyPolicy() if (schedulePolicy != null) { ValidateAzureVMSchedulePolicy(schedulePolicy); - ((AzureRmRecoveryServicesBackupIaasVmPolicy)policy).SchedulePolicy = schedulePolicy; + ((AzureVmPolicy)policy).SchedulePolicy = schedulePolicy; Logger.Instance.WriteDebug("Validation of Schedule policy is successful"); } if (retentionPolicy != null) { ValidateAzureVMRetentionPolicy(retentionPolicy); - ((AzureRmRecoveryServicesBackupIaasVmPolicy)policy).RetentionPolicy = retentionPolicy; + ((AzureVmPolicy)policy).RetentionPolicy = retentionPolicy; Logger.Instance.WriteDebug("Validation of Retention policy is successful"); } // copy the backupSchedule time to retentionPolicy after converting to UTC CopyScheduleTimeToRetentionTimes( - (AzureRmRecoveryServicesBackupLongTermRetentionPolicy)((AzureRmRecoveryServicesBackupIaasVmPolicy)policy).RetentionPolicy, - (AzureRmRecoveryServicesBackupSimpleSchedulePolicy)((AzureRmRecoveryServicesBackupIaasVmPolicy)policy).SchedulePolicy); + (CmdletModel.LongTermRetentionPolicy)((AzureVmPolicy)policy).RetentionPolicy, + (CmdletModel.SimpleSchedulePolicy)((AzureVmPolicy)policy).SchedulePolicy); Logger.Instance.WriteDebug("Copy of RetentionTime from with SchedulePolicy to RetentionPolicy is successful"); // Now validate both RetentionPolicy and SchedulePolicy matches or not PolicyHelpers.ValidateLongTermRetentionPolicyWithSimpleRetentionPolicy( - (AzureRmRecoveryServicesBackupLongTermRetentionPolicy)((AzureRmRecoveryServicesBackupIaasVmPolicy)policy).RetentionPolicy, - (AzureRmRecoveryServicesBackupSimpleSchedulePolicy)((AzureRmRecoveryServicesBackupIaasVmPolicy)policy).SchedulePolicy); + (CmdletModel.LongTermRetentionPolicy)((AzureVmPolicy)policy).RetentionPolicy, + (CmdletModel.SimpleSchedulePolicy)((AzureVmPolicy)policy).SchedulePolicy); Logger.Instance.WriteDebug("Validation of Retention policy with Schedule policy is successful"); - // construct Hydra policy request - ProtectionPolicyRequest hydraRequest = new ProtectionPolicyRequest() + // construct Service Client policy request + ProtectionPolicyRequest serviceClientRequest = new ProtectionPolicyRequest() { Item = new ProtectionPolicyResource() { Properties = new AzureIaaSVMProtectionPolicy() { - RetentionPolicy = PolicyHelpers.GetHydraLongTermRetentionPolicy( - (AzureRmRecoveryServicesBackupLongTermRetentionPolicy)((AzureRmRecoveryServicesBackupIaasVmPolicy)policy).RetentionPolicy), - SchedulePolicy = PolicyHelpers.GetHydraSimpleSchedulePolicy( - (AzureRmRecoveryServicesBackupSimpleSchedulePolicy)((AzureRmRecoveryServicesBackupIaasVmPolicy)policy).SchedulePolicy) + RetentionPolicy = PolicyHelpers.GetServiceClientLongTermRetentionPolicy( + (CmdletModel.LongTermRetentionPolicy)((AzureVmPolicy)policy).RetentionPolicy), + SchedulePolicy = PolicyHelpers.GetServiceClientSimpleSchedulePolicy( + (CmdletModel.SimpleSchedulePolicy)((AzureVmPolicy)policy).SchedulePolicy) } } }; - return HydraAdapter.CreateOrUpdateProtectionPolicy(policy.Name, - hydraRequest); + return ServiceClientAdapter.CreateOrUpdateProtectionPolicy(policy.Name, + serviceClientRequest); } - public List ListProtectionContainers() + public List ListProtectionContainers() { Models.ContainerType containerType = (Models.ContainerType)this.ProviderData[ContainerParams.ContainerType]; Models.BackupManagementType? backupManagementTypeNullable = (Models.BackupManagementType?)this.ProviderData[ContainerParams.BackupManagementType]; @@ -398,29 +400,29 @@ public List ListProtectionContainers queryParams.RegistrationStatus = status.ToString(); } - var listResponse = HydraAdapter.ListContainers(queryParams); + var listResponse = ServiceClientAdapter.ListContainers(queryParams); - List containerModels = ConversionHelpers.GetContainerModelList(listResponse); + List containerModels = ConversionHelpers.GetContainerModelList(listResponse); // 4. Filter by RG Name if (!string.IsNullOrEmpty(resourceGroupName)) { containerModels = containerModels.Where(containerModel => - (containerModel as AzureRmRecoveryServicesBackupIaasVmContainer).ResourceGroupName == resourceGroupName).ToList(); + (containerModel as AzureVmContainer).ResourceGroupName == resourceGroupName).ToList(); } return containerModels; } - public List ListBackupManagementServers() + public List ListBackupManagementServers() { throw new NotImplementedException(); } - public List ListProtectedItems() + public List ListProtectedItems() { - AzureRmRecoveryServicesBackupContainerBase container = - (AzureRmRecoveryServicesBackupContainerBase)this.ProviderData[ItemParams.Container]; + ContainerBase container = + (ContainerBase)this.ProviderData[ItemParams.Container]; string name = (string)this.ProviderData[ItemParams.AzureVMName]; ItemProtectionStatus protectionStatus = (ItemProtectionStatus)this.ProviderData[ItemParams.ProtectionStatus]; @@ -437,10 +439,10 @@ public List ListProtectedItems() PaginationRequest paginationRequest = null; do { - var listResponse = HydraAdapter.ListProtectedItem(queryParams, paginationRequest); + var listResponse = ServiceClientAdapter.ListProtectedItem(queryParams, paginationRequest); protectedItems.AddRange(listResponse.ItemList.Value); - HydraHelpers.GetSkipTokenFromNextLink(listResponse.ItemList.NextLink, out skipToken); + ServiceClientHelpers.GetSkipTokenFromNextLink(listResponse.ItemList.NextLink, out skipToken); if (skipToken != null) { paginationRequest = new PaginationRequest(); @@ -480,26 +482,26 @@ public List ListProtectedItems() string containerUri = HelperUtils.GetContainerUri(dictionary, protectedItems[i].Id); string protectedItemUri = HelperUtils.GetProtectedItemUri(dictionary, protectedItems[i].Id); - var getResponse = HydraAdapter.GetProtectedItem(containerUri, protectedItemUri, getItemQueryParams); + var getResponse = ServiceClientAdapter.GetProtectedItem(containerUri, protectedItemUri, getItemQueryParams); protectedItemGetResponses.Add(getResponse); } } - List itemModels = ConversionHelpers.GetItemModelList(protectedItems); + List itemModels = ConversionHelpers.GetItemModelList(protectedItems); if (!string.IsNullOrEmpty(name)) { for (int i = 0; i < itemModels.Count; i++) { - AzureRmRecoveryServicesBackupIaasVmItemExtendedInfo extendedInfo = new AzureRmRecoveryServicesBackupIaasVmItemExtendedInfo(); - var hydraExtendedInfo = ((AzureIaaSVMProtectedItem)protectedItemGetResponses[i].Item.Properties).ExtendedInfo; - if (hydraExtendedInfo.OldestRecoveryPoint.HasValue) + AzureVmItemExtendedInfo extendedInfo = new AzureVmItemExtendedInfo(); + var serviceClientExtendedInfo = ((AzureIaaSVMProtectedItem)protectedItemGetResponses[i].Item.Properties).ExtendedInfo; + if (serviceClientExtendedInfo.OldestRecoveryPoint.HasValue) { - extendedInfo.OldestRecoveryPoint = hydraExtendedInfo.OldestRecoveryPoint; + extendedInfo.OldestRecoveryPoint = serviceClientExtendedInfo.OldestRecoveryPoint; } - extendedInfo.PolicyState = hydraExtendedInfo.PolicyInconsistent.ToString(); - extendedInfo.RecoveryPointCount = hydraExtendedInfo.RecoveryPointCount; - ((AzureRmRecoveryServicesBackupIaasVmItem)itemModels[i]).ExtendedInfo = extendedInfo; + extendedInfo.PolicyState = serviceClientExtendedInfo.PolicyInconsistent.ToString(); + extendedInfo.RecoveryPointCount = serviceClientExtendedInfo.RecoveryPointCount; + ((AzureVmItem)itemModels[i]).ExtendedInfo = extendedInfo; } } @@ -508,7 +510,7 @@ public List ListProtectedItems() { itemModels = itemModels.Where(itemModel => { - return ((AzureRmRecoveryServicesBackupIaasVmItem)itemModel).ProtectionStatus == protectionStatus; + return ((AzureVmItem)itemModel).ProtectionStatus == protectionStatus; }).ToList(); } @@ -517,7 +519,7 @@ public List ListProtectedItems() { itemModels = itemModels.Where(itemModel => { - return ((AzureRmRecoveryServicesBackupIaasVmItem)itemModel).ProtectionState == status; + return ((AzureVmItem)itemModel).ProtectionState == status; }).ToList(); } @@ -533,9 +535,9 @@ public List ListProtectedItems() return itemModels; } - public AzureRmRecoveryServicesBackupSchedulePolicyBase GetDefaultSchedulePolicyObject() + public SchedulePolicyBase GetDefaultSchedulePolicyObject() { - AzureRmRecoveryServicesBackupSimpleSchedulePolicy defaultSchedule = new AzureRmRecoveryServicesBackupSimpleSchedulePolicy(); + CmdletModel.SimpleSchedulePolicy defaultSchedule = new CmdletModel.SimpleSchedulePolicy(); //Default is daily scedule at 10:30 AM local time defaultSchedule.ScheduleRunFrequency = ScheduleRunType.Daily; @@ -549,9 +551,9 @@ public AzureRmRecoveryServicesBackupSchedulePolicyBase GetDefaultSchedulePolicyO return defaultSchedule; } - public AzureRmRecoveryServicesBackupRetentionPolicyBase GetDefaultRetentionPolicyObject() + public RetentionPolicyBase GetDefaultRetentionPolicyObject() { - AzureRmRecoveryServicesBackupLongTermRetentionPolicy defaultRetention = new AzureRmRecoveryServicesBackupLongTermRetentionPolicy(); + CmdletModel.LongTermRetentionPolicy defaultRetention = new CmdletModel.LongTermRetentionPolicy(); //Default time is 10:30 local time DateTime retentionTime = GenerateRandomTime(); @@ -677,12 +679,12 @@ private void ValidateAzureVMBackupManagementType(Models.BackupManagementType bac } } - private void ValidateAzureVMProtectionPolicy(AzureRmRecoveryServicesBackupPolicyBase policy) + private void ValidateAzureVMProtectionPolicy(PolicyBase policy) { - if (policy == null || policy.GetType() != typeof(AzureRmRecoveryServicesBackupIaasVmPolicy)) + if (policy == null || policy.GetType() != typeof(AzureVmPolicy)) { throw new ArgumentException(string.Format(Resources.InvalidProtectionPolicyException, - typeof(AzureRmRecoveryServicesBackupIaasVmPolicy).ToString())); + typeof(AzureVmPolicy).ToString())); } ValidateAzureVMWorkloadType(policy.WorkloadType); @@ -691,24 +693,24 @@ private void ValidateAzureVMProtectionPolicy(AzureRmRecoveryServicesBackupPolicy policy.Validate(); } - private void ValidateAzureVMSchedulePolicy(AzureRmRecoveryServicesBackupSchedulePolicyBase policy) + private void ValidateAzureVMSchedulePolicy(SchedulePolicyBase policy) { - if (policy == null || policy.GetType() != typeof(AzureRmRecoveryServicesBackupSimpleSchedulePolicy)) + if (policy == null || policy.GetType() != typeof(CmdletModel.SimpleSchedulePolicy)) { throw new ArgumentException(string.Format(Resources.InvalidSchedulePolicyException, - typeof(AzureRmRecoveryServicesBackupSimpleSchedulePolicy).ToString())); + typeof(CmdletModel.SimpleSchedulePolicy).ToString())); } // call validation policy.Validate(); } - private void ValidateAzureVMRetentionPolicy(AzureRmRecoveryServicesBackupRetentionPolicyBase policy) + private void ValidateAzureVMRetentionPolicy(RetentionPolicyBase policy) { - if (policy == null || policy.GetType() != typeof(AzureRmRecoveryServicesBackupLongTermRetentionPolicy)) + if (policy == null || policy.GetType() != typeof(CmdletModel.LongTermRetentionPolicy)) { throw new ArgumentException(string.Format(Resources.InvalidRetentionPolicyException, - typeof(AzureRmRecoveryServicesBackupLongTermRetentionPolicy).ToString())); + typeof(CmdletModel.LongTermRetentionPolicy).ToString())); } // call validation @@ -716,7 +718,7 @@ private void ValidateAzureVMRetentionPolicy(AzureRmRecoveryServicesBackupRetenti } private void ValidateAzureVMEnableProtectionRequest(string vmName, string serviceName, string rgName, - AzureRmRecoveryServicesBackupPolicyBase policy) + PolicyBase policy) { if (string.IsNullOrEmpty(vmName)) { @@ -728,31 +730,31 @@ private void ValidateAzureVMEnableProtectionRequest(string vmName, string servic } } - private void ValidateAzureVMModifyProtectionRequest(AzureRmRecoveryServicesBackupItemBase itemBase, - AzureRmRecoveryServicesBackupPolicyBase policy) + private void ValidateAzureVMModifyProtectionRequest(ItemBase itemBase, + PolicyBase policy) { - if (itemBase == null || itemBase.GetType() != typeof(AzureRmRecoveryServicesBackupIaasVmItem)) + if (itemBase == null || itemBase.GetType() != typeof(AzureVmItem)) { throw new ArgumentException(string.Format(Resources.InvalidProtectionPolicyException, - typeof(AzureRmRecoveryServicesBackupIaasVmItem).ToString())); + typeof(AzureVmItem).ToString())); } - if (string.IsNullOrEmpty(((AzureRmRecoveryServicesBackupIaasVmItem)itemBase).VirtualMachineId)) + if (string.IsNullOrEmpty(((AzureVmItem)itemBase).VirtualMachineId)) { throw new ArgumentException(Resources.VirtualMachineIdIsEmptyOrNull); } } - private void ValidateAzureVMDisableProtectionRequest(AzureRmRecoveryServicesBackupItemBase itemBase) + private void ValidateAzureVMDisableProtectionRequest(ItemBase itemBase) { - if (itemBase == null || itemBase.GetType() != typeof(AzureRmRecoveryServicesBackupIaasVmItem)) + if (itemBase == null || itemBase.GetType() != typeof(AzureVmItem)) { throw new ArgumentException(string.Format(Resources.InvalidProtectionPolicyException, - typeof(AzureRmRecoveryServicesBackupIaasVmItem).ToString())); + typeof(AzureVmItem).ToString())); } - if (string.IsNullOrEmpty(((AzureRmRecoveryServicesBackupIaasVmItem)itemBase).VirtualMachineId)) + if (string.IsNullOrEmpty(((AzureVmItem)itemBase).VirtualMachineId)) { throw new ArgumentException(Resources.VirtualMachineIdIsEmptyOrNull); } @@ -816,14 +818,14 @@ private bool IsDiscoveryNeeded(string vmName, string rgName, bool isComputeAzure string virtualMachineId = GetAzureIaasVirtualMachineId(rgName, vmVersion, vmName); ProtectableObjectListQueryParameters queryParam = new ProtectableObjectListQueryParameters(); - // --- TBD To be added once bug is fixed in hydra and service + // --- TBD To be added once bug is fixed in Service Client and service //queryParam.ProviderType = ProviderType.AzureIaasVM.ToString(); //queryParam.FriendlyName = vmName; // No need to use skip or top token here as no pagination support of IaaSVM PO. //First check if container is discovered or not - var protectableItemList = HydraAdapter.ListProtectableItem(queryParam).ItemList; + var protectableItemList = ServiceClientAdapter.ListProtectableItem(queryParam).ItemList; Logger.Instance.WriteDebug(String.Format(Resources.ContainerCountAfterFilter, protectableItemList.ProtectableObjects.Count())); if (protectableItemList.ProtectableObjects.Count() == 0) @@ -855,7 +857,7 @@ private bool IsDiscoveryNeeded(string vmName, string rgName, bool isComputeAzure private void RefreshContainer() { string errorMessage = string.Empty; - var refreshContainerJobResponse = HydraAdapter.RefreshContainers(); + var refreshContainerJobResponse = ServiceClientAdapter.RefreshContainers(); //Now wait for the operation to Complete if (refreshContainerJobResponse.StatusCode != System.Net.HttpStatusCode.NoContent) @@ -872,7 +874,7 @@ private HttpStatusCode TrackRefreshContainerOperation(string operationResultLink { try { - var response = HydraAdapter.GetRefreshContainerOperationResultByURL(operationResultLink); + var response = ServiceClientAdapter.GetRefreshContainerOperationResultByURL(operationResultLink); status = response.StatusCode; TestMockSupport.Delay(checkFrequency); @@ -905,8 +907,8 @@ private static string GetAzureIaasVirtualMachineId(string resourceGroup, string return string.Format(IaasVMIdFormat, resourceGroup, vmVersion, name); } - private void CopyScheduleTimeToRetentionTimes(AzureRmRecoveryServicesBackupLongTermRetentionPolicy retPolicy, - AzureRmRecoveryServicesBackupSimpleSchedulePolicy schPolicy) + private void CopyScheduleTimeToRetentionTimes(CmdletModel.LongTermRetentionPolicy retPolicy, + CmdletModel.SimpleSchedulePolicy schPolicy) { // schedule runTimes is already validated if in UTC/not during validate() // now copy times from schedule to retention policy diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Providers/Providers/MabPsBackupProvider.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Providers/Providers/MabPsBackupProvider.cs index 6d6c41f698f1..e9b13ee4cc91 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Providers/Providers/MabPsBackupProvider.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Providers/Providers/MabPsBackupProvider.cs @@ -19,20 +19,21 @@ using System.Threading.Tasks; using Microsoft.Azure.Management.RecoveryServices.Backup.Models; using Microsoft.Azure.Commands.RecoveryServices.Backup.Helpers; +using CmdletModel = Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models; using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models; -using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.HydraAdapterNS; +using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ServiceClientAdapterNS; namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ProviderModel { public class MabPsBackupProvider : IPsBackupProvider { Dictionary ProviderData { get; set; } - HydraAdapter HydraAdapter { get; set; } + ServiceClientAdapter ServiceClientAdapter { get; set; } - public void Initialize(Dictionary providerData, HydraAdapter hydraAdapter) + public void Initialize(Dictionary providerData, ServiceClientAdapter serviceClientAdapter) { this.ProviderData = providerData; - this.HydraAdapter = hydraAdapter; + this.ServiceClientAdapter = serviceClientAdapter; } public Management.RecoveryServices.Backup.Models.BaseRecoveryServicesJobResponse EnableProtection() @@ -60,12 +61,12 @@ public Management.RecoveryServices.Backup.Models.ProtectedItemResponse GetProtec throw new NotImplementedException(); } - public AzureRmRecoveryServicesBackupRecoveryPointBase GetRecoveryPointDetails() + public CmdletModel.RecoveryPointBase GetRecoveryPointDetails() { throw new NotImplementedException(); } - public List ListRecoveryPoints() + public List ListRecoveryPoints() { throw new NotImplementedException(); } @@ -80,7 +81,7 @@ public ProtectionPolicyResponse ModifyPolicy() throw new NotImplementedException(); } - public List ListProtectionContainers() + public List ListProtectionContainers() { string name = (string)this.ProviderData[ContainerParams.Name]; @@ -92,14 +93,14 @@ public ProtectionPolicyResponse ModifyPolicy() // 2. Filter by ContainerType queryParams.BackupManagementType = Microsoft.Azure.Management.RecoveryServices.Backup.Models.BackupManagementType.MAB.ToString(); - var listResponse = HydraAdapter.ListContainers(queryParams); + var listResponse = ServiceClientAdapter.ListContainers(queryParams); - List containerModels = ConversionHelpers.GetContainerModelList(listResponse); + List containerModels = ConversionHelpers.GetContainerModelList(listResponse); return containerModels; } - public List ListBackupManagementServers() + public List ListBackupManagementServers() { throw new NotImplementedException(); } @@ -114,17 +115,17 @@ public void DeletePolicy() throw new NotImplementedException(); } - public AzureRmRecoveryServicesBackupSchedulePolicyBase GetDefaultSchedulePolicyObject() + public SchedulePolicyBase GetDefaultSchedulePolicyObject() { throw new NotImplementedException(); } - public AzureRmRecoveryServicesBackupRetentionPolicyBase GetDefaultRetentionPolicyObject() + public RetentionPolicyBase GetDefaultRetentionPolicyObject() { throw new NotImplementedException(); } - public List ListProtectedItems() + public List ListProtectedItems() { throw new NotImplementedException(); } diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Providers/PsBackupProviderManager.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Providers/PsBackupProviderManager.cs index 737c886f4626..45add51e9ea2 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Providers/PsBackupProviderManager.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Providers/PsBackupProviderManager.cs @@ -12,7 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.HydraAdapterNS; +using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ServiceClientAdapterNS; using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models; using Microsoft.Azure.Commands.RecoveryServices.Backup.Properties; using System; @@ -26,12 +26,12 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ProviderModel public class PsBackupProviderManager { Dictionary providerData; - HydraAdapter hydraAdapter; + ServiceClientAdapter serviceClientAdapter; - public PsBackupProviderManager(Dictionary providerDataIn, HydraAdapter hydraAdapterIn) + public PsBackupProviderManager(Dictionary providerDataIn, ServiceClientAdapter serviceClientAdapterIn) { providerData = providerDataIn; - hydraAdapter = hydraAdapterIn; + serviceClientAdapter = serviceClientAdapterIn; } public IPsBackupProvider GetProviderInstance(ContainerType containerType, BackupManagementType? backupManagementType) @@ -130,7 +130,7 @@ public IPsBackupProvider GetProviderInstance(PsBackupProviderTypes providerType) break; } - psBackupProvider.Initialize(providerData, hydraAdapter); + psBackupProvider.Initialize(providerData, serviceClientAdapter); return psBackupProvider; } diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/BMSAPIs/ContainerAPIs.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/ContainerAPIs.cs similarity index 98% rename from src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/BMSAPIs/ContainerAPIs.cs rename to src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/ContainerAPIs.cs index 31df9ee33536..f7fb3c2c5384 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/BMSAPIs/ContainerAPIs.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/ContainerAPIs.cs @@ -20,9 +20,9 @@ using System.Text; using System.Threading.Tasks; -namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.HydraAdapterNS +namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ServiceClientAdapterNS { - public partial class HydraAdapter + public partial class ServiceClientAdapter { /// /// Fetches protection containers in the vault according to the query params diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/BMSAPIs/ItemAPIs.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/ItemAPIs.cs similarity index 98% rename from src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/BMSAPIs/ItemAPIs.cs rename to src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/ItemAPIs.cs index ead662f3ef4d..668c9590a353 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/BMSAPIs/ItemAPIs.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/ItemAPIs.cs @@ -19,9 +19,9 @@ using System.Threading.Tasks; using Microsoft.Azure.Management.RecoveryServices.Backup.Models; -namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.HydraAdapterNS +namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ServiceClientAdapterNS { - public partial class HydraAdapter + public partial class ServiceClientAdapter { public BaseRecoveryServicesJobResponse CreateOrUpdateProtectedItem( string containerName, diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/BMSAPIs/JobAPIs.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/JobAPIs.cs similarity index 98% rename from src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/BMSAPIs/JobAPIs.cs rename to src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/JobAPIs.cs index d1a14c0b1cb1..fd4c46fc9e18 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/BMSAPIs/JobAPIs.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/JobAPIs.cs @@ -15,9 +15,9 @@ using System; using Microsoft.Azure.Management.RecoveryServices.Backup.Models; -namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.HydraAdapterNS +namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ServiceClientAdapterNS { - public partial class HydraAdapter + public partial class ServiceClientAdapter { public JobResponse GetJob(string jobId) { diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/BMSAPIs/OperationStatusAPIs.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/OperationStatusAPIs.cs similarity index 96% rename from src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/BMSAPIs/OperationStatusAPIs.cs rename to src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/OperationStatusAPIs.cs index 2f5a4e7b55f8..69c31ff04c10 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/BMSAPIs/OperationStatusAPIs.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/OperationStatusAPIs.cs @@ -19,9 +19,9 @@ using System.Threading.Tasks; using Microsoft.Azure.Management.RecoveryServices.Backup.Models; -namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.HydraAdapterNS +namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ServiceClientAdapterNS { - public partial class HydraAdapter + public partial class ServiceClientAdapter { public BaseRecoveryServicesJobResponse GetRefreshContainerOperationResultByURL( string operationResultLink) diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/BMSAPIs/PolicyAPIs.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/PolicyAPIs.cs similarity index 98% rename from src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/BMSAPIs/PolicyAPIs.cs rename to src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/PolicyAPIs.cs index 00a3613217bb..71eff3bfd899 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/BMSAPIs/PolicyAPIs.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/PolicyAPIs.cs @@ -19,9 +19,9 @@ using System.Collections.Generic; using Microsoft.Azure.Management.RecoveryServices.Backup.Models; -namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.HydraAdapterNS +namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ServiceClientAdapterNS { - public partial class HydraAdapter + public partial class ServiceClientAdapter { public ProtectionPolicyResponse CreateOrUpdateProtectionPolicy( string policyName, diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/BMSAPIs/ProtectableItemAPI.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/ProtectableItemAPI.cs similarity index 94% rename from src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/BMSAPIs/ProtectableItemAPI.cs rename to src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/ProtectableItemAPI.cs index 6a89cd1c8fe7..a009b1b9e7bf 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/BMSAPIs/ProtectableItemAPI.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/ProtectableItemAPI.cs @@ -19,9 +19,9 @@ using System.Threading.Tasks; using Microsoft.Azure.Management.RecoveryServices.Backup.Models; -namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.HydraAdapterNS +namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ServiceClientAdapterNS { - public partial class HydraAdapter + public partial class ServiceClientAdapter { public ProtectableObjectListResponse ListProtectableItem( ProtectableObjectListQueryParameters queryFilter, @@ -45,7 +45,7 @@ public BaseRecoveryServicesJobResponse TriggerBackup(string containerName, strin BmsAdapter.GetResourceGroupName(), BmsAdapter.GetResourceName(), BmsAdapter.GetCustomRequestHeaders(), - HydraAdapter.AzureFabricName, + ServiceClientAdapter.AzureFabricName, containerName, itemName, BmsAdapter.CmdletCancellationToken).Result; diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/BMSAPIs/RecoveryPointsAPIs.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/RecoveryPointsAPIs.cs similarity index 96% rename from src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/BMSAPIs/RecoveryPointsAPIs.cs rename to src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/RecoveryPointsAPIs.cs index d86fe7ec8c6e..dc1d261b91ce 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/BMSAPIs/RecoveryPointsAPIs.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/RecoveryPointsAPIs.cs @@ -19,9 +19,9 @@ using System.Text; using System.Threading.Tasks; -namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.HydraAdapterNS +namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ServiceClientAdapterNS { - public partial class HydraAdapter + public partial class ServiceClientAdapter { public RecoveryPointResponse GetRecoveryPointDetails(string containerName, string protectedItemName, string recoveryPointId) diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/BMSAPIs/RestoreDiskAPIs.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/RestoreDiskAPIs.cs similarity index 96% rename from src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/BMSAPIs/RestoreDiskAPIs.cs rename to src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/RestoreDiskAPIs.cs index 4322c5fdb7b7..b2cdd7762dfa 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/BMSAPIs/RestoreDiskAPIs.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/BMSAPIs/RestoreDiskAPIs.cs @@ -21,12 +21,12 @@ using System.Threading.Tasks; using Microsoft.Azure.Commands.RecoveryServices.Backup.Properties; -namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.HydraAdapterNS +namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ServiceClientAdapterNS { - public partial class HydraAdapter + public partial class ServiceClientAdapter { - public BaseRecoveryServicesJobResponse RestoreDisk(AzureRmRecoveryServicesBackupIaasVmRecoveryPoint rp, string storageAccountId, + public BaseRecoveryServicesJobResponse RestoreDisk(AzureVmRecoveryPoint rp, string storageAccountId, string storageAccountLocation, string storageAccountType) { string resourceGroupName = BmsAdapter.GetResourceGroupName(); diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/ClientProxy.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/ClientProxy.cs similarity index 98% rename from src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/ClientProxy.cs rename to src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/ClientProxy.cs index 04b98156676d..0d35ab13008e 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/ClientProxy.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/ClientProxy.cs @@ -20,7 +20,7 @@ using System.Text; using System.Threading.Tasks; -namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.HydraAdapterNS +namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ServiceClientAdapterNS { public partial class ClientProxy : ClientProxyBase where TClient : ServiceClient diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/ClientProxyBase.cs b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/ClientProxyBase.cs similarity index 99% rename from src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/ClientProxyBase.cs rename to src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/ClientProxyBase.cs index ed9b9744bce1..8e27685ab5b2 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/ClientProxyBase.cs +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/ClientProxyBase.cs @@ -22,7 +22,7 @@ using Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models; using Microsoft.Azure.Commands.RecoveryServices.Backup.Properties; -namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.HydraAdapterNS +namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ServiceClientAdapterNS { public class ClientProxyBase { diff --git a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/Commands.RecoveryServices.Backup.HydraAdapter.csproj b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/Commands.RecoveryServices.Backup.ServiceClientAdapter.csproj similarity index 94% rename from src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/Commands.RecoveryServices.Backup.HydraAdapter.csproj rename to src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/Commands.RecoveryServices.Backup.ServiceClientAdapter.csproj index f1393db4f58c..1e8d954865dd 100644 --- a/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.HydraAdapter/Commands.RecoveryServices.Backup.HydraAdapter.csproj +++ b/src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/Commands.RecoveryServices.Backup.ServiceClientAdapter.csproj @@ -7,8 +7,8 @@ {B758FEC1-35C1-4F93-A954-66DD33F6E0EC} Library Properties - Microsoft.Azure.Commands.RecoveryServices.Backup.HydraAdapter - Microsoft.Azure.Commands.RecoveryServices.Backup.HydraAdapter + Microsoft.Azure.Commands.RecoveryServices.Backup.ServiceClientAdapter + Microsoft.Azure.Commands.RecoveryServices.Backup.ServiceClientAdapter v4.5 512 @@ -36,7 +36,7 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - + False ..\..\..\packages\Microsoft.Azure.Management.RecoveryServices.Backup.0.1.0-preview\lib\net40\Microsoft.Azure.Management.RecoveryServices.Backup.dll @@ -66,7 +66,7 @@ - + @@ -88,7 +88,9 @@ - + + Designer +