Skip to content

RI from dev1 into dev1-anudeeb #144

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 37 commits into from
Aug 26, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
3812391
Fix ServiceManagement test setup
Aug 11, 2015
7d53bd9
Fix AzureVMAccess test
Aug 12, 2015
9c11c46
Merge branch 'dev' of https://github.com/AzureRT/azure-powershell int…
hyonholee Aug 13, 2015
e6f00b1
Expose ComputeImageConfig in Get-AzurePlatformVMImage cmdlet
hyonholee Aug 13, 2015
e7fd44a
Change hard coded locations to a function.
hyonholee Aug 14, 2015
ff40e36
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
hyonholee Aug 14, 2015
820db09
Set-AzureVMDataDisk cmdlet
hyonholee Aug 21, 2015
9d3a28d
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
hyonholee Aug 21, 2015
ab49b76
Include odata query filter for a single resource get
vivsriaus Aug 21, 2015
53b59b0
Formatting Get image cmdles as a table
hyonholee Aug 21, 2015
bbd0447
Fix virtual machine datadisk test
hyonholee Aug 21, 2015
c590953
Update Set-AzureVMDataDisk cmdlet
hyonholee Aug 24, 2015
ffffce4
Adding Get-AzureSq1LocationCapabilities cmdlet.
akromm-zz Aug 20, 2015
4e7c996
Renaming some classes.
akromm-zz Aug 20, 2015
dda805b
Adding tests, and converting others to check-in tests
akromm-zz Aug 20, 2015
9620ec1
Renaming cmdlet
akromm-zz Aug 21, 2015
2b36b14
Fixing test name.
akromm-zz Aug 21, 2015
911fb81
Adding custom output for Capabilities cmdlet
akromm-zz Aug 24, 2015
1c3634c
Merge pull request #138 from MabOneSdk/dev1-anudeeb
Aug 25, 2015
f527230
Revert "Revert "FI from dev1 into release""
AditTulasi Aug 25, 2015
79b49af
Incorporating PR comments
Aug 25, 2015
38dfc1e
Merge pull request #141 from MabOneSdk/dev1
Aug 25, 2015
a3a87ce
Merge branch 'dev1' of https://github.com/MabOneSdk/azure-powershell …
AditTulasi Aug 25, 2015
53ff083
Fixed ServerActiveDirectoryAdministratorTest. Removed a check for the…
Aug 25, 2015
45ef9da
Merge pull request #777 from MabOneSdk/release
markcowl Aug 25, 2015
081dc96
Merge pull request #782 from hyonholee/dev
markcowl Aug 25, 2015
21d8e7f
Merge pull request #784 from vivsriaus/odata
markcowl Aug 25, 2015
b23decf
Set the graph endpoint in the test framework to fix the TestServerAct…
Aug 25, 2015
bf08051
Merge pull request #797 from j82w/dev
markcowl Aug 25, 2015
ba9f811
Merge pull request #792 from akromm/Get-AzureSqlCapabilities
markcowl Aug 25, 2015
ac98ca3
Warn users for upcoming changes to test cmdlets
vivsriaus Aug 25, 2015
05067d2
Update ChangeLog.md
markcowl Aug 25, 2015
f5bfaac
Update wix file in dev branch
markcowl Aug 26, 2015
512c3b5
Merge pull request #802 from markcowl/hdinsightwix
markcowl Aug 26, 2015
db4abf4
Merge pull request #801 from vivsriaus/WarnRGRemoveDeployment
markcowl Aug 26, 2015
bd0101f
Merge pull request #142 from Azure/dev
Aug 26, 2015
4e0e3d0
Merge pull request #143 from MabOneSdk/release
Aug 26, 2015
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
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 2015.09.03 version 0.9.8

## 2015.08.17 version 0.9.7
* Azure Profile cmdlets
* New-AzureProfile
Expand Down
100 changes: 100 additions & 0 deletions setup/azurecmdfiles.wxi

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using System.Xml;
using System.Linq;
using Mgmt = Microsoft.Azure.Management.BackupServices.Models;
using Microsoft.Azure.Commands.AzureBackup.Models;


namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets
Expand Down Expand Up @@ -62,6 +63,30 @@ public static class AzureBackupJobHelper
{
public static DateTime MinimumAllowedDate = new DateTime(DateTime.MinValue.Year, DateTime.MinValue.Month, DateTime.MinValue.Day, DateTime.MinValue.Hour, DateTime.MinValue.Minute, DateTime.MinValue.Second, DateTimeKind.Utc);

public static string GetTypeForPS(string itemType)
{
AzureBackupItemType managedContainerType = (AzureBackupItemType)Enum.Parse(typeof(AzureBackupItemType), itemType, true);

string returnType = string.Empty;

switch (managedContainerType)
{
case AzureBackupItemType.IaasVM:
returnType = "AzureVM";
break;
}

return returnType;
}

public static string GetTypeForService(string itemType)
{
if (itemType.CompareTo("AzureVM") == 0)
return AzureBackupItemType.IaasVM.ToString();
throw new ArgumentException("Invalid value", "itemType");
}


public static bool IsValidStatus(string inputStatus)
{
JobStatus status;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class GetAzureRMBackupJob : AzureBackupCmdletBase
public string Status { get; set; }

[Parameter(Mandatory = false, HelpMessage = AzureBackupCmdletHelpMessage.JobFilterTypeHelpMessage, ParameterSetName = "FiltersSet")]
[ValidateSet("IaasVM")]
[ValidateSet("AzureVM")]
public string Type { get; set; }

[Parameter(Mandatory = false, HelpMessage = AzureBackupCmdletHelpMessage.JobFilterOperationHelpMessage, ParameterSetName = "FiltersSet")]
Expand All @@ -79,6 +79,11 @@ public override void ExecuteCmdlet()
JobId = Job.InstanceId;
}

if (Type != null)
{
Type = AzureBackupJobHelper.GetTypeForService(Type);
}

// validations
if (!From.HasValue)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class GetAzureRMBackupJobDetils : AzureBackupCmdletBase

[Parameter(Mandatory = true, HelpMessage = AzureBackupCmdletHelpMessage.JobDetailsFilterJobIdHelpMessage, ParameterSetName = "IdFiltersSet")]
[ValidateNotNullOrEmpty]
public string JobID { get; set; }
public string JobId { get; set; }

[Parameter(Mandatory = true, HelpMessage = AzureBackupCmdletHelpMessage.JobDetailsFilterJobHelpMessage, ParameterSetName = "JobsFiltersSet", ValueFromPipeline = true)]
[ValidateNotNull]
Expand All @@ -53,12 +53,12 @@ public override void ExecuteCmdlet()
{
if (Job != null)
{
JobID = Job.InstanceId;
JobId = Job.InstanceId;
}

WriteDebug(String.Format(Resources.JobIdFilter, JobID));
WriteDebug(String.Format(Resources.JobIdFilter, JobId));

Mgmt.CSMJobDetailsResponse serviceJobProperties = AzureBackupClient.GetJobDetails(Vault.ResourceGroupName, Vault.Name, JobID);
Mgmt.CSMJobDetailsResponse serviceJobProperties = AzureBackupClient.GetJobDetails(Vault.ResourceGroupName, Vault.Name, JobId);
AzureRMBackupJobDetails jobDetails = new AzureRMBackupJobDetails(Vault, serviceJobProperties.JobDetailedProperties, serviceJobProperties.Name);

WriteDebug(Resources.JobResponse);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,38 +54,40 @@ public static string GetResourceGroup(string vaultId)
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);
}
// 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>();
}
// 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
Expand All @@ -95,34 +97,34 @@ public static IEnumerable<TSource> CoalesceEnumerable<TSource>(this IEnumerable<
/// <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;
}
}
}
// 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();
}
// 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 @@ -21,6 +21,7 @@
using Microsoft.Azure.Management.BackupServices;
using Microsoft.Azure.Management.BackupServices;
using Mgmt = Microsoft.Azure.Management.BackupServices.Models;
using Microsoft.Azure.Commands.AzureBackup.Cmdlets;

namespace Microsoft.Azure.Commands.AzureBackup.Models
{
Expand Down Expand Up @@ -52,7 +53,7 @@ public AzureRMBackupJob(AzureRMBackupVault vault, Mgmt.CSMJobProperties serviceJ
: base(vault)
{
this.InstanceId = jobName;
this.WorkloadType = serviceJob.WorkloadType;
this.WorkloadType = AzureBackupJobHelper.GetTypeForPS(serviceJob.WorkloadType);
this.WorkloadName = serviceJob.EntityFriendlyName;
this.Operation = serviceJob.Operation;
this.Status = serviceJob.Status;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.VirtualMachineTests\TestVirtualMachineDataDisk.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.VirtualMachineTests\TestVirtualMachineDataDiskNegative.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Compute.Test.ScenarioTests.VirtualMachineTests\TestVirtualMachineImageList.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function Test-AvailabilitySet
try
{
# Common
$loc = 'West US';
$loc = Get-ComputeVMLocation;
New-AzureResourceGroup -Name $rgname -Location $loc -Force;

$asetName = 'avs' + $rgname;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function Run-ComputeCloudExceptionTests
try
{
# Common
$loc = 'West US';
$loc = Get-ComputeVMLocation;
New-AzureResourceGroup -Name $rgname -Location $loc -Force;

$compare = "Resource*NotFound*OperationID : `'*`'";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,3 +394,75 @@ function Get-SasUri

return $uri;
}

# Get a Location according to resource provider.
function Get-ResourceProviderLocation
{
param ([string] $name, [string] $default = "westus", [bool] $canonical = $true)

$loc = Get-AzureLocation | where { $_.Name.Equals($name) };

if ($loc -eq $null)
{
throw 'There is no available locations with given parameters';
}

if ($loc.LocationsString.ToLowerInvariant().Replace(" ", "").Contains($default.ToLowerInvariant().Replace(" ","")))
{
return $default;
}

if ($canonical)
{
return $loc.Locations[0].ToLowerInvariant().Replace(" ", "");
}
else
{
return $loc.Locations[0];
}
}

function Get-ComputeVMLocation
{
Get-ResourceProviderLocation "Microsoft.Compute/virtualMachines";
}

function Get-ComputeAvailabilitySetLocation
{
Get-ResourceProviderLocation "Microsoft.Compute/availabilitySets";
}

function Get-ComputeVMExtensionLocation
{
Get-ResourceProviderLocation "Microsoft.Compute/virtualMachines/extensions";
}

function Get-ComputeVMDiagnosticSettingLocation
{
Get-ResourceProviderLocation "Microsoft.Compute/virtualMachines/diagnosticSettings";
}

function Get-ComputeVMMetricDefinitionLocation
{
Get-ResourceProviderLocation "Microsoft.Compute/virtualMachines/metricDefinitions";
}

function Get-ComputeOperationLocation
{
Get-ResourceProviderLocation "Microsoft.Compute/locations/operations";
}

function Get-ComputeVMSizeLocation
{
Get-ResourceProviderLocation "Microsoft.Compute/locations/vmSizes";
}

function Get-ComputeUsageLocation
{
Get-ResourceProviderLocation "Microsoft.Compute/locations/usages";
}

function Get-ComputePublisherLocation
{
Get-ResourceProviderLocation "Microsoft.Compute/locations/publishers";
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function Test-VirtualMachineExtension
try
{
# Common
$loc = 'westus';
$loc = Get-ComputeVMLocation;
New-AzureResourceGroup -Name $rgname -Location $loc -Force;

# VM Profile & Hardware
Expand Down Expand Up @@ -163,7 +163,7 @@ function Test-VirtualMachineExtensionUsingHashTable
try
{
# Common
$loc = 'westus';
$loc = Get-ComputeVMLocation;
New-AzureResourceGroup -Name $rgname -Location $loc -Force;

# VM Profile & Hardware
Expand Down Expand Up @@ -325,7 +325,7 @@ function Test-VirtualMachineCustomScriptExtension
try
{
# Common
$loc = 'westus';
$loc = Get-ComputeVMLocation;
New-AzureResourceGroup -Name $rgname -Location $loc -Force;

# VM Profile & Hardware
Expand Down Expand Up @@ -494,7 +494,7 @@ function Test-VirtualMachineCustomScriptExtensionFileUri
try
{
# Common
$loc = 'westus';
$loc = Get-ComputeVMLocation;
New-AzureResourceGroup -Name $rgname -Location $loc -Force;

# VM Profile & Hardware
Expand Down Expand Up @@ -652,7 +652,7 @@ function Test-VirtualMachineAccessExtension
try
{
# Common
$loc = 'westus';
$loc = Get-ComputeVMLocation;
New-AzureResourceGroup -Name $rgname -Location $loc -Force;

# VM Profile & Hardware
Expand Down
Loading