Skip to content

Commit cb6d075

Browse files
committed
merge conflicts addressed
2 parents 9065ae5 + e89a6f0 commit cb6d075

17 files changed

+1112
-3
lines changed
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System;
16+
using System.Collections;
17+
using System.Collections.Generic;
18+
using System.Management.Automation;
19+
using System.Security.Permissions;
20+
using Microsoft.Azure.Commands.Automation.Common;
21+
using Microsoft.Azure.Commands.Automation.Model;
22+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
23+
24+
namespace Microsoft.Azure.Commands.Automation.Cmdlet
25+
{
26+
/// <summary>
27+
/// Gets Azure automation compilation job
28+
/// </summary>
29+
[Cmdlet(VerbsCommon.Get, "AzureAutomationDscCompilationJob", DefaultParameterSetName = AutomationCmdletParameterSets.ByAll)]
30+
[OutputType(typeof(CompilationJob))]
31+
public class GetAzureAutomationDscCompilationJob : AzureAutomationBaseCmdlet
32+
{
33+
/// <summary>
34+
/// Gets or sets the job id.
35+
/// </summary>
36+
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByJobId, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The dsc compilation job id.")]
37+
[Alias("JobId")]
38+
public Guid Id { get; set; }
39+
40+
/// <summary>
41+
/// Gets or sets the runbook name of the job.
42+
/// </summary>
43+
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByConfigurationName, Mandatory = true, HelpMessage = "The configuration name of the job.")]
44+
[Alias("Name")]
45+
public string ConfigurationName { get; set; }
46+
47+
/// <summary>
48+
/// Gets or sets the status of a job.
49+
/// </summary>
50+
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByConfigurationName, Mandatory = false, HelpMessage = "The configuration name of the job.")]
51+
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByAll, Mandatory = false, HelpMessage = "Filter jobs based on their status.")]
52+
[ValidateSet("Completed", "Failed", "Queued", "Starting", "Resuming", "Running", "Stopped", "Stopping", "Suspended", "Suspending", "Activating")]
53+
public string Status { get; set; }
54+
55+
/// <summary>
56+
/// Gets or sets the start time filter.
57+
/// </summary>
58+
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByConfigurationName, Mandatory = false, HelpMessage = "The configuration name of the job.")]
59+
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByAll, Mandatory = false, HelpMessage = "Filter jobs so that job start time >= StartTime.")]
60+
public DateTimeOffset? StartTime { get; set; }
61+
62+
/// <summary>
63+
/// Gets or sets the end time filter.
64+
/// </summary>
65+
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByConfigurationName, Mandatory = false, HelpMessage = "The configuration name of the job.")]
66+
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByAll, Mandatory = false, HelpMessage = "Filter jobs so that job end time <= EndTime.")]
67+
public DateTimeOffset? EndTime { get; set; }
68+
69+
/// <summary>
70+
/// Execute this cmdlet.
71+
/// </summary>
72+
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
73+
protected override void AutomationExecuteCmdlet()
74+
{
75+
IEnumerable<CompilationJob> jobs;
76+
77+
if (this.Id != null && !Guid.Empty.Equals(this.Id))
78+
{
79+
// ByJobId
80+
jobs = new List<CompilationJob> { this.AutomationClient.GetCompilationJob(this.ResourceGroupName, this.AutomationAccountName, this.Id) };
81+
}
82+
else if (this.ConfigurationName != null)
83+
{
84+
// ByConfiguration
85+
jobs = this.AutomationClient.ListCompilationJobsByConfigurationName(this.ResourceGroupName, this.AutomationAccountName, this.ConfigurationName, this.StartTime, this.EndTime, this.Status);
86+
}
87+
else
88+
{
89+
// ByAll
90+
jobs = this.AutomationClient.ListCompilationJobs(this.ResourceGroupName, this.AutomationAccountName, this.StartTime, this.EndTime, this.Status);
91+
}
92+
93+
this.WriteObject(jobs, true);
94+
}
95+
}
96+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System;
16+
using System.Collections;
17+
using System.Collections.Generic;
18+
using System.Management.Automation;
19+
using System.Security.Permissions;
20+
using Microsoft.Azure.Commands.Automation.Common;
21+
using Microsoft.Azure.Commands.Automation.Model;
22+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
23+
24+
namespace Microsoft.Azure.Commands.Automation.Cmdlet
25+
{
26+
/// <summary>
27+
/// Gets stream for a compilation job
28+
/// </summary>
29+
[Cmdlet(VerbsCommon.Get, "AzureAutomationDscCompilationJobOutput")]
30+
[OutputType(typeof(JobStream))]
31+
public class GetAzureAutomationDscCompilationJobOutput : AzureAutomationBaseCmdlet
32+
{
33+
/// <summary>
34+
/// Gets or sets the job id
35+
/// </summary>
36+
[Alias("JobId")]
37+
[Parameter(Mandatory = true, Position = 2, ValueFromPipelineByPropertyName = true, HelpMessage = "The job Id")]
38+
public Guid Id { get; set; }
39+
40+
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The stream type. Defaults to Any.")]
41+
public StreamType Stream { get; set; }
42+
43+
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Retrieves output created after this time")]
44+
public DateTimeOffset? StartTime { get; set; }
45+
46+
/// <summary>
47+
/// Execute this cmdlet.
48+
/// </summary>
49+
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
50+
protected override void AutomationExecuteCmdlet()
51+
{
52+
var ret = this.AutomationClient.GetDscCompilationJobStream(this.ResourceGroupName, this.AutomationAccountName, this.Id, this.StartTime, this.Stream.ToString());
53+
54+
this.GenerateCmdletOutput(ret);
55+
}
56+
}
57+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System;
16+
using System.Collections;
17+
using System.Collections.Generic;
18+
using System.Management.Automation;
19+
using System.Security.Permissions;
20+
using Microsoft.Azure.Commands.Automation.Common;
21+
using Microsoft.Azure.Commands.Automation.Model;
22+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
23+
24+
namespace Microsoft.Azure.Commands.Automation.Cmdlet
25+
{
26+
/// <summary>
27+
/// Gets Azure automation node configurations
28+
/// </summary>
29+
[Cmdlet(VerbsCommon.Get, "AzureAutomationDscNodeConfiguration", DefaultParameterSetName = AutomationCmdletParameterSets.ByAll)]
30+
[OutputType(typeof(CompilationJob))]
31+
public class GetAzureAutomationDscNodeConfiguration : AzureAutomationBaseCmdlet
32+
{
33+
/// <summary>
34+
/// Gets or sets the job id.
35+
/// </summary>
36+
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByNodeConfigurationName, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The dsc node configuration name.")]
37+
[Alias("NodeConfigurationName")]
38+
public string Name { get; set; }
39+
40+
/// <summary>
41+
/// Gets or sets the runbook name of the job.
42+
/// </summary>
43+
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByConfigurationName, Mandatory = true, HelpMessage = "The configuration name.")]
44+
public string ConfigurationName { get; set; }
45+
46+
/// <summary>
47+
/// Execute this cmdlet.
48+
/// </summary>
49+
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
50+
protected override void AutomationExecuteCmdlet()
51+
{
52+
IEnumerable<NodeConfiguration> nodeConfigurations;
53+
54+
if (this.Name != null && !Guid.Empty.Equals(this.Name))
55+
{
56+
// ByJobId
57+
nodeConfigurations = new List<NodeConfiguration> { this.AutomationClient.GetNodeConfiguration(this.ResourceGroupName, this.AutomationAccountName, this.Name) };
58+
}
59+
else if (this.ConfigurationName != null)
60+
{
61+
// ByConfiguration
62+
nodeConfigurations = this.AutomationClient.ListNodeConfigurationsByConfigurationName(this.ResourceGroupName, this.AutomationAccountName, this.ConfigurationName);
63+
}
64+
else
65+
{
66+
// ByAll
67+
nodeConfigurations = this.AutomationClient.ListNodeConfigurations(this.ResourceGroupName, this.AutomationAccountName);
68+
}
69+
70+
this.WriteObject(nodeConfigurations, true);
71+
}
72+
}
73+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System.Collections;
16+
using System.Collections.Generic;
17+
using System.Management.Automation;
18+
using System.Security.Permissions;
19+
using Microsoft.Azure.Commands.Automation.Common;
20+
using Microsoft.Azure.Commands.Automation.Model;
21+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
22+
23+
namespace Microsoft.Azure.Commands.Automation.Cmdlet
24+
{
25+
/// <summary>
26+
/// starts azure automation compilation job
27+
/// </summary>
28+
[Cmdlet(VerbsLifecycle.Start, "AzureAutomationDscCompilationJob", DefaultParameterSetName = AutomationCmdletParameterSets.ByConfigurationName)]
29+
[OutputType(typeof(CompilationJob))]
30+
public class StartAzureAutomationDscCompilationJob : AzureAutomationBaseCmdlet
31+
{
32+
/// <summary>
33+
/// Gets or sets the configuration name.
34+
/// </summary>
35+
[Parameter(Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The configuration name.")]
36+
public string ConfigurationName { get; set; }
37+
38+
/// <summary>
39+
/// Gets or sets the configuration parameters.
40+
/// </summary>
41+
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The configuration parameters.")]
42+
public IDictionary Parameters { get; set; }
43+
44+
/// <summary>
45+
/// Execute this cmdlet.
46+
/// </summary>
47+
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
48+
protected override void AutomationExecuteCmdlet()
49+
{
50+
CompilationJob job = null;
51+
52+
job = this.AutomationClient.StartCompilationJob(this.ResourceGroupName, this.AutomationAccountName, this.ConfigurationName, this.Parameters);
53+
54+
this.WriteObject(job);
55+
}
56+
}
57+
}

src/ResourceManager/Automation/Commands.Automation/Commands.ResourceManagement.Automation.csproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@
116116
</ItemGroup>
117117
<ItemGroup>
118118
<Compile Include="Cmdlet\AzureAutomationBaseCmdlet.cs" />
119+
<Compile Include="Cmdlet\GetAzureAutomationDscCompilationJob.cs" />
120+
<Compile Include="Cmdlet\GetAzureAutomationDscCompilationJobOutput.cs" />
121+
<Compile Include="Cmdlet\GetAzureAutomationDscNodeConfiguration.cs" />
122+
<Compile Include="Cmdlet\StartAzureAutomationDscCompilationJob.cs" />
119123
<Compile Include="Cmdlet\GetAzureAutomationAgentRegistrationInformation.cs" />
120124
<Compile Include="Cmdlet\GetAzureAutomationConfiguration.cs" />
121125
<Compile Include="Cmdlet\GetAzureAutomationDscNode.cs" />
@@ -135,6 +139,7 @@
135139
<Compile Include="Common\Constants.cs" />
136140
<Compile Include="Common\IAutomationClient.cs" />
137141
<Compile Include="Common\PowerShellJsonConverter.cs" />
142+
<Compile Include="Common\RequestSettings.cs" />
138143
<Compile Include="Common\Requires.cs" />
139144
<Compile Include="Common\RequiresExtensions.cs" />
140145
<Compile Include="Common\ResourceCommonException.cs" />
@@ -145,9 +150,12 @@
145150
<Compile Include="DataContract\OdataErrorMessage.cs" />
146151
<Compile Include="Model\AgentRegistration.cs" />
147152
<Compile Include="Model\AutomationAccount.cs" />
153+
<Compile Include="Model\CompilationJob.cs" />
148154
<Compile Include="Model\Configuration.cs" />
149155
<Compile Include="Model\DscNode.cs" />
150156
<Compile Include="Model\DscOnboardingMetaconfig.cs" />
157+
<Compile Include="Model\JobStream.cs" />
158+
<Compile Include="Model\NodeConfiguration.cs" />
151159
<Compile Include="Properties\AssemblyInfo.cs" />
152160
<Compile Include="Properties\Resources.Designer.cs">
153161
<AutoGen>True</AutoGen>

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
using System.Net;
2222
using System.Security;
2323
using System.Security.Cryptography.X509Certificates;
24-
using Microsoft.Azure.Commands.Automation.Properties;
2524
using Microsoft.Azure.Commands.Automation.Model;
25+
using Microsoft.Azure.Commands.Automation.Properties;
2626
using Microsoft.Azure.Management.Automation;
2727
using Microsoft.Azure.Management.Automation.Models;
2828
using Microsoft.WindowsAzure.Commands.Common;
@@ -190,5 +190,6 @@ public void DeleteAutomationAccount(string resourceGroupName, string automationA
190190
}
191191

192192
#endregion
193+
193194
}
194195
}

0 commit comments

Comments
 (0)