Skip to content

Changes to Module, Credential and Job resource #6

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 3 commits into from
Jan 24, 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 @@ -69,7 +69,7 @@ public void GetAzureAutomationCredentialByAllSuccessfull()
// Setup
string accountName = "automation";

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

// Test
this.cmdlet.AutomationAccountName = accountName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace Microsoft.Azure.Commands.Automation.Cmdlet
/// Gets a Credential for automation.
/// </summary>
[Cmdlet(VerbsCommon.Get, "AzureAutomationCredential", DefaultParameterSetName = AutomationCmdletParameterSets.ByAll)]
[OutputType(typeof(PSCredential))]
[OutputType(typeof(CredentialInfo))]
public class GetAzureAutomationCredential : AzureAutomationBaseCmdlet
{
/// <summary>
Expand All @@ -41,10 +41,10 @@ public class GetAzureAutomationCredential : AzureAutomationBaseCmdlet
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
protected override void AutomationExecuteCmdlet()
{
IEnumerable<Credential> ret = null;
IEnumerable<CredentialInfo> ret = null;
if (!string.IsNullOrEmpty(this.Name))
{
ret = new List<Credential>
ret = new List<CredentialInfo>
{
this.AutomationClient.GetCredential(this.AutomationAccountName, this.Name)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class GetAzureAutomationJob : AzureAutomationBaseCmdlet
/// </summary>
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByJobId, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The job id.")]
[Alias("JobId")]
public Guid? Id { get; set; }
public Guid Id { get; set; }

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

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

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

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

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

if (this.Id.HasValue)
if (this.Id != null && !Guid.Empty.Equals(this.Id))
{
// ByJobId
jobs = new List<Microsoft.Azure.Commands.Automation.Model.Job> { this.AutomationClient.GetJob(this.AutomationAccountName, this.Id.Value) };
jobs = new List<Microsoft.Azure.Commands.Automation.Model.Job> { this.AutomationClient.GetJob(this.AutomationAccountName, this.Id) };
}
else if (this.RunbookName != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class GetAzureAutomationJobOutput : AzureAutomationBaseCmdlet
public string Stream { get; set; }

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

/// <summary>
/// Execute this cmdlet.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace Microsoft.Azure.Commands.Automation.Cmdlet
/// Create a new Credential for automation.
/// </summary>
[Cmdlet(VerbsCommon.New, "AzureAutomationCredential", DefaultParameterSetName = AutomationCmdletParameterSets.ByName)]
[OutputType(typeof(PSCredential))]
[OutputType(typeof(CredentialInfo))]
public class NewAzureAutomationCredential : AzureAutomationBaseCmdlet
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using System.Security.Permissions;
using Microsoft.Azure.Commands.Automation.Model;
using Microsoft.Azure.Commands.Automation.Common;
using System.Collections;

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

/// <summary>
/// Execute this cmdlet.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace Microsoft.Azure.Commands.Automation.Cmdlet
/// Sets a Credential for automation.
/// </summary>
[Cmdlet(VerbsCommon.Set, "AzureAutomationCredential", DefaultParameterSetName = AutomationCmdletParameterSets.ByName)]
[OutputType(typeof(PSCredential))]
[OutputType(typeof(CredentialInfo))]
public class SetAzureAutomationCredential : AzureAutomationBaseCmdlet
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
using System.Security.Permissions;
using Microsoft.Azure.Commands.Automation.Model;
using Microsoft.Azure.Commands.Automation.Common;
using System.Collections;
using System.Linq;

namespace Microsoft.Azure.Commands.Automation.Cmdlet
{
Expand All @@ -41,16 +43,24 @@ public class SetAzureAutomationModule : AzureAutomationBaseCmdlet
/// </summary>
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByName, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The module tags.")]
[ValidateNotNullOrEmpty]
public IDictionary<string, string> Tags { get; set; }
[Alias("Tag")]
public IDictionary Tags { get; set; }

/// <summary>
/// Gets or sets the contentLink
/// </summary>
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true,
HelpMessage = "The ContentLinkUri.")]
public Uri ContentLinkUri { get; set; }

/// <summary>
/// Execute this cmdlet.
/// </summary>
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
protected override void AutomationExecuteCmdlet()
{
var updatedModule = this.AutomationClient.UpdateModule(this.AutomationAccountName, Tags, Name);

var updatedModule = this.AutomationClient.UpdateModule(this.AutomationAccountName, Tags, Name, ContentLinkUri);
this.WriteObject(updatedModule);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
<Compile Include="Model\Certificate.cs" />
<Compile Include="Model\JobSchedule.cs" />
<Compile Include="Model\JobStream.cs" />
<Compile Include="Model\Credential.cs" />
<Compile Include="Model\CredentialInfo.cs" />
<Compile Include="Model\Job.cs" />
<Compile Include="Model\Module.cs" />
<Compile Include="Model\Runbook.cs" />
Expand Down
Loading