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.
Dsc Node, Dsc Configurations and Dsc MetaConfig cmdlets
- Loading branch information
Showing
22 changed files
with
1,192 additions
and
125 deletions.
There are no files selected for viewing
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
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
102 changes: 102 additions & 0 deletions
102
src/ResourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationDscNode.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,102 @@ | ||
// ---------------------------------------------------------------------------------- | ||
// | ||
// 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.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 dsc node. | ||
/// </summary> | ||
[Cmdlet(VerbsCommon.Get, "AzureAutomationDscNode", DefaultParameterSetName = AutomationCmdletParameterSets.ByAll)] | ||
[OutputType(typeof(DscNode))] | ||
public class GetAzureAutomationDscNode : AzureAutomationBaseCmdlet | ||
{ | ||
/// <summary> | ||
/// Gets or sets the job id. | ||
/// </summary> | ||
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ById, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The dsc node id.")] | ||
[Alias("NodeId")] | ||
public Guid Id { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the status of a dsc node. | ||
/// </summary> | ||
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByName, Mandatory = false, HelpMessage = "Filter dsc nodes based on their status.")] | ||
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByNodeConfiguration, Mandatory = false, HelpMessage = "Filter dsc nodes based on their status.")] | ||
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByAll, Mandatory = false, HelpMessage = "Filter dsc nodes based on their status.")] | ||
[ValidateSet("Compliant", "Not Compliant", "Failed", "Pending", "Received", "Unresponsive")] | ||
public string Status { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the node name. | ||
/// </summary> | ||
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByName, Mandatory = true, ValueFromPipeline = true, HelpMessage = "The node name.")] | ||
[ValidateNotNullOrEmpty] | ||
public string Name { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the nodeconfiguration name. | ||
/// </summary> | ||
[Parameter(ParameterSetName = AutomationCmdletParameterSets.ByNodeConfiguration, Mandatory = true, HelpMessage = "The nodeconfiguration name.")] | ||
[ValidateNotNullOrEmpty] | ||
public string NodeConfigurationName { get; set; } | ||
|
||
/// <summary> | ||
/// Execute this cmdlet. | ||
/// </summary> | ||
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")] | ||
public override void ExecuteCmdlet() | ||
{ | ||
IEnumerable<DscNode> ret = null; | ||
|
||
if (this.ParameterSetName == AutomationCmdletParameterSets.ById) | ||
{ | ||
ret = new List<DscNode> | ||
{ | ||
this.AutomationClient.GetDscNodeById(this.ResourceGroupName, this.AutomationAccountName, this.Id) | ||
}; | ||
} | ||
else if (this.ParameterSetName == AutomationCmdletParameterSets.ByName) | ||
{ | ||
ret = this.AutomationClient.ListDscNodesByName( | ||
this.ResourceGroupName, | ||
this.AutomationAccountName, | ||
this.Name, | ||
this.Status); | ||
} | ||
else if (this.ParameterSetName == AutomationCmdletParameterSets.ByNodeConfiguration) | ||
{ | ||
ret = this.AutomationClient.ListDscNodesByNodeConfiguration( | ||
this.ResourceGroupName, | ||
this.AutomationAccountName, | ||
this.NodeConfigurationName, | ||
this.Status); | ||
} | ||
else | ||
{ | ||
// ByAll | ||
ret = this.AutomationClient.ListDscNodes(this.ResourceGroupName, this.AutomationAccountName, this.Status); | ||
} | ||
|
||
this.GenerateCmdletOutput(ret); | ||
} | ||
} | ||
} |
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
75 changes: 75 additions & 0 deletions
75
...anager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationDscOnboardingMetaconfig.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,75 @@ | ||
// ---------------------------------------------------------------------------------- | ||
// | ||
// 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.Generic; | ||
using System.Globalization; | ||
using System.IO; | ||
using System.Management.Automation; | ||
using System.Security.Permissions; | ||
using Microsoft.Azure.Commands.Automation.Common; | ||
using Microsoft.Azure.Commands.Automation.Model; | ||
using Microsoft.Azure.Commands.Automation.Properties; | ||
using Microsoft.WindowsAzure.Commands.Utilities.Common; | ||
|
||
namespace Microsoft.Azure.Commands.Automation.Cmdlet | ||
{ | ||
/// <summary> | ||
/// Gets azure automation dsc onboarding meta configuration information for a given account. | ||
/// </summary> | ||
[Cmdlet(VerbsCommon.Get, "AzureAutomationDscOnboardingMetaconfig")] | ||
[OutputType(typeof(DscOnboardingMetaconfig))] | ||
public class GetAzureAutomationDscOnboardingMetaconfig : AzureAutomationBaseCmdlet | ||
{ | ||
/// <summary> | ||
/// True to overwrite the existing meta.mof; false otherwise. | ||
/// </summary> | ||
private bool overwriteExistingFile; | ||
|
||
/// <summary> | ||
/// Gets or sets the output folder for the metaconfig mof files | ||
/// </summary> | ||
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The folder where metaconfig mof files to be placed.")] | ||
public string OutputFolder { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the list of computer names | ||
/// </summary> | ||
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The names of computers. If not specified Localhost will be used.")] | ||
[Alias("ComputerName")] | ||
public string[] ComputerNames { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets switch parameter to confirm overwriting of existing configurations. | ||
/// </summary> | ||
[Parameter(Mandatory = false, HelpMessage = "Overwrites an existing configuration with same name.")] | ||
public SwitchParameter Force | ||
{ | ||
get { return this.overwriteExistingFile; } | ||
set { this.overwriteExistingFile = value; } | ||
} | ||
|
||
/// <summary> | ||
/// Execute this cmdlet. | ||
/// </summary> | ||
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")] | ||
public override void ExecuteCmdlet() | ||
{ | ||
var ret = | ||
this.AutomationClient.GetDscMetaConfig(this.ResourceGroupName, this.AutomationAccountName, this.OutputFolder, this.ComputerNames, this.Force); | ||
|
||
this.WriteObject(ret, true); | ||
} | ||
} | ||
} |
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.