Skip to content

Getting Latest changes from Azure:dev #1

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 39 commits into from
Jun 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
841efd0
test
May 19, 2016
8771de5
New cmdlet Get-AzureRMAutomationHybridRunbookWorkerGroup
robplank May 17, 2016
46f82b4
updates requested by Microsoft
robplank May 26, 2016
8836dfd
updated help for get-AzureRMAutomationHybridRunbookWorkerGroup
robplank May 26, 2016
8dce0b3
supporting stretch edition database in PowerShell
Jun 9, 2016
bf0eaea
delete self test file
Jun 9, 2016
86b9066
Supporting Stretch Edition Database
Jun 10, 2016
45a30b9
remove redundent space
Jun 10, 2016
78eb157
remove redundent space
Jun 10, 2016
df0292f
Support Stretch Edition Database
Jun 11, 2016
b6e83b2
Supporting StretchDB in PowerShell
Jun 13, 2016
9ba5176
Adding stretch session records
Jun 13, 2016
99c0d4a
revert test fixes back
Jun 13, 2016
aa8dde4
revert not stretch related changes
Jun 14, 2016
f40fbc8
revert no stretch related changes
Jun 14, 2016
2823089
remove personal info in session records
Jun 14, 2016
5fe6bc7
Add new options to Wait-AzureRmHDInsightJob
pattipaka Jun 16, 2016
f6a3c33
Pull changes from remote branch
pattipaka Jun 17, 2016
67f9af6
Enabling HDInsight tests to run as part of check-ins.
pattipaka Jun 21, 2016
ccb7258
add get-providerlocation to only choose available locations
Jun 22, 2016
9cd5d12
Fix flaky Job test failures
pattipaka Jun 23, 2016
06e0af3
Pull latest changes from Azure/Dev
pattipaka Jun 23, 2016
eb0c7fa
resolve merge conflicts
Jun 24, 2016
382cc76
resolve merge conflict
Jun 24, 2016
b67fd75
Merge branch 'dev' of https://github.com/Azure/azure-powershell into …
Jun 24, 2016
ee36cdd
Merge branch 'dev' of https://github.com/Azure/azure-powershell into …
Jun 24, 2016
610aedf
setting VS version back to 2013
robplank May 26, 2016
43b3e98
removed lines added from a git action
robplank May 26, 2016
94819e3
fixing merge conflicts
robplank May 26, 2016
0739af6
fix formating
robplank May 27, 2016
fc349b2
fixed typo
robplank May 27, 2016
e540a57
add Unit Test
robplank Jun 17, 2016
521df62
update Test
robplank Jun 17, 2016
f73250c
update unit test
robplank Jun 21, 2016
b9d401d
Merge pull request #2325 from robplank/dev
markcowl Jun 28, 2016
2e32322
Merge pull request #2464 from pattipaka/dev
markcowl Jun 28, 2016
f194766
add exceptions to globalfilters (#2524)
kirthik Jun 28, 2016
60ada7a
Rearrange batch command xml (#2525)
brnleehng Jun 29, 2016
f8b304f
Merge pull request #2465 from sw145/dev-shicwu
markcowl Jun 29, 2016
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
1 change: 1 addition & 0 deletions AzurePowershell.Test.targets
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
<XUnitTests Include=".\src\ResourceManager\RedisCache\Commands.RedisCache.Test\bin\Debug\Microsoft.Azure.Commands.RedisCache.Test.dll"/>
<!--<XUnitTests Include=".\src\ResourceManager\ServerManagement\Commands.ServerManagement.Test\bin\Debug\Microsoft.Azure.Commands.ServerManagement.Test.dll"/>
<XUnitTests Include=".\src\ResourceManager\Storage\Commands.Management.Storage.Test\bin\Debug\Microsoft.Azure.Commands.Management.Storage.Test.dll"/>-->
<XUnitTests Include=".\src\ResourceManager\HDInsight\Commands.HDInsight.Test\bin\Debug\Commands.HDInsight.Test.dll"/>
<XUnitTests Include=".\src\Common\Commands.Common.Authentication.Test\bin\Debug\Microsoft.Azure.Commands.Common.Authentication.Test.dll"/>
<XUnitTests Include="@(AsmXUnitTests)"/>
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.4.1.1\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
Expand Down Expand Up @@ -190,6 +192,7 @@
<Compile Include="UnitTests\StartAzureAutomationRunbookTest.cs" />
<Compile Include="UnitTests\StopAzureAutomationJobTest.cs" />
<Compile Include="UnitTests\SuspendAzureAutomationJobTest.cs" />
<Compile Include="UnitTests\GetAzureAutomationHybridWorkerGroupTest.cs" />
<Compile Include="UnitTests\UnregisterAzureAutomationScheduledRunbookTest.cs" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
using Microsoft.Azure.Commands.Automation.Cmdlet;
using Microsoft.Azure.Commands.Automation.Common;
using Microsoft.Azure.Commands.Automation.Model;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
using Microsoft.WindowsAzure.Commands.Utilities.Common;
using Moq;
using System.Collections.Generic;
using Xunit;

namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
{
[TestClass]
public class GetAzureAutomationHybridWorkerGroupTest : RMTestBase
{
private Mock<IAutomationClient> mockAutomationClient;

private MockCommandRuntime mockCommandRuntime;

private GetAzureAutomationHybridWorkerGroup cmdlet;


public GetAzureAutomationHybridWorkerGroupTest()
{
this.mockAutomationClient = new Mock<IAutomationClient>();
this.mockCommandRuntime = new MockCommandRuntime();
this.cmdlet = new GetAzureAutomationHybridWorkerGroup
{
AutomationClient = this.mockAutomationClient.Object,
CommandRuntime = this.mockCommandRuntime
};
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void GetAzureAutomationHybridWorkerGroupByNameSuccessfull()
{
//Setup
string resourceGroupName = "resourceGroup";
string accountName = "automation";
string hybridRunbookWorkerGroupName = "hybridRunbookWorkerGroup";

this.mockAutomationClient.Setup(f => f.GetHybridRunbookWorkerGroup(resourceGroupName, accountName, hybridRunbookWorkerGroupName));

// Test
this.cmdlet.ResourceGroupName = resourceGroupName;
this.cmdlet.AutomationAccountName = accountName;
this.cmdlet.Name = hybridRunbookWorkerGroupName;
this.cmdlet.SetParameterSet("ByName");
this.cmdlet.ExecuteCmdlet();

// Assert
this.mockAutomationClient.Verify(f => f.GetHybridRunbookWorkerGroup(resourceGroupName, accountName, hybridRunbookWorkerGroupName), Times.Once());
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void GetAzureAutomationHybridWorkerGroupByAllSuccessfull()
{
// Setup
string resourceGroupName = "resourceGroup";
string accountName = "automation";
string nextLink = string.Empty;

this.mockAutomationClient.Setup(f => f.ListHybridRunbookWorkerGroups(resourceGroupName, accountName, ref nextLink)).Returns((string a, string b, string c) => new List<HybridRunbookWorkerGroup>()); ;

// Test
this.cmdlet.ResourceGroupName = resourceGroupName;
this.cmdlet.AutomationAccountName = accountName;
this.cmdlet.SetParameterSet("ByAll");
this.cmdlet.ExecuteCmdlet();

//Assert
this.mockAutomationClient.Verify(f => f.ListHybridRunbookWorkerGroups(resourceGroupName, accountName, ref nextLink), Times.Once());
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Management.Automation;
using System.Security.Permissions;
using Microsoft.Azure.Commands.Automation.Model;
using Microsoft.Azure.Commands.Automation.Common;


namespace Microsoft.Azure.Commands.Automation.Cmdlet
{
[Cmdlet(VerbsCommon.Get, "AzureRMAutomationHybridWorkerGroup", DefaultParameterSetName = AutomationCmdletParameterSets.ByAll)]
[OutputType(typeof(HybridRunbookWorkerGroup))]
public class GetAzureAutomationHybridWorkerGroup : AzureAutomationBaseCmdlet
{
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByName,Position = 2, Mandatory = false, ValueFromPipeline = true, HelpMessage = "The Hybrid Runbook Worker Group name")]
[Alias("Group")]
public string Name { get; set; }

protected override void AutomationProcessRecord()
{
if (this.ParameterSetName == AutomationCmdletParameterSets.ByName)
{
IEnumerable<HybridRunbookWorkerGroup> ret = null;
ret = new List<HybridRunbookWorkerGroup> {

this.AutomationClient.GetHybridRunbookWorkerGroup(this.ResourceGroupName, this.AutomationAccountName, this.Name)
};
this.GenerateCmdletOutput(ret);
}
else if(this.ParameterSetName == AutomationCmdletParameterSets.ByAll)
{
var nextLink = string.Empty;
do
{
var results = this.AutomationClient.ListHybridRunbookWorkerGroups(this.ResourceGroupName, this.AutomationAccountName, ref nextLink);
this.GenerateCmdletOutput(results);
}while (!string.IsNullOrEmpty(nextLink));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Cmdlet\AzureAutomationBaseCmdlet.cs" />
<Compile Include="Cmdlet\GetAzureAutomationHybridWorkerGroup.cs" />
<Compile Include="Cmdlet\GetAzureAutomationJobOutputRecord.cs" />
<Compile Include="Cmdlet\ImportAzureAutomationDscNodeConfiguration.cs" />
<Compile Include="Cmdlet\ExportAzureAutomationDscConfiguration.cs" />
Expand Down Expand Up @@ -227,6 +228,8 @@
<Compile Include="Model\DscNode.cs" />
<Compile Include="Model\DscNodeReport.cs" />
<Compile Include="Model\DscOnboardingMetaconfig.cs" />
<Compile Include="Model\HybridRunbookWorker.cs" />
<Compile Include="Model\HybridRunbookWorkerGroup.cs" />
<Compile Include="Model\Job.cs" />
<Compile Include="Model\JobSchedule.cs" />
<Compile Include="Model\JobStreamRecord.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
using Runbook = Microsoft.Azure.Commands.Automation.Model.Runbook;
using Schedule = Microsoft.Azure.Commands.Automation.Model.Schedule;
using Variable = Microsoft.Azure.Commands.Automation.Model.Variable;
using HybridRunbookWorkerGroup = Microsoft.Azure.Commands.Automation.Model.HybridRunbookWorkerGroup;


namespace Microsoft.Azure.Commands.Automation.Common
{
Expand All @@ -54,6 +56,10 @@ public AutomationClient()
{
}

/// <summary>
///
/// </summary>
/// <param name="context"></param>
public AutomationClient(AzureContext context)
: this(context.Subscription,
AzureSession.ClientFactory.CreateClient<AutomationManagement.AutomationManagementClient>(context,
Expand Down Expand Up @@ -1359,6 +1365,41 @@ public void DeleteConnection(string resourceGroupName, string automationAccountN

#endregion

#region HybridRunbookworkers

public IEnumerable<HybridRunbookWorkerGroup> ListHybridRunbookWorkerGroups(string resourceGroupName, string automationAccountName, ref string nextLink)
{
HybridRunbookWorkerGroupsListResponse response;

if (string.IsNullOrEmpty(nextLink))
{
response = this.automationManagementClient.HybridRunbookWorkerGroups.List(resourceGroupName, automationAccountName);
}
else
{
response = this.automationManagementClient.HybridRunbookWorkerGroups.ListNext(nextLink);
}

nextLink = response.NextLink;

return response.HybridRunbookWorkerGroups.Select(c => new HybridRunbookWorkerGroup(resourceGroupName, automationAccountName, c));
}

public HybridRunbookWorkerGroup GetHybridRunbookWorkerGroup(string resourceGroupName, string automationAccountName, string name)
{
var hybridRunbookWorkerGroupModel = this.TryGetHybridRunbookWorkerModel(resourceGroupName, automationAccountName, name);
if (hybridRunbookWorkerGroupModel == null)
{
throw new ResourceCommonException(typeof(HybridRunbookWorkerGroup),
string.Format(CultureInfo.CurrentCulture, Resources.HybridRunbookWorkerGroupNotFound, name));
}

return new HybridRunbookWorkerGroup(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupModel);

}

#endregion

#region JobSchedules

public JobSchedule GetJobSchedule(string resourceGroupName, string automationAccountName, Guid jobScheduleId)
Expand Down Expand Up @@ -1598,7 +1639,30 @@ private Azure.Management.Automation.Models.Runbook TryGetRunbookModel(string res
return runbook;
}

private Azure.Management.Automation.Models.Certificate TryGetCertificateModel(string resourceGroupName, string automationAccountName,



private Azure.Management.Automation.Models.HybridRunbookWorkerGroup TryGetHybridRunbookWorkerModel(string resourceGroupName, string automationAccountName, string HybridRunbookWorkerGroupName)
{
Azure.Management.Automation.Models.HybridRunbookWorkerGroup hybridRunbookWorkerGroup = null;
try
{
hybridRunbookWorkerGroup = this.automationManagementClient.HybridRunbookWorkerGroups.Get(resourceGroupName, automationAccountName, HybridRunbookWorkerGroupName).HybridRunbookWorkerGroup;
}
catch (CloudException e)
{
if (e.Response.StatusCode == HttpStatusCode.NotFound)
{
hybridRunbookWorkerGroup = null;
}
else
{
throw;
}
}
return hybridRunbookWorkerGroup;
}
private Azure.Management.Automation.Models.Certificate TryGetCertificateModel(string resourceGroupName, string automationAccountName,
string certificateName)
{
Azure.Management.Automation.Models.Certificate certificate = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ Model.Webhook CreateWebhook(

#endregion

#region HybridrunbookWorker
HybridRunbookWorkerGroup GetHybridRunbookWorkerGroup(string resourceGroupName, string automationAccountName, string hybridRunbookWorkerGroupName);

IEnumerable<HybridRunbookWorkerGroup> ListHybridRunbookWorkerGroups(string resourceGroupName, string automationAccountName, ref string nextLink);
#endregion

#region Credentials

CredentialInfo CreateCredential(string resourceGroupName, string automationAccountName, string name, string userName, string password, string description);
Expand Down
Loading