Skip to content

Commit e514036

Browse files
committed
2 parents 816f665 + e5da677 commit e514036

File tree

6 files changed

+14
-35
lines changed

6 files changed

+14
-35
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ public class GetAzureAutomationSchedule : AzureAutomationBaseCmdlet
3333
/// </summary>
3434
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByName, Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true,
3535
HelpMessage = "The schedule name.")]
36+
[Alias("ScheduleName")]
37+
[ValidateNotNullOrEmpty]
3638
public string Name { get; set; }
3739

3840
/// <summary>

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@ public class GetAzureAutomationScheduledRunbook : AzureAutomationBaseCmdlet
3737
/// <summary>
3838
/// Gets or sets the runbook name of the job.
3939
/// </summary>
40-
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByRunbookName, Mandatory = true, HelpMessage = "The runbook name of the job schedule.")]
41-
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByRunbookNameAndScheduleName, Mandatory = true, HelpMessage = "The runbook name of the job schedule.")]
40+
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByRunbookName, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The runbook name of the job schedule.")]
41+
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByRunbookNameAndScheduleName, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The runbook name of the job schedule.")]
4242
[Alias("Name")]
4343
public string RunbookName { get; set; }
4444

4545
/// <summary>
4646
/// Gets or sets the runbook name of the job.
4747
/// </summary>
48-
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByScheduleName, Mandatory = true, HelpMessage = "The schedule name of the job schedule.")]
49-
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByRunbookNameAndScheduleName, Mandatory = true, HelpMessage = "The schedule name of the job schedule.")]
48+
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByScheduleName, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The schedule name of the job schedule.")]
49+
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByRunbookNameAndScheduleName, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The schedule name of the job schedule.")]
5050
public string ScheduleName { get; set; }
5151

5252
/// <summary>

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

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ public Schedule UpdateSchedule(string automationAccountName, string scheduleName
145145
AutomationManagement.Models.Schedule scheduleModel = this.GetScheduleModel(automationAccountName,
146146
scheduleName);
147147
isEnabled = (isEnabled.HasValue) ? isEnabled : scheduleModel.Properties.IsEnabled;
148-
description = description ?? scheduleModel.Properties.Description; ;
149-
return this.UpdateScheduleHelper(automationAccountName, scheduleModel, isEnabled, description);
148+
description = description ?? scheduleModel.Properties.Description;
149+
return this.UpdateScheduleHelper(automationAccountName, scheduleName, isEnabled, description);
150150
}
151151

152152
#endregion
@@ -1529,34 +1529,23 @@ private string FormatDateTime(DateTimeOffset dateTime)
15291529
}
15301530

15311531
private Schedule UpdateScheduleHelper(string automationAccountName,
1532-
AutomationManagement.Models.Schedule schedule, bool? isEnabled, string description)
1532+
string scheduleName, bool? isEnabled, string description)
15331533
{
1534-
1535-
if (isEnabled.HasValue)
1536-
{
1537-
schedule.Properties.IsEnabled = isEnabled.Value;
1538-
}
1539-
1540-
if (description != null)
1541-
{
1542-
schedule.Properties.Description = description;
1543-
}
1544-
15451534
var scheduleUpdateParameters = new AutomationManagement.Models.ScheduleUpdateParameters
15461535
{
1547-
Name = schedule.Name,
1536+
Name = scheduleName,
15481537
Properties = new AutomationManagement.Models.ScheduleUpdateProperties
15491538
{
1550-
Description = schedule.Properties.Description,
1551-
IsEnabled = schedule.Properties.IsEnabled
1539+
Description = description,
1540+
IsEnabled = isEnabled
15521541
}
15531542
};
15541543

15551544
this.automationManagementClient.Schedules.Update(
15561545
automationAccountName,
15571546
scheduleUpdateParameters);
15581547

1559-
return this.GetSchedule(automationAccountName, schedule.Name);
1548+
return this.GetSchedule(automationAccountName, scheduleName);
15601549
}
15611550

15621551
private Certificate CreateCertificateInternal(string automationAccountName, string name, string path,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class Constants
3232

3333
public const string AutomationServicePrefix = "OaasCS";
3434

35-
public const string JobStartedByParameterName = "JobStartedBy";
35+
public const string JobStartedByParameterName = "MicrosoftApplicationManagementStartedBy";
3636

3737
// default schedule expiry time for daily schedule, consistent with UX
3838
// 12/31/9999 12:00:00 AM

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ public Module(string automationAccountName, Azure.Management.Automation.Models.M
3333
this.AutomationAccountName = automationAccountName;
3434
this.Name = module.Name;
3535
this.Location = module.Location;
36-
this.Type = module.Type;
3736
this.Tags = module.Tags ?? new Dictionary<string, string>();
3837

3938
if (module.Properties == null) return;
@@ -69,11 +68,6 @@ public Module()
6968
/// </summary>
7069
public string Location { get; set; }
7170

72-
/// <summary>
73-
/// Gets or sets the type.
74-
/// </summary>
75-
public string Type { get; set; }
76-
7771
/// <summary>
7872
/// Gets or sets the tags.
7973
/// </summary>

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ public Runbook(string accountName, AutomationManagement.Models.Runbook runbook)
4545
this.AutomationAccountName = accountName;
4646
this.Name = runbook.Name;
4747
this.Location = runbook.Location;
48-
this.Type = runbook.Type;
4948
this.Tags = runbook.Tags ?? new Dictionary<string, string>();
5049

5150
if (runbook.Properties == null) return;
@@ -85,11 +84,6 @@ public Runbook()
8584
/// </summary>
8685
public string Location { get; set; }
8786

88-
/// <summary>
89-
/// Gets or sets the type.
90-
/// </summary>
91-
public string Type { get; set; }
92-
9387
/// <summary>
9488
/// Gets or sets the tags.
9589
/// </summary>

0 commit comments

Comments
 (0)