Skip to content

Commit 648930b

Browse files
author
Samuel Anudeep
committed
Changelog update
Formatting changes Removed extra empty lines sorted and pruned usings
1 parent 0e8d939 commit 648930b

File tree

58 files changed

+274
-280
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+274
-280
lines changed

ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@
9898
* Add-AzureRmAccount
9999
- Add position for Credential parameter so the following command is allowed: Add-AzureRmAccount (Get-Credential)
100100
- Updated parameter sets so the SubscriptionId and SubscriptionName are mutually exclusive
101+
* RecoveryServices.Backup
102+
* Migrated from Hyak based Azure SDK to Swagger based Azure SDK
101103
* Resources
102104
* Lookup of AAD group by Id now uses GetObjectsByObjectId AAD Graph call instead of Groups/<id>
103105
- This will enable Groups lookup in CSP scenario

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Conversions/ConversionHelpers.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public static BackupEngineBase GetBackupEngineModel(
6767
backupEngine.Properties != null)
6868
{
6969
string friendlyName = backupEngine.Properties.FriendlyName;
70-
string backupManagementType =
70+
string backupManagementType =
7171
backupEngine.Properties.BackupManagementType.ToString();
7272
string registrationStatus = backupEngine.Properties.RegistrationStatus;
7373
string healthStatus = backupEngine.Properties.HealthStatus;
@@ -220,7 +220,7 @@ public static List<PolicyBase> GetPolicyModelList(
220220
List<PolicyBase> policyModels = new List<PolicyBase>();
221221
PolicyBase policyModel = null;
222222

223-
foreach (ServiceClientModel.ProtectionPolicyResource resource
223+
foreach (ServiceClientModel.ProtectionPolicyResource resource
224224
in serviceClientListResponse)
225225
{
226226
policyModel = GetPolicyModel(resource);
@@ -270,7 +270,7 @@ public static ItemBase GetItemModel(ServiceClientModel.ProtectedItemResource pro
270270
policyName);
271271
}
272272

273-
if (protectedItem.Properties.GetType() ==
273+
if (protectedItem.Properties.GetType() ==
274274
typeof(ServiceClientModel.AzureSqlProtectedItem))
275275
{
276276
ServiceClientModel.AzureSqlProtectedItem azureSqlProtectedItem =

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Conversions/JobConversions.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ public static CmdletModel.JobBase GetPSJob(JobResource serviceClientJob)
5151
/// Helper function to convert ps backup job list model from service response.
5252
/// </summary>
5353
public static void AddServiceClientJobsToPSList(
54-
List<JobResource> serviceClientJobs,
55-
List<CmdletModel.JobBase> psJobs,
54+
List<JobResource> serviceClientJobs,
55+
List<CmdletModel.JobBase> psJobs,
5656
ref int jobsCount)
5757
{
58-
if (serviceClientJobs != null )
58+
if (serviceClientJobs != null)
5959
{
6060
foreach (var job in serviceClientJobs)
6161
{
@@ -105,7 +105,7 @@ private static CmdletModel.AzureVmJob GetPSAzureVmJob(JobResource serviceClientJ
105105
throw new ArgumentNullException("Job Start Time is null");
106106
}
107107
response.EndTime = vmJob.EndTime;
108-
response.Duration =
108+
response.Duration =
109109
vmJob.Duration.HasValue ? (TimeSpan)vmJob.Duration : default(TimeSpan);
110110
response.Status = vmJob.Status;
111111
response.VmVersion = vmJob.VirtualMachineVersion;
@@ -219,7 +219,7 @@ public static string GetPSBackupManagementType(string jobType)
219219
throw new Exception("Invalid JobType provided: " + jobType);
220220
}
221221
}
222-
222+
223223
#endregion
224224
}
225225
}

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Conversions/RecoveryPointConversions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ public static RecoveryPointBase GetPSAzureRecoveryPoints(
160160
throw new ArgumentNullException("RecoveryPointTime is null");
161161
}
162162

163-
bool isInstantILRSessionActive =
164-
recPoint.IsInstantILRSessionActive.HasValue ?
163+
bool isInstantILRSessionActive =
164+
recPoint.IsInstantILRSessionActive.HasValue ?
165165
(bool)recPoint.IsInstantILRSessionActive : false;
166166
AzureVmRecoveryPoint vmResult = new AzureVmRecoveryPoint()
167167
{

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Conversions/RetentionPolicyConversions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ private static ServiceClientModel.YearlyRetentionSchedule GetServiceClientLTRYea
540540
{
541541
serviceClientYearly.RetentionScheduleWeekly = GetServiceClientLTRWeeklyRetentionFormat(psYearly.RetentionScheduleWeekly);
542542
}
543-
serviceClientYearly.MonthsOfYear =
543+
serviceClientYearly.MonthsOfYear =
544544
HelperUtils.EnumListConverter<Month, ServiceClientModel.MonthOfYear>(
545545
psYearly.MonthsOfYear).Cast<ServiceClientModel.MonthOfYear?>().ToList();
546546

@@ -587,13 +587,13 @@ private static ServiceClientModel.WeeklyRetentionFormat GetServiceClientLTRWeekl
587587
ServiceClientModel.WeeklyRetentionFormat serviceClientFormat = new ServiceClientModel.WeeklyRetentionFormat();
588588
if (psFormat.DaysOfTheWeek != null)
589589
{
590-
serviceClientFormat.DaysOfTheWeek =
590+
serviceClientFormat.DaysOfTheWeek =
591591
HelperUtils.EnumListConverter<DayOfWeek, ServiceClientModel.DayOfWeek>(
592592
psFormat.DaysOfTheWeek).Cast<ServiceClientModel.DayOfWeek?>().ToList();
593593
}
594594
if (psFormat.WeeksOfTheMonth != null)
595595
{
596-
serviceClientFormat.WeeksOfTheMonth =
596+
serviceClientFormat.WeeksOfTheMonth =
597597
HelperUtils.EnumListConverter<WeekOfMonth, ServiceClientModel.WeekOfMonth>(
598598
psFormat.WeeksOfTheMonth).Cast<ServiceClientModel.WeekOfMonth?>().ToList();
599599
}

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Conversions/SchedulePolicyConversions.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ public static SimpleSchedulePolicy GetPSSimpleSchedulePolicy(
4040

4141
SimpleSchedulePolicy psPolicy = new SimpleSchedulePolicy();
4242

43-
psPolicy.ScheduleRunDays =
43+
psPolicy.ScheduleRunDays =
4444
HelperUtils.EnumListConverter<ServiceClientModel.DayOfWeek?, DayOfWeek>(
4545
serviceClientPolicy.ScheduleRunDays);
46-
psPolicy.ScheduleRunFrequency =
46+
psPolicy.ScheduleRunFrequency =
4747
(ScheduleRunType)Enum.Parse(
4848
typeof(ScheduleRunType), serviceClientPolicy.ScheduleRunFrequency.ToString());
4949
psPolicy.ScheduleRunTimes = ParseDateTimesToUTC(serviceClientPolicy.ScheduleRunTimes);
@@ -73,15 +73,15 @@ public static List<DateTime> ParseDateTimesToUTC(IList<DateTime?> localTimes)
7373

7474
foreach (DateTime localTime in localTimes)
7575
{
76-
if(localTime == null)
76+
if (localTime == null)
7777
{
7878
throw new ArgumentNullException("Policy date time object is null");
7979
}
8080
temp = localTime;
8181
if (localTime.Kind != DateTimeKind.Utc)
8282
{
8383
temp = localTime.ToUniversalTime();
84-
}
84+
}
8585
utcTimes.Add(temp);
8686
}
8787

@@ -100,17 +100,17 @@ public static ServiceClientModel.SimpleSchedulePolicy GetServiceClientSimpleSche
100100
}
101101

102102
ServiceClientModel.SimpleSchedulePolicy serviceClientPolicy = new ServiceClientModel.SimpleSchedulePolicy();
103-
serviceClientPolicy.ScheduleRunFrequency =
103+
serviceClientPolicy.ScheduleRunFrequency =
104104
psPolicy.ScheduleRunFrequency.ToEnum<ServiceClientModel.ScheduleRunType>();
105105

106106
if (psPolicy.ScheduleRunFrequency == ScheduleRunType.Weekly)
107107
{
108-
serviceClientPolicy.ScheduleRunDays =
108+
serviceClientPolicy.ScheduleRunDays =
109109
HelperUtils.EnumListConverter<DayOfWeek, ServiceClientModel.DayOfWeek>(
110110
psPolicy.ScheduleRunDays).Cast<ServiceClientModel.DayOfWeek?>().ToList();
111111
}
112-
serviceClientPolicy.ScheduleRunTimes =
113-
psPolicy.ScheduleRunTimes.ConvertAll(dateTime => (DateTime?) dateTime);
112+
serviceClientPolicy.ScheduleRunTimes =
113+
psPolicy.ScheduleRunTimes.ConvertAll(dateTime => (DateTime?)dateTime);
114114
return serviceClientPolicy;
115115
}
116116

@@ -126,7 +126,7 @@ public static ServiceClientModel.SimpleSchedulePolicy GetServiceClientSimpleSche
126126
}
127127

128128
List<DateTime?> convertedTime = new List<DateTime?>();
129-
129+
130130
foreach (DateTime localTime in localTimes)
131131
{
132132
convertedTime.Add(localTime);

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Extensions/EnumExtensions.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
// ----------------------------------------------------------------------------------
1414

1515
using System;
16-
using System.Linq;
17-
using System.Net.Http.Headers;
1816

1917
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Helpers
2018
{

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/ServiceClientHelpers.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public static string GetServiceClientProviderType(CmdletModel.WorkloadType workl
8787
/// </summary>
8888
/// <param name="backupManagementType">Powershell backup management type</param>
8989
/// <returns>Service backup management type</returns>
90-
public static ServiceClientModel.BackupManagementType?
90+
public static ServiceClientModel.BackupManagementType?
9191
GetServiceClientBackupManagementType(
9292
CmdletModel.BackupManagementType? backupManagementType)
9393
{
@@ -115,7 +115,7 @@ public static ServiceClientModel.BackupManagementType?
115115
/// </summary>
116116
/// <param name="backupManagementType"></param>
117117
/// <returns>service backup management type</returns>
118-
public static ServiceClientModel.BackupManagementType?
118+
public static ServiceClientModel.BackupManagementType?
119119
GetServiceClientBackupManagementType(string backupManagementType)
120120
{
121121
ServiceClientModel.BackupManagementType? providerType = null;
@@ -127,7 +127,6 @@ public static ServiceClientModel.BackupManagementType?
127127

128128
return GetServiceClientBackupManagementType(
129129
backupManagementType.ToEnum<CmdletModel.BackupManagementType>());
130-
131130
}
132131

133132
/// <summary>

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/TrackingHelpers.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static T GetOperationStatus<T>(RestAzureNS.AzureOperationResponse respons
4242

4343
var opStatusResponse = getOpStatus(operationId);
4444

45-
while (opStatusResponse.Body.Status ==
45+
while (opStatusResponse.Body.Status ==
4646
ServiceClientModel.OperationStatusValues.InProgress)
4747
{
4848
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
@@ -70,7 +70,7 @@ public static T GetOperationStatus<T, S>(RestAzureNS.AzureOperationResponse<S> r
7070

7171
var opStatusResponse = getOpStatus(operationId);
7272

73-
while (opStatusResponse.Body.Status ==
73+
while (opStatusResponse.Body.Status ==
7474
ServiceClientModel.OperationStatusValues.InProgress)
7575
{
7676
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Helpers/Validations/PolicyValidations.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static void ValidateLongTermRetentionPolicyWithSimpleRetentionPolicy(
4141
// for weekly schedule, daily retention policy should be NULL
4242
// AND weekly retention policy is required
4343
if (schPolicy.ScheduleRunFrequency == ScheduleRunType.Weekly &&
44-
(ltrPolicy.IsDailyScheduleEnabled != false || ltrPolicy.WeeklySchedule == null ||
44+
(ltrPolicy.IsDailyScheduleEnabled != false || ltrPolicy.WeeklySchedule == null ||
4545
(ltrPolicy.IsWeeklyScheduleEnabled == false)))
4646
{
4747
throw new ArgumentException(Resources.WeeklyRetentionScheduleNullException);
@@ -78,14 +78,14 @@ public static void ValidateLongTermRetentionPolicyWithSimpleRetentionPolicy(
7878

7979
// if backupSchedule is weekly, then user cannot choose 'Daily Retention format'
8080
if (schPolicy.ScheduleRunFrequency == ScheduleRunType.Weekly &&
81-
ltrPolicy.MonthlySchedule.RetentionScheduleFormatType
81+
ltrPolicy.MonthlySchedule.RetentionScheduleFormatType
8282
== RetentionScheduleFormat.Daily)
8383
{
8484
throw new ArgumentException(Resources.MonthlyYearlyInvalidDailyRetentionFormatTypeException);
8585
}
8686

8787
// for monthly and weeklyFormat, validate days of week
88-
if (ltrPolicy.MonthlySchedule.RetentionScheduleFormatType
88+
if (ltrPolicy.MonthlySchedule.RetentionScheduleFormatType
8989
== RetentionScheduleFormat.Weekly &&
9090
schPolicy.ScheduleRunFrequency == ScheduleRunType.Weekly)
9191
{
@@ -101,14 +101,14 @@ public static void ValidateLongTermRetentionPolicyWithSimpleRetentionPolicy(
101101

102102
// if backupSchedule is weekly, then user cannot choose 'Daily Retention format'
103103
if (schPolicy.ScheduleRunFrequency == ScheduleRunType.Weekly &&
104-
ltrPolicy.YearlySchedule.RetentionScheduleFormatType
104+
ltrPolicy.YearlySchedule.RetentionScheduleFormatType
105105
== RetentionScheduleFormat.Daily)
106106
{
107107
throw new ArgumentException(Resources.MonthlyYearlyInvalidDailyRetentionFormatTypeException);
108108
}
109109

110110
// for yearly and weeklyFormat, validate days of week
111-
if (ltrPolicy.YearlySchedule.RetentionScheduleFormatType
111+
if (ltrPolicy.YearlySchedule.RetentionScheduleFormatType
112112
== RetentionScheduleFormat.Weekly &&
113113
schPolicy.ScheduleRunFrequency == ScheduleRunType.Weekly)
114114
{
@@ -143,11 +143,11 @@ private static void ValidateRetentionAndScheduleDaysOfWeek(List<DayOfWeek> schLi
143143
{
144144
if (!schList.Contains(day))
145145
{
146-
throw new ArgumentException(Resources.MonthlyYearlyRetentionDaysOfWeekException);
146+
throw new ArgumentException(Resources.MonthlyYearlyRetentionDaysOfWeekException);
147147
}
148148
}
149149
}
150-
150+
151151
#endregion
152152
}
153153
}

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureSqlModels/AzureSqlContainer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public AzureSqlContainer(
3535
ServiceClientModel.ProtectionContainerResource protectionContainer)
3636
: base(protectionContainer)
3737
{
38-
ServiceClientModel.AzureSqlContainer sqlProtectionContainer =
38+
ServiceClientModel.AzureSqlContainer sqlProtectionContainer =
3939
(ServiceClientModel.AzureSqlContainer)protectionContainer.Properties;
4040
Status = EnumUtils.GetEnum<ContainerRegistrationStatus>(
4141
sqlProtectionContainer.RegistrationStatus);

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureSqlModels/AzureSqlItem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public AzureSqlItem(ProtectedItemResource protectedItemResource,
5454
string containerName, ContainerType containerType, string policyName)
5555
: base(protectedItemResource, containerName, containerType)
5656
{
57-
AzureSqlProtectedItem protectedItem =
57+
AzureSqlProtectedItem protectedItem =
5858
(AzureSqlProtectedItem)protectedItemResource.Properties;
5959
ProtectedItemDataId = protectedItem.ProtectedItemDataId;
6060
ProtectionState = protectedItem.ProtectionState.ToString();

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureVmContainer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class AzureVmContainer : ContainerBase
4444
public AzureVmContainer(ProtectionContainerResource protectionContainer)
4545
: base(protectionContainer)
4646
{
47-
IaaSVMContainer iaasVmProtectionContainer =
47+
IaaSVMContainer iaasVmProtectionContainer =
4848
(IaaSVMContainer)protectionContainer.Properties;
4949
ResourceGroupName = IdUtils.GetResourceGroupName(protectionContainer.Id);
5050
FriendlyName = iaasVmProtectionContainer.FriendlyName;

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/AzureVmModels/AzureVmItem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public AzureVmItem(ProtectedItemResource protectedItemResource,
6464
AzureIaaSVMProtectedItem protectedItem = (AzureIaaSVMProtectedItem)protectedItemResource.Properties;
6565
LastBackupStatus = protectedItem.LastBackupStatus;
6666
ProtectionPolicyName = policyName;
67-
ProtectionState =
67+
ProtectionState =
6868
EnumUtils.GetEnum<ItemProtectionState>(protectedItem.ProtectionState.ToString());
6969
ProtectionStatus = EnumUtils.GetEnum<ItemProtectionStatus>(protectedItem.ProtectionStatus);
7070
VirtualMachineId = protectedItem.VirtualMachineId;

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/BaseObjects.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public ContainerContext(ContainerType containerType, string backupManagementType
6969
public ContainerContext(string backupManagementType)
7070
: base(backupManagementType)
7171
{
72-
72+
7373
}
7474
}
7575

@@ -270,14 +270,14 @@ public override void Validate()
270270
/// Base class for backup rentention policy.
271271
/// </summary>
272272
public class RetentionPolicyBase : ObjectBase
273-
{
273+
{
274274
}
275275

276276
/// <summary>
277277
/// Base class for backup schedule policy.
278278
/// </summary>
279279
public class SchedulePolicyBase : ObjectBase
280-
{
280+
{
281281
}
282282

283283
/// <summary>
@@ -323,7 +323,7 @@ public class JobBase : ManagementContext
323323
/// <summary>
324324
/// Time taken by this job to run
325325
/// </summary>
326-
public TimeSpan Duration { get; set; }
326+
public TimeSpan Duration { get; set; }
327327
}
328328

329329
/// <summary>

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/CommonModels/Enums.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ public enum Month
215215
/// Represents how the policy can be scheduled.
216216
/// </summary>
217217
public enum ScheduleRunType
218-
{
218+
{
219219
Daily = 1,
220220
Weekly = 2,
221221
}

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Models/CommonModels/PolicyRetentionObjects.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ public class RetentionDuration
553553

554554
public void Validate()
555555
{
556-
if (RetentionCount <= 0 ||
556+
if (RetentionCount <= 0 ||
557557
RetentionCount > PolicyConstants.MaxAllowedRetentionDurationCount)
558558
{
559559
throw new ArgumentException(Resources.RetentionDurationCountInvalidException);

0 commit comments

Comments
 (0)