Skip to content

FI from dev1 into release #141

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 13 commits into from
Aug 25, 2015
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 @@ -40,8 +40,7 @@
<HintPath>..\..\..\packages\Microsoft.Azure.Common.Authentication.1.1.3-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Management.BackupServicesManagement, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Commands.AzureBackup\Resources\Microsoft.Azure.Management.BackupServicesManagement.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.BackupServices.1.0.4-preview\lib\net40\Microsoft.Azure.Management.BackupServicesManagement.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<package id="Microsoft.Azure.Common" version="2.1.0" targetFramework="net45" />
<package id="Microsoft.Azure.Common.Authentication" version="1.1.3-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.Azure.Management.BackupServices" version="1.0.3-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.BackupServices" version="1.0.4-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Resources" version="2.18.7-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Test.Framework" version="1.0.5687.28567-prerelease" targetFramework="net45" />
<package id="Microsoft.Azure.Test.HttpRecorder" version="1.0.5687.28567-prerelease" targetFramework="net45" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,7 @@ internal static class AzureBackupCmdletHelpMessage
public const string WeekNumber = "List of Week Numbers of the month";
public const string MonthsOfYear = "List of Months of the year";
public const string Retention = "Retention duration value";

public const string PolicyObject = "Policy object for enabling protection";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@ public SwitchParameter RemoveRecoveryPoints
}
private bool DeleteBackupData;

[Parameter(Position = 2, Mandatory = false, HelpMessage = AzureBackupCmdletHelpMessage.Reason)]
public string Reason { get; set; }

[Parameter(Position = 3, Mandatory = false, HelpMessage = AzureBackupCmdletHelpMessage.Comments)]
public string Comments { get; set; }

public override void ExecuteCmdlet()
{
ExecutionBlock(() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets
[Cmdlet(VerbsLifecycle.Enable, "AzureRMBackupProtection"), OutputType(typeof(AzureRMBackupJob))]
public class EnableAzureRMBackupProtection : AzureRMBackupItemCmdletBase
{
[Parameter(Mandatory = true, HelpMessage = AzureBackupCmdletHelpMessage.PolicyName)]
[Parameter(Mandatory = true, HelpMessage = AzureBackupCmdletHelpMessage.PolicyObject)]
[ValidateNotNullOrEmpty]
public AzureRMBackupProtectionPolicy Policy { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Management.BackupServicesManagement, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Resources\Microsoft.Azure.Management.BackupServicesManagement.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.BackupServices.1.0.4-preview\lib\net40\Microsoft.Azure.Management.BackupServicesManagement.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
// ----------------------------------------------------------------------------------

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using ClientModel = Microsoft.Azure.Management.BackupServices.Models;
using CmdletModel = Microsoft.Azure.Commands.AzureBackup.Models;

Expand Down Expand Up @@ -50,5 +53,78 @@ public static string GetResourceGroup(string vaultId)
string[] tokens = vaultId.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
return tokens[3];
}

// NOTE: Commenting code which will be used in a later sprint, but not right now.

/// <summary>
/// Extension to convert enumerable Hashtable into a dictionary
/// </summary>
/// <param name="tags"></param>
/// <returns></returns>
// public static Dictionary<string, string> ConvertToDictionary(this Hashtable[] tags)
// {
// return tags == null
// ? null
// : tags
// .CoalesceEnumerable()
// .Select(hashTable => hashTable.OfType<DictionaryEntry>()
// .ToDictionary(kvp => kvp.Key.ToString(), kvp => kvp.Value))
// .Where(tagDictionary => tagDictionary.ContainsKey("Name"))
// .Select(tagDictionary => Tuple
// .Create(
// tagDictionary["Name"].ToString(),
// tagDictionary.ContainsKey("Value") ? tagDictionary["Value"].ToString() : string.Empty))
// .Distinct(kvp => kvp.Item1)
// .ToDictionary(kvp => kvp.Item1, kvp => kvp.Item2);
// }

/// <summary>
/// Extension to coalesce enumerable
/// </summary>
/// <typeparam name="TSource">Enumerable type</typeparam>
/// <param name="source">Enumerable</param>
/// <returns></returns>
// public static IEnumerable<TSource> CoalesceEnumerable<TSource>(this IEnumerable<TSource> source)
// {
// return source ?? Enumerable.Empty<TSource>();
// }

/// <summary>
/// Extension to remove duplicates from enumerable based on a provided key selector
/// </summary>
/// <typeparam name="TSource">Enumerable type</typeparam>
/// <typeparam name="TKeyType">Type of key</typeparam>
/// <param name="source">Input enumerable to remove duplicates from</param>
/// <param name="keySelector">Lambda to select key</param>
/// <returns></returns>
// public static IEnumerable<TSource> Distinct<TSource, TKeyType>(this IEnumerable<TSource> source, Func<TSource, TKeyType> keySelector)
// {
// var set = new Dictionary<TKeyType, TSource>(EqualityComparer<TKeyType>.Default);
// foreach (TSource element in source)
// {
// TSource value;
// var key = keySelector(element);
// if (!set.TryGetValue(key, out value))
// {
// yield return element;
// }
// else
// {
// set[key] = value;
// }
// }
// }

/// <summary>
/// Extension to convert dictionary to hashtable enumerable
/// </summary>
/// <param name="tags"></param>
/// <returns></returns>
// public static Hashtable[] GetTagsHashtables(this IDictionary<string, string> tags)
// {
// return tags == null
// ? null
// : tags.Select(kvp => new Hashtable { { "Name", kvp.Key }, { "Value", kvp.Value } }).ToArray();
// }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ public class AzureRMBackupVault

public string Region { get; set; }

// public Hashtable[] Tags { get; protected set; }
// TODO: Add support for tags
//public Hashtable[] Tags { get; set; }

public string Storage { get; set; }

Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<package id="Microsoft.Azure.Common" version="2.1.0" targetFramework="net45" />
<package id="Microsoft.Azure.Common.Authentication" version="1.1.3-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.Azure.Management.BackupServices" version="1.0.3-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.BackupServices" version="1.0.4-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Resources" version="2.18.7-preview" targetFramework="net45" />
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net45" />
Expand Down