Skip to content

Taking Comments of dev1 merge #327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
<RootNamespace>Microsoft.Azure.Commands.ScenarioTest</RootNamespace>
<AssemblyName>Microsoft.Azure.Commands.ScenarioTest.Common</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<NuGetPackageImportStamp>e5bda5ba</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -183,4 +186,5 @@
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ public static ItemBase GetItemModel(ServiceClientModel.ProtectedItemResource pro
{
string policyName = null;
string policyId = ((ServiceClientModel.AzureSqlProtectedItem)protectedItem.Properties).PolicyId;
if (policyId != null)
if (!String.IsNullOrEmpty(policyId))
{
Dictionary<UriEnums, string> keyVauleDict =
HelperUtils.ParseUri(policyId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ public class RecoveryPointConversions
/// </summary>
public static List<RecoveryPointBase> GetPSAzureRecoveryPoints(ServiceClientModel.RecoveryPointListResponse rpList, ItemBase item)
{
if (rpList == null || rpList.RecoveryPointList == null ||
rpList.RecoveryPointList.RecoveryPoints == null)
{
throw new ArgumentNullException("RPList");
if (rpList == null || rpList.RecoveryPointList == null ||
rpList.RecoveryPointList.RecoveryPoints == null)
{
throw new ArgumentNullException("RPList");
}

Dictionary<UriEnums, string> uriDict = HelperUtils.ParseUri(item.Id);
Expand All @@ -48,23 +48,23 @@ public static List<RecoveryPointBase> GetPSAzureRecoveryPoints(ServiceClientMode
{
ServiceClientModel.RecoveryPoint recPoint = rp.Properties as ServiceClientModel.RecoveryPoint;

DateTime recPointTime = DateTime.ParseExact(recPoint.RecoveryPointTime, @"MM/dd/yyyy HH:mm:ss", CultureInfo.InvariantCulture);
AzureVmRecoveryPoint rpBase = new AzureVmRecoveryPoint()
{
RecoveryPointId = rp.Name,
BackupManagementType = item.BackupManagementType,
ItemName = protectedItemName,
ContainerName = containerUri,
ContainerType = item.ContainerType,
RecoveryPointTime = recPointTime,
RecoveryPointType = recPoint.RecoveryPointType,
Id = rp.Id,
WorkloadType = item.WorkloadType,
RecoveryPointAdditionalInfo = recPoint.RecoveryPointAdditionalInfo,
SourceVMStorageType = recPoint.SourceVMStorageType,
};
result.Add(rpBase);
}
DateTime recPointTime = DateTime.ParseExact(recPoint.RecoveryPointTime, @"MM/dd/yyyy HH:mm:ss", CultureInfo.InvariantCulture);
AzureVmRecoveryPoint rpBase = new AzureVmRecoveryPoint()
{
RecoveryPointId = rp.Name,
BackupManagementType = item.BackupManagementType,
ItemName = protectedItemName,
ContainerName = containerUri,
ContainerType = item.ContainerType,
RecoveryPointTime = recPointTime,
RecoveryPointType = recPoint.RecoveryPointType,
Id = rp.Id,
WorkloadType = item.WorkloadType,
RecoveryPointAdditionalInfo = recPoint.RecoveryPointAdditionalInfo,
SourceVMStorageType = recPoint.SourceVMStorageType,
};
result.Add(rpBase);
}

if (rp.Properties.GetType() == typeof(ServiceClientModel.GenericRecoveryPoint))
{
Expand Down Expand Up @@ -111,14 +111,19 @@ public static RecoveryPointBase GetPSAzureRecoveryPoints(ServiceClientModel.Reco
if (rpResponse.RecPoint.Properties.GetType() == typeof(ServiceClientModel.RecoveryPoint))
{
ServiceClientModel.RecoveryPoint recPoint = rpResponse.RecPoint.Properties as ServiceClientModel.RecoveryPoint;
DateTime recPointTime = DateTime.ParseExact(
recPoint.RecoveryPointTime,
@"MM/dd/yyyy HH:mm:ss",
CultureInfo.InvariantCulture);

result = new AzureVmRecoveryPoint()
{
RecoveryPointId = rpResponse.RecPoint.Name,
BackupManagementType = item.BackupManagementType,
ItemName = protectedItemName,
ContainerName = containerUri,
ContainerType = item.ContainerType,
RecoveryPointTime = Convert.ToDateTime(recPoint.RecoveryPointTime).ToLocalTime(),
RecoveryPointTime = recPointTime,
RecoveryPointType = recPoint.RecoveryPointType,
Id = rpResponse.RecPoint.Id,
WorkloadType = item.WorkloadType,
Expand All @@ -129,19 +134,23 @@ public static RecoveryPointBase GetPSAzureRecoveryPoints(ServiceClientModel.Reco
if (rpResponse.RecPoint.Properties.GetType() == typeof(ServiceClientModel.GenericRecoveryPoint))
{
ServiceClientModel.GenericRecoveryPoint recPoint = rpResponse.RecPoint.Properties as ServiceClientModel.GenericRecoveryPoint;
DateTime recPointTime = DateTime.ParseExact(
recPoint.RecoveryPointTime,
@"MM/dd/yyyy HH:mm:ss",
CultureInfo.InvariantCulture);
result = new AzureSqlRecoveryPoint()
{
RecoveryPointId = rpResponse.RecPoint.Name,
BackupManagementType = item.BackupManagementType,
ItemName = protectedItemName,
ContainerName = containerUri,
ContainerType = item.ContainerType,
RecoveryPointTime = Convert.ToDateTime(recPoint.RecoveryPointTime).ToLocalTime(),
RecoveryPointTime = recPointTime,
RecoveryPointType = recPoint.RecoveryPointType,
Id = rpResponse.RecPoint.Id,
WorkloadType = item.WorkloadType,
RecoveryPointAdditionalInfo = recPoint.RecoveryPointAdditionalInfo,
FriendlyName = recPoint.FriendlyName,
FriendlyName = recPoint.FriendlyName,
};
}
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static SimpleRetentionPolicy GetPSSimpleRetentionPolicy(

if (hydraRetPolicy.RetentionDuration != null)
{
simplePolicy.RetentionDurationType = (RetentionDurationType)Enum.Parse(typeof(RetentionDurationType), hydraRetPolicy.RetentionDuration.DurationType);
simplePolicy.RetentionDurationType = EnumUtils.GetEnum<RetentionDurationType>(hydraRetPolicy.RetentionDuration.DurationType);
simplePolicy.RetentionCount = hydraRetPolicy.RetentionDuration.Count;
}

Expand Down Expand Up @@ -343,9 +343,9 @@ private static WeeklyRetentionFormat GetPSLTRWeeklyRetentionFormat(

#endregion

#region PStoHydraObject conversions
#region PStoServiceClientObject conversions

public static ServiceClientModel.SimpleRetentionPolicy GetHydraSimpleRetentionPolicy(
public static ServiceClientModel.SimpleRetentionPolicy GetServiceClientSimpleRetentionPolicy(
SimpleRetentionPolicy psRetPolicy)
{
if (psRetPolicy == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static string GetServiceClientProviderType(CmdletModel.WorkloadType workl
providerType = ServiceClientModel.BackupManagementType.AzureIaasVM.ToString();
break;
case CmdletModel.WorkloadType.AzureSQLDatabase:
providerType = Microsoft.Azure.Management.RecoveryServices.Backup.Models.BackupManagementType.AzureSql.ToString();
providerType = ServiceClientModel.BackupManagementType.AzureSql.ToString();
break;
default:
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models
public class AzureSqlContainer : ContainerBase
{
public ContainerRegistrationStatus Status { get; set; }

public AzureSqlContainer(ProtectionContainerResource protectionContainer)
: base(protectionContainer)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public class AzureSqlItem : ItemBase

public string ProtectionState { get; set; }


/// <summary>
/// Protection Policy Name for the Item
/// </summary>
Expand All @@ -50,7 +49,7 @@ public AzureSqlItem(ProtectedItemResource protectedItemResource,
}

/// <summary>
/// Represents IaaSVM Item ExtendedInfo Class
/// Represents AzureSql Item ExtendedInfo Class
/// </summary>
public class AzureSqlItemExtendedInfo : ItemExtendedInfoBase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models
public class AzureSqlPolicy : PolicyBase
{
public RetentionPolicyBase RetentionPolicy { get; set; }

public override void Validate()
{
base.Validate();
RetentionPolicy.Validate();
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,5 @@ public class AzureSqlRecoveryPoint : RecoveryPointBase
public string RecoveryPointAdditionalInfo { get; set; }

public string FriendlyName { get; set; }

public AzureSqlRecoveryPoint()
{

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models
public enum ContainerType
{
AzureVM = 1,
AzureSQL,
Windows
Windows,
AzureSQL
}

public enum BackupManagementType
Expand Down
Loading