Skip to content

Commit ef8703b

Browse files
committed
2 parents c168df5 + ccff761 commit ef8703b

File tree

5 files changed

+128
-7
lines changed

5 files changed

+128
-7
lines changed

src/ResourceManager/Automation/Commands.Automation/Cmdlet/AzureAutomationBaseCmdlet.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ public IAutomationClient AutomationClient
6262
[ValidateNotNullOrEmpty]
6363
public string ResourceGroupName { get; set; }
6464

65+
/// <summary>
66+
/// Gets or sets the automation account name.
67+
/// </summary>
68+
[Parameter(Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The automation account name.")]
69+
[ValidateNotNullOrEmpty]
70+
public string AutomationAccountName { get; set; }
71+
6572
protected virtual void AutomationExecuteCmdlet()
6673
{
6774
// Do nothing.
@@ -72,6 +79,7 @@ public override void ExecuteCmdlet()
7279
try
7380
{
7481
Requires.Argument("ResourceGroupName", this.ResourceGroupName).NotNull();
82+
Requires.Argument("AutomationAccountName", this.AutomationAccountName).NotNull();
7583
this.AutomationExecuteCmdlet();
7684
}
7785
catch (CloudException cloudException)

src/ResourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationAccount.cs

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,36 @@ namespace Microsoft.Azure.Commands.Automation.Cmdlet
2626
/// </summary>
2727
[Cmdlet(VerbsCommon.Get, "AzureAutomationAccount", DefaultParameterSetName = AutomationCmdletParameterSets.ByAll)]
2828
[OutputType(typeof(AutomationAccount))]
29-
public class GetAzureAutomationAccount : AzureAutomationBaseCmdlet
29+
public class GetAzureAutomationAccount : AzurePSCmdlet
3030
{
31+
/// <summary>
32+
/// The automation client.
33+
/// </summary>
34+
private IAutomationClient automationClient;
35+
36+
/// <summary>
37+
/// Gets or sets the automation client base.
38+
/// </summary>
39+
public IAutomationClient AutomationClient
40+
{
41+
get
42+
{
43+
return this.automationClient = this.automationClient ?? new AutomationClient(Profile, Profile.Context.Subscription);
44+
}
45+
46+
set
47+
{
48+
this.automationClient = value;
49+
}
50+
}
51+
52+
/// <summary>
53+
/// Gets or sets the automation account name.
54+
/// </summary>
55+
[Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource group name.")]
56+
[ValidateNotNullOrEmpty]
57+
public string ResourceGroupName { get; set; }
58+
3159
/// <summary>
3260
/// Gets or sets the automation account name.
3361
/// </summary>
@@ -55,7 +83,7 @@ public override void ExecuteCmdlet()
5583
ret = this.AutomationClient.ListAutomationAccounts(this.ResourceGroupName);
5684
}
5785

58-
this.GenerateCmdletOutput(ret);
86+
this.WriteObject(ret, true);
5987
}
6088
}
6189
}

src/ResourceManager/Automation/Commands.Automation/Cmdlet/NewAzureAutomationAccount.cs

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,38 @@ namespace Microsoft.Azure.Commands.Automation.Cmdlet
2525
/// <summary>
2626
/// Creates azure automation accounts based on automation account name and location.
2727
/// </summary>
28-
[Cmdlet(VerbsCommon.New, "AzureAutomationAccount", DefaultParameterSetName = AutomationCmdletParameterSets.ByName)]
28+
[Cmdlet(VerbsCommon.New, "AzureAutomationAccount")]
2929
[OutputType(typeof(AutomationAccount))]
30-
public class NewAzureAutomationAccount : AzureAutomationBaseCmdlet
30+
public class NewAzureAutomationAccount : AzurePSCmdlet
3131
{
32+
/// <summary>
33+
/// The automation client.
34+
/// </summary>
35+
private IAutomationClient automationClient;
36+
37+
/// <summary>
38+
/// Gets or sets the automation client base.
39+
/// </summary>
40+
public IAutomationClient AutomationClient
41+
{
42+
get
43+
{
44+
return this.automationClient = this.automationClient ?? new AutomationClient(Profile, Profile.Context.Subscription);
45+
}
46+
47+
set
48+
{
49+
this.automationClient = value;
50+
}
51+
}
52+
53+
/// <summary>
54+
/// Gets or sets the automation account name.
55+
/// </summary>
56+
[Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource group name.")]
57+
[ValidateNotNullOrEmpty]
58+
public string ResourceGroupName { get; set; }
59+
3260
/// <summary>
3361
/// Gets or sets the automation account name.
3462
/// </summary>

src/ResourceManager/Automation/Commands.Automation/Cmdlet/RemoveAzureAutomationAccount.cs

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
using Microsoft.Azure.Commands.Automation.Properties;
1919
using Microsoft.Azure.Commands.Automation.Common;
2020
using Microsoft.Azure.Commands.Automation.Model;
21+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
2122

2223
namespace Microsoft.Azure.Commands.Automation.Cmdlet
2324
{
@@ -26,8 +27,36 @@ namespace Microsoft.Azure.Commands.Automation.Cmdlet
2627
/// </summary>
2728
[Cmdlet(VerbsCommon.Remove, "AzureAutomationAccount")]
2829
[OutputType(typeof(AutomationAccount))]
29-
public class RemoveAzureAutomationAccount : AzureAutomationBaseCmdlet
30+
public class RemoveAzureAutomationAccount : AzurePSCmdlet
3031
{
32+
/// <summary>
33+
/// The automation client.
34+
/// </summary>
35+
private IAutomationClient automationClient;
36+
37+
/// <summary>
38+
/// Gets or sets the automation client base.
39+
/// </summary>
40+
public IAutomationClient AutomationClient
41+
{
42+
get
43+
{
44+
return this.automationClient = this.automationClient ?? new AutomationClient(Profile, Profile.Context.Subscription);
45+
}
46+
47+
set
48+
{
49+
this.automationClient = value;
50+
}
51+
}
52+
53+
/// <summary>
54+
/// Gets or sets the automation account name.
55+
/// </summary>
56+
[Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource group name.")]
57+
[ValidateNotNullOrEmpty]
58+
public string ResourceGroupName { get; set; }
59+
3160
/// <summary>
3261
/// Gets or sets the automation account name.
3362
/// </summary>

src/ResourceManager/Automation/Commands.Automation/Cmdlet/SetAzureAutomationAccount.cs

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,38 @@ namespace Microsoft.Azure.Commands.Automation.Cmdlet
2525
/// <summary>
2626
/// Creates azure automation accounts based on automation account name and location.
2727
/// </summary>
28-
[Cmdlet(VerbsCommon.Set, "AzureAutomationAccount", DefaultParameterSetName = AutomationCmdletParameterSets.ByName)]
28+
[Cmdlet(VerbsCommon.Set, "AzureAutomationAccount")]
2929
[OutputType(typeof(AutomationAccount))]
30-
public class SetAzureAutomationAccount : AzureAutomationBaseCmdlet
30+
public class SetAzureAutomationAccount : AzurePSCmdlet
3131
{
32+
/// <summary>
33+
/// The automation client.
34+
/// </summary>
35+
private IAutomationClient automationClient;
36+
37+
/// <summary>
38+
/// Gets or sets the automation client base.
39+
/// </summary>
40+
public IAutomationClient AutomationClient
41+
{
42+
get
43+
{
44+
return this.automationClient = this.automationClient ?? new AutomationClient(Profile, Profile.Context.Subscription);
45+
}
46+
47+
set
48+
{
49+
this.automationClient = value;
50+
}
51+
}
52+
53+
/// <summary>
54+
/// Gets or sets the automation account name.
55+
/// </summary>
56+
[Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource group name.")]
57+
[ValidateNotNullOrEmpty]
58+
public string ResourceGroupName { get; set; }
59+
3260
/// <summary>
3361
/// Gets or sets the automation account name.
3462
/// </summary>

0 commit comments

Comments
 (0)