Skip to content

Commit

Permalink
merge conflicts addressed
Browse files Browse the repository at this point in the history
  • Loading branch information
psap committed Apr 14, 2015
2 parents 9065ae5 + e89a6f0 commit cb6d075
Show file tree
Hide file tree
Showing 17 changed files with 1,112 additions and 3 deletions.
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);
}
}
}
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);
}
}
}
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);
}
}
}
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);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Cmdlet\AzureAutomationBaseCmdlet.cs" />
<Compile Include="Cmdlet\GetAzureAutomationDscCompilationJob.cs" />
<Compile Include="Cmdlet\GetAzureAutomationDscCompilationJobOutput.cs" />
<Compile Include="Cmdlet\GetAzureAutomationDscNodeConfiguration.cs" />
<Compile Include="Cmdlet\StartAzureAutomationDscCompilationJob.cs" />
<Compile Include="Cmdlet\GetAzureAutomationAgentRegistrationInformation.cs" />
<Compile Include="Cmdlet\GetAzureAutomationConfiguration.cs" />
<Compile Include="Cmdlet\GetAzureAutomationDscNode.cs" />
Expand All @@ -135,6 +139,7 @@
<Compile Include="Common\Constants.cs" />
<Compile Include="Common\IAutomationClient.cs" />
<Compile Include="Common\PowerShellJsonConverter.cs" />
<Compile Include="Common\RequestSettings.cs" />
<Compile Include="Common\Requires.cs" />
<Compile Include="Common\RequiresExtensions.cs" />
<Compile Include="Common\ResourceCommonException.cs" />
Expand All @@ -145,9 +150,12 @@
<Compile Include="DataContract\OdataErrorMessage.cs" />
<Compile Include="Model\AgentRegistration.cs" />
<Compile Include="Model\AutomationAccount.cs" />
<Compile Include="Model\CompilationJob.cs" />
<Compile Include="Model\Configuration.cs" />
<Compile Include="Model\DscNode.cs" />
<Compile Include="Model\DscOnboardingMetaconfig.cs" />
<Compile Include="Model\JobStream.cs" />
<Compile Include="Model\NodeConfiguration.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
using System.Net;
using System.Security;
using System.Security.Cryptography.X509Certificates;
using Microsoft.Azure.Commands.Automation.Properties;
using Microsoft.Azure.Commands.Automation.Model;
using Microsoft.Azure.Commands.Automation.Properties;
using Microsoft.Azure.Management.Automation;
using Microsoft.Azure.Management.Automation.Models;
using Microsoft.WindowsAzure.Commands.Common;
Expand Down Expand Up @@ -190,5 +190,6 @@ public void DeleteAutomationAccount(string resourceGroupName, string automationA
}

#endregion

}
}
Loading

0 comments on commit cb6d075

Please sign in to comment.