Skip to content

Commit 9717ed0

Browse files
committed
Merge pull request #6 from mohanishpenta/master
Changes to Module, Credential and Job resource
2 parents b5625c3 + 90e411f commit 9717ed0

14 files changed

+137
-94
lines changed

src/ServiceManagement/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationCredentialTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public void GetAzureAutomationCredentialByAllSuccessfull()
6969
// Setup
7070
string accountName = "automation";
7171

72-
this.mockAutomationClient.Setup(f => f.ListCredentials(accountName)).Returns((string a) => new List<Credential>());
72+
this.mockAutomationClient.Setup(f => f.ListCredentials(accountName)).Returns((string a) => new List<CredentialInfo>());
7373

7474
// Test
7575
this.cmdlet.AutomationAccountName = accountName;

src/ServiceManagement/Automation/Commands.Automation/Cmdlet/GetAzureAutomationCredential.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace Microsoft.Azure.Commands.Automation.Cmdlet
2525
/// Gets a Credential for automation.
2626
/// </summary>
2727
[Cmdlet(VerbsCommon.Get, "AzureAutomationCredential", DefaultParameterSetName = AutomationCmdletParameterSets.ByAll)]
28-
[OutputType(typeof(PSCredential))]
28+
[OutputType(typeof(CredentialInfo))]
2929
public class GetAzureAutomationCredential : AzureAutomationBaseCmdlet
3030
{
3131
/// <summary>
@@ -41,10 +41,10 @@ public class GetAzureAutomationCredential : AzureAutomationBaseCmdlet
4141
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
4242
protected override void AutomationExecuteCmdlet()
4343
{
44-
IEnumerable<Credential> ret = null;
44+
IEnumerable<CredentialInfo> ret = null;
4545
if (!string.IsNullOrEmpty(this.Name))
4646
{
47-
ret = new List<Credential>
47+
ret = new List<CredentialInfo>
4848
{
4949
this.AutomationClient.GetCredential(this.AutomationAccountName, this.Name)
5050
};

src/ServiceManagement/Automation/Commands.Automation/Cmdlet/GetAzureAutomationJob.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class GetAzureAutomationJob : AzureAutomationBaseCmdlet
3333
/// </summary>
3434
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByJobId, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The job id.")]
3535
[Alias("JobId")]
36-
public Guid? Id { get; set; }
36+
public Guid Id { get; set; }
3737

3838
/// <summary>
3939
/// Gets or sets the runbook name of the job.
@@ -42,26 +42,26 @@ public class GetAzureAutomationJob : AzureAutomationBaseCmdlet
4242
public string RunbookName { get; set; }
4343

4444
/// <summary>
45-
/// Gets or sets the runbook name of the job.
45+
/// Gets or sets the status of a job.
4646
/// </summary>
4747
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByRunbookName, Mandatory = false, HelpMessage = "The runbook name of the job.")]
48-
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByAll, Mandatory = false, HelpMessage = "Filter jobs so that job start time >= StartTime.")]
49-
[ValidateSet("Completed", "Failed", "Queued", "Starting", "Resuming", "Running", "Stopped", "Stopping", "Suspended", "Suspending", "Activating", "Blocked", "Removing")]
48+
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByAll, Mandatory = false, HelpMessage = "Filter jobs based on their status.")]
49+
[ValidateSet("Completed", "Failed", "Queued", "Starting", "Resuming", "Running", "Stopped", "Stopping", "Suspended", "Suspending", "Activating")]
5050
public string Status { get; set; }
5151

5252
/// <summary>
5353
/// Gets or sets the start time filter.
5454
/// </summary>
5555
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByRunbookName, Mandatory = false, HelpMessage = "Filter jobs so that job start time >= StartTime.")]
5656
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByAll, Mandatory = false, HelpMessage = "Filter jobs so that job start time >= StartTime.")]
57-
public DateTime? StartTime { get; set; }
57+
public DateTimeOffset? StartTime { get; set; }
5858

5959
/// <summary>
6060
/// Gets or sets the end time filter.
6161
/// </summary>
6262
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByRunbookName, Mandatory = false, HelpMessage = "Filter jobs so that job end time <= EndTime.")]
6363
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByAll, Mandatory = false, HelpMessage = "Filter jobs so that job end time <= EndTime.")]
64-
public DateTime? EndTime { get; set; }
64+
public DateTimeOffset? EndTime { get; set; }
6565

6666
/// <summary>
6767
/// Execute this cmdlet.
@@ -71,10 +71,10 @@ protected override void AutomationExecuteCmdlet()
7171
{
7272
IEnumerable<Microsoft.Azure.Commands.Automation.Model.Job> jobs;
7373

74-
if (this.Id.HasValue)
74+
if (this.Id != null && !Guid.Empty.Equals(this.Id))
7575
{
7676
// ByJobId
77-
jobs = new List<Microsoft.Azure.Commands.Automation.Model.Job> { this.AutomationClient.GetJob(this.AutomationAccountName, this.Id.Value) };
77+
jobs = new List<Microsoft.Azure.Commands.Automation.Model.Job> { this.AutomationClient.GetJob(this.AutomationAccountName, this.Id) };
7878
}
7979
else if (this.RunbookName != null)
8080
{

src/ServiceManagement/Automation/Commands.Automation/Cmdlet/GetAzureAutomationJobOutput.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class GetAzureAutomationJobOutput : AzureAutomationBaseCmdlet
3939
public string Stream { get; set; }
4040

4141
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Retrieves output created after this time")]
42-
public DateTime? StartTime { get; set; }
42+
public DateTimeOffset? StartTime { get; set; }
4343

4444
/// <summary>
4545
/// Execute this cmdlet.

src/ServiceManagement/Automation/Commands.Automation/Cmdlet/NewAzureAutomationCredential.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace Microsoft.Azure.Commands.Automation.Cmdlet
2525
/// Create a new Credential for automation.
2626
/// </summary>
2727
[Cmdlet(VerbsCommon.New, "AzureAutomationCredential", DefaultParameterSetName = AutomationCmdletParameterSets.ByName)]
28-
[OutputType(typeof(PSCredential))]
28+
[OutputType(typeof(CredentialInfo))]
2929
public class NewAzureAutomationCredential : AzureAutomationBaseCmdlet
3030
{
3131
/// <summary>

src/ServiceManagement/Automation/Commands.Automation/Cmdlet/NewAzureAutomationModule.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
using System.Security.Permissions;
1919
using Microsoft.Azure.Commands.Automation.Model;
2020
using Microsoft.Azure.Commands.Automation.Common;
21+
using System.Collections;
2122

2223
namespace Microsoft.Azure.Commands.Automation.Cmdlet
2324
{
@@ -48,7 +49,8 @@ public class NewAzureAutomationModule : AzureAutomationBaseCmdlet
4849
/// Gets or sets the module tags.
4950
/// </summary>
5051
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The module tags.")]
51-
public IDictionary<string, string> Tags { get; set; }
52+
[Alias("Tag")]
53+
public IDictionary Tags { get; set; }
5254

5355
/// <summary>
5456
/// Execute this cmdlet.

src/ServiceManagement/Automation/Commands.Automation/Cmdlet/SetAzureAutomationCredential.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace Microsoft.Azure.Commands.Automation.Cmdlet
2525
/// Sets a Credential for automation.
2626
/// </summary>
2727
[Cmdlet(VerbsCommon.Set, "AzureAutomationCredential", DefaultParameterSetName = AutomationCmdletParameterSets.ByName)]
28-
[OutputType(typeof(PSCredential))]
28+
[OutputType(typeof(CredentialInfo))]
2929
public class SetAzureAutomationCredential : AzureAutomationBaseCmdlet
3030
{
3131
/// <summary>

src/ServiceManagement/Automation/Commands.Automation/Cmdlet/SetAzureAutomationModule.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
using System.Security.Permissions;
1919
using Microsoft.Azure.Commands.Automation.Model;
2020
using Microsoft.Azure.Commands.Automation.Common;
21+
using System.Collections;
22+
using System.Linq;
2123

2224
namespace Microsoft.Azure.Commands.Automation.Cmdlet
2325
{
@@ -41,16 +43,24 @@ public class SetAzureAutomationModule : AzureAutomationBaseCmdlet
4143
/// </summary>
4244
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByName, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The module tags.")]
4345
[ValidateNotNullOrEmpty]
44-
public IDictionary<string, string> Tags { get; set; }
46+
[Alias("Tag")]
47+
public IDictionary Tags { get; set; }
48+
49+
/// <summary>
50+
/// Gets or sets the contentLink
51+
/// </summary>
52+
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true,
53+
HelpMessage = "The ContentLinkUri.")]
54+
public Uri ContentLinkUri { get; set; }
4555

4656
/// <summary>
4757
/// Execute this cmdlet.
4858
/// </summary>
4959
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
5060
protected override void AutomationExecuteCmdlet()
5161
{
52-
var updatedModule = this.AutomationClient.UpdateModule(this.AutomationAccountName, Tags, Name);
53-
62+
var updatedModule = this.AutomationClient.UpdateModule(this.AutomationAccountName, Tags, Name, ContentLinkUri);
63+
5464
this.WriteObject(updatedModule);
5565
}
5666
}

src/ServiceManagement/Automation/Commands.Automation/Commands.Automation.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@
175175
<Compile Include="Model\Certificate.cs" />
176176
<Compile Include="Model\JobSchedule.cs" />
177177
<Compile Include="Model\JobStream.cs" />
178-
<Compile Include="Model\Credential.cs" />
178+
<Compile Include="Model\CredentialInfo.cs" />
179179
<Compile Include="Model\Job.cs" />
180180
<Compile Include="Model\Module.cs" />
181181
<Compile Include="Model\Runbook.cs" />

0 commit comments

Comments
 (0)