forked from Azure/azure-powershell
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
1,112 additions
and
3 deletions.
There are no files selected for viewing
96 changes: 96 additions & 0 deletions
96
...ourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationDscCompilationJob.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
// ---------------------------------------------------------------------------------- | ||
// | ||
// Copyright Microsoft Corporation | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// ---------------------------------------------------------------------------------- | ||
|
||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Management.Automation; | ||
using System.Security.Permissions; | ||
using Microsoft.Azure.Commands.Automation.Common; | ||
using Microsoft.Azure.Commands.Automation.Model; | ||
using Microsoft.WindowsAzure.Commands.Utilities.Common; | ||
|
||
namespace Microsoft.Azure.Commands.Automation.Cmdlet | ||
{ | ||
/// <summary> | ||
/// Gets Azure automation compilation job | ||
/// </summary> | ||
[Cmdlet(VerbsCommon.Get, "AzureAutomationDscCompilationJob", DefaultParameterSetName = AutomationCmdletParameterSets.ByAll)] | ||
[OutputType(typeof(CompilationJob))] | ||
public class GetAzureAutomationDscCompilationJob : AzureAutomationBaseCmdlet | ||
{ | ||
/// <summary> | ||
/// Gets or sets the job id. | ||
/// </summary> | ||
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByJobId, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The dsc compilation job id.")] | ||
[Alias("JobId")] | ||
public Guid Id { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the runbook name of the job. | ||
/// </summary> | ||
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByConfigurationName, Mandatory = true, HelpMessage = "The configuration name of the job.")] | ||
[Alias("Name")] | ||
public string ConfigurationName { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the status of a job. | ||
/// </summary> | ||
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByConfigurationName, Mandatory = false, HelpMessage = "The configuration name of the job.")] | ||
[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.ByConfigurationName, Mandatory = false, HelpMessage = "The configuration name of the job.")] | ||
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByAll, Mandatory = false, HelpMessage = "Filter jobs so that job start time >= StartTime.")] | ||
public DateTimeOffset? StartTime { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the end time filter. | ||
/// </summary> | ||
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByConfigurationName, Mandatory = false, HelpMessage = "The configuration name of the job.")] | ||
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByAll, Mandatory = false, HelpMessage = "Filter jobs so that job end time <= EndTime.")] | ||
public DateTimeOffset? EndTime { get; set; } | ||
|
||
/// <summary> | ||
/// Execute this cmdlet. | ||
/// </summary> | ||
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")] | ||
protected override void AutomationExecuteCmdlet() | ||
{ | ||
IEnumerable<CompilationJob> jobs; | ||
|
||
if (this.Id != null && !Guid.Empty.Equals(this.Id)) | ||
{ | ||
// ByJobId | ||
jobs = new List<CompilationJob> { this.AutomationClient.GetCompilationJob(this.ResourceGroupName, this.AutomationAccountName, this.Id) }; | ||
} | ||
else if (this.ConfigurationName != null) | ||
{ | ||
// ByConfiguration | ||
jobs = this.AutomationClient.ListCompilationJobsByConfigurationName(this.ResourceGroupName, this.AutomationAccountName, this.ConfigurationName, this.StartTime, this.EndTime, this.Status); | ||
} | ||
else | ||
{ | ||
// ByAll | ||
jobs = this.AutomationClient.ListCompilationJobs(this.ResourceGroupName, this.AutomationAccountName, this.StartTime, this.EndTime, this.Status); | ||
} | ||
|
||
this.WriteObject(jobs, true); | ||
} | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
...anager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationDscCompilationJobOutput.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// ---------------------------------------------------------------------------------- | ||
// | ||
// Copyright Microsoft Corporation | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// ---------------------------------------------------------------------------------- | ||
|
||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Management.Automation; | ||
using System.Security.Permissions; | ||
using Microsoft.Azure.Commands.Automation.Common; | ||
using Microsoft.Azure.Commands.Automation.Model; | ||
using Microsoft.WindowsAzure.Commands.Utilities.Common; | ||
|
||
namespace Microsoft.Azure.Commands.Automation.Cmdlet | ||
{ | ||
/// <summary> | ||
/// Gets stream for a compilation job | ||
/// </summary> | ||
[Cmdlet(VerbsCommon.Get, "AzureAutomationDscCompilationJobOutput")] | ||
[OutputType(typeof(JobStream))] | ||
public class GetAzureAutomationDscCompilationJobOutput : AzureAutomationBaseCmdlet | ||
{ | ||
/// <summary> | ||
/// Gets or sets the job id | ||
/// </summary> | ||
[Alias("JobId")] | ||
[Parameter(Mandatory = true, Position = 2, ValueFromPipelineByPropertyName = true, HelpMessage = "The job Id")] | ||
public Guid Id { get; set; } | ||
|
||
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The stream type. Defaults to Any.")] | ||
public StreamType Stream { get; set; } | ||
|
||
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Retrieves output created after this time")] | ||
public DateTimeOffset? StartTime { get; set; } | ||
|
||
/// <summary> | ||
/// Execute this cmdlet. | ||
/// </summary> | ||
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")] | ||
protected override void AutomationExecuteCmdlet() | ||
{ | ||
var ret = this.AutomationClient.GetDscCompilationJobStream(this.ResourceGroupName, this.AutomationAccountName, this.Id, this.StartTime, this.Stream.ToString()); | ||
|
||
this.GenerateCmdletOutput(ret); | ||
} | ||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
...ceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationDscNodeConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// ---------------------------------------------------------------------------------- | ||
// | ||
// Copyright Microsoft Corporation | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// ---------------------------------------------------------------------------------- | ||
|
||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Management.Automation; | ||
using System.Security.Permissions; | ||
using Microsoft.Azure.Commands.Automation.Common; | ||
using Microsoft.Azure.Commands.Automation.Model; | ||
using Microsoft.WindowsAzure.Commands.Utilities.Common; | ||
|
||
namespace Microsoft.Azure.Commands.Automation.Cmdlet | ||
{ | ||
/// <summary> | ||
/// Gets Azure automation node configurations | ||
/// </summary> | ||
[Cmdlet(VerbsCommon.Get, "AzureAutomationDscNodeConfiguration", DefaultParameterSetName = AutomationCmdletParameterSets.ByAll)] | ||
[OutputType(typeof(CompilationJob))] | ||
public class GetAzureAutomationDscNodeConfiguration : AzureAutomationBaseCmdlet | ||
{ | ||
/// <summary> | ||
/// Gets or sets the job id. | ||
/// </summary> | ||
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByNodeConfigurationName, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The dsc node configuration name.")] | ||
[Alias("NodeConfigurationName")] | ||
public string Name { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the runbook name of the job. | ||
/// </summary> | ||
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByConfigurationName, Mandatory = true, HelpMessage = "The configuration name.")] | ||
public string ConfigurationName { get; set; } | ||
|
||
/// <summary> | ||
/// Execute this cmdlet. | ||
/// </summary> | ||
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")] | ||
protected override void AutomationExecuteCmdlet() | ||
{ | ||
IEnumerable<NodeConfiguration> nodeConfigurations; | ||
|
||
if (this.Name != null && !Guid.Empty.Equals(this.Name)) | ||
{ | ||
// ByJobId | ||
nodeConfigurations = new List<NodeConfiguration> { this.AutomationClient.GetNodeConfiguration(this.ResourceGroupName, this.AutomationAccountName, this.Name) }; | ||
} | ||
else if (this.ConfigurationName != null) | ||
{ | ||
// ByConfiguration | ||
nodeConfigurations = this.AutomationClient.ListNodeConfigurationsByConfigurationName(this.ResourceGroupName, this.AutomationAccountName, this.ConfigurationName); | ||
} | ||
else | ||
{ | ||
// ByAll | ||
nodeConfigurations = this.AutomationClient.ListNodeConfigurations(this.ResourceGroupName, this.AutomationAccountName); | ||
} | ||
|
||
this.WriteObject(nodeConfigurations, true); | ||
} | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
...rceManager/Automation/Commands.Automation/Cmdlet/StartAzureAutomationDscCompilationJob.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// ---------------------------------------------------------------------------------- | ||
// | ||
// Copyright Microsoft Corporation | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// ---------------------------------------------------------------------------------- | ||
|
||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Management.Automation; | ||
using System.Security.Permissions; | ||
using Microsoft.Azure.Commands.Automation.Common; | ||
using Microsoft.Azure.Commands.Automation.Model; | ||
using Microsoft.WindowsAzure.Commands.Utilities.Common; | ||
|
||
namespace Microsoft.Azure.Commands.Automation.Cmdlet | ||
{ | ||
/// <summary> | ||
/// starts azure automation compilation job | ||
/// </summary> | ||
[Cmdlet(VerbsLifecycle.Start, "AzureAutomationDscCompilationJob", DefaultParameterSetName = AutomationCmdletParameterSets.ByConfigurationName)] | ||
[OutputType(typeof(CompilationJob))] | ||
public class StartAzureAutomationDscCompilationJob : AzureAutomationBaseCmdlet | ||
{ | ||
/// <summary> | ||
/// Gets or sets the configuration name. | ||
/// </summary> | ||
[Parameter(Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The configuration name.")] | ||
public string ConfigurationName { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the configuration parameters. | ||
/// </summary> | ||
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The configuration parameters.")] | ||
public IDictionary Parameters { get; set; } | ||
|
||
/// <summary> | ||
/// Execute this cmdlet. | ||
/// </summary> | ||
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")] | ||
protected override void AutomationExecuteCmdlet() | ||
{ | ||
CompilationJob job = null; | ||
|
||
job = this.AutomationClient.StartCompilationJob(this.ResourceGroupName, this.AutomationAccountName, this.ConfigurationName, this.Parameters); | ||
|
||
this.WriteObject(job); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.