Skip to content

Commit 3876af9

Browse files
committed
Merge pull request #9 from kiranisaac/master
JobScheduleParameters and JobParameters should return Dictionary<string,...
2 parents bb88b49 + 8789745 commit 3876af9

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
<Compile Include="Common\AzureAutomationOperationException.cs" />
169169
<Compile Include="Common\Constants.cs" />
170170
<Compile Include="Common\IAutomationClient.cs" />
171-
<Compile Include="Common\PowershellJsonConverter.cs" />
171+
<Compile Include="Common\PowerShellJsonConverter.cs" />
172172
<Compile Include="Common\Requires.cs" />
173173
<Compile Include="Common\RequiresExtensions.cs" />
174174
<Compile Include="Common\ResourceCommonException.cs" />

src/ServiceManagement/Automation/Commands.Automation/Common/AutomationClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1560,7 +1560,7 @@ private IDictionary<string, string> ProcessRunbookParameters(string automationAc
15601560

15611561
if (!hasJobStartedBy)
15621562
{
1563-
filteredParameters.Add(Constants.JobStartedByParameterName, Constants.ClientIdentity);
1563+
filteredParameters.Add(Constants.JobStartedByParameterName, PowerShellJsonConverter.Serialize(Constants.ClientIdentity));
15641564
}
15651565

15661566
return filteredParameters;

src/ServiceManagement/Automation/Commands.Automation/Model/Job.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
// ----------------------------------------------------------------------------------
1212

1313
using Microsoft.Azure.Commands.Automation.Common;
14-
using Microsoft.Azure.Commands.Automation.Properties;
1514
using System;
1615
using System.Collections.Generic;
16+
using System.Linq;
1717

1818
namespace Microsoft.Azure.Commands.Automation.Model
1919
{
@@ -52,7 +52,7 @@ public Job(string accountName, Azure.Management.Automation.Models.Job job)
5252
this.Exception = job.Properties.Exception;
5353
this.EndTime = job.Properties.EndTime;
5454
this.LastStatusModifiedTime = job.Properties.LastStatusModifiedTime;
55-
this.JobParameters = job.Properties.Parameters ?? new Dictionary<string, string>();
55+
this.JobParameters = job.Properties.Parameters.ToDictionary(item => item.Key, item => (object)PowerShellJsonConverter.Deserialize(item.Value)) ?? new Dictionary<string, object>();
5656
}
5757

5858
/// <summary>
@@ -115,7 +115,7 @@ public Job()
115115
/// <summary>
116116
/// Gets or sets the parameters of the job.
117117
/// </summary>
118-
public IDictionary<string, string> JobParameters { get; set; }
118+
public IDictionary<string, object> JobParameters { get; set; }
119119

120120
/// <summary>
121121
/// Gets or sets the runbook.

src/ServiceManagement/Automation/Commands.Automation/Model/JobSchedule.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313
// ----------------------------------------------------------------------------------
1414

1515
using Microsoft.Azure.Commands.Automation.Common;
16-
using Microsoft.Azure.Commands.Automation.Properties;
17-
using System;
1816
using System.Collections.Generic;
17+
using System.Linq;
1918

2019
namespace Microsoft.Azure.Commands.Automation.Model
2120
{
@@ -37,7 +36,7 @@ public JobSchedule(string automationAccountName, Azure.Management.Automation.Mod
3736
this.JobScheduleId = jobSchedule.Properties.Id;
3837
this.RunbookName = jobSchedule.Properties.Runbook.Name;
3938
this.ScheduleName = jobSchedule.Properties.Schedule.Name;
40-
this.Parameters = jobSchedule.Properties.Parameters ?? new Dictionary<string, string>();
39+
this.Parameters = jobSchedule.Properties.Parameters.ToDictionary(item => item.Key, item => (object)PowerShellJsonConverter.Deserialize(item.Value)) ?? new Dictionary<string, object>();
4140
}
4241

4342
/// <summary>
@@ -70,6 +69,6 @@ public JobSchedule()
7069
/// <summary>
7170
/// Gets or sets the runbook parameters.
7271
/// </summary>
73-
public IDictionary<string, string> Parameters { get; set; }
72+
public IDictionary<string, object> Parameters { get; set; }
7473
}
7574
}

0 commit comments

Comments
 (0)