Skip to content

Commit 5703ce5

Browse files
committed
review comments addressed and MetaConfig Work in progress
1 parent ef8703b commit 5703ce5

9 files changed

+146
-28
lines changed

src/ResourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationAgentRegistrationInformation.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@ namespace Microsoft.Azure.Commands.Automation.Cmdlet
2828
[OutputType(typeof(AgentRegistration))]
2929
public class GetAzureAutomationAgentRegistrationInformation : AzureAutomationBaseCmdlet
3030
{
31-
/// <summary>
32-
/// Gets or sets the automation account name.
33-
/// </summary>
34-
[Parameter(Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The automation account name.")]
35-
[ValidateNotNullOrEmpty]
36-
public string AutomationAccountName { get; set; }
37-
3831
/// <summary>
3932
/// Execute this cmdlet.
4033
/// </summary>

src/ResourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationConfiguration.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@ namespace Microsoft.Azure.Commands.Automation.Cmdlet
2828
[OutputType(typeof(DscConfiguration))]
2929
public class GetAzureAutomationConfiguration : AzureAutomationBaseCmdlet
3030
{
31-
/// <summary>
32-
/// Gets or sets the automation account name.
33-
/// </summary>
34-
[Parameter(Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The automation account name.")]
35-
[ValidateNotNullOrEmpty]
36-
public string AutomationAccountName { get; set; }
37-
3831
/// <summary>
3932
/// Gets or sets the configuration name.
4033
/// </summary>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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.Generic;
16+
using System.Management.Automation;
17+
using System.Security.Permissions;
18+
using Microsoft.Azure.Commands.Automation.Common;
19+
using Microsoft.Azure.Commands.Automation.Model;
20+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
21+
22+
namespace Microsoft.Azure.Commands.Automation.Cmdlet
23+
{
24+
/// <summary>
25+
/// Gets azure automation dsc onboarding meta configuration information for a given account.
26+
/// </summary>
27+
[Cmdlet(VerbsCommon.Get, "AzureAutomationDscOnboardingMetaconfig")]
28+
[OutputType(typeof(DscOnboardingMetaconfig))]
29+
public class GetDscMetaConfiguration : AzureAutomationBaseCmdlet
30+
{
31+
/// <summary>
32+
/// Execute this cmdlet.
33+
/// </summary>
34+
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
35+
public override void ExecuteCmdlet()
36+
{
37+
IEnumerable<DscOnboardingMetaconfig> ret = null;
38+
39+
ret = new List<DscOnboardingMetaconfig>
40+
{
41+
this.AutomationClient.GetDscMetaConfig(
42+
this.ResourceGroupName,
43+
this.AutomationAccountName)
44+
};
45+
46+
this.GenerateCmdletOutput(ret);
47+
}
48+
49+
}
50+
}

src/ResourceManager/Automation/Commands.Automation/Cmdlet/ImportAzureAutomationDscConfiguration.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,6 @@ namespace Microsoft.Azure.Commands.Automation.Cmdlet
3030
[OutputType(typeof(DscConfiguration))]
3131
public class ImportAzureAutomationDscConfiguration : AzureAutomationBaseCmdlet
3232
{
33-
/// <summary>
34-
/// Gets or sets the automation account name.
35-
/// </summary>
36-
[Parameter(Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The automation account name.")]
37-
[ValidateNotNullOrEmpty]
38-
public string AutomationAccountName { get; set; }
39-
4033
/// <summary>
4134
/// Gets or sets the configuration name.
4235
/// </summary>

src/ResourceManager/Automation/Commands.Automation/Cmdlet/NewAzureAutomationKey.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@ namespace Microsoft.Azure.Commands.Automation.Cmdlet
2828
[OutputType(typeof(AgentRegistration))]
2929
public class NewAzureAutomationKey : AzureAutomationBaseCmdlet
3030
{
31-
/// <summary>
32-
/// Gets or sets the automation account name.
33-
/// </summary>
34-
[Parameter(Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The automation account name.")]
35-
[ValidateNotNullOrEmpty]
36-
public string AutomationAccountName { get; set; }
37-
3831
/// <summary>
3932
/// Gets or sets the KeyType.
4033
/// </summary>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
<Compile Include="Cmdlet\AzureAutomationBaseCmdlet.cs" />
119119
<Compile Include="Cmdlet\GetAzureAutomationAgentRegistrationInformation.cs" />
120120
<Compile Include="Cmdlet\GetAzureAutomationConfiguration.cs" />
121+
<Compile Include="Cmdlet\GetDscMetaConfiguration.cs" />
121122
<Compile Include="Cmdlet\ImportAzureAutomationDscConfiguration.cs" />
122123
<Compile Include="Cmdlet\NewAzureAutomationKey.cs" />
123124
<Compile Include="Cmdlet\SetAzureAutomationAccount.cs" />
@@ -142,6 +143,7 @@
142143
<Compile Include="Model\AgentRegistration.cs" />
143144
<Compile Include="Model\AutomationAccount.cs" />
144145
<Compile Include="Model\Configuration.cs" />
146+
<Compile Include="Model\DscOnboardingMetaconfig.cs" />
145147
<Compile Include="Properties\AssemblyInfo.cs" />
146148
<Compile Include="Properties\Resources.Designer.cs">
147149
<AutoGen>True</AutoGen>

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,21 @@ private Model.DscConfiguration TryGetConfigurationModel(string resourceGroupName
198198

199199
#endregion
200200

201+
#region DscMetaConfig Operations
202+
public Model.DscOnboardingMetaconfig GetDscMetaConfig(string resourceGroupName, string automationAccountName)
203+
{
204+
Requires.Argument("ResourceGroupName", resourceGroupName).NotNull();
205+
Requires.Argument("AutomationAccountName", automationAccountName).NotNull();
206+
207+
var dscMetaConfig = this.automationManagementClient.AgentRegistrationInformation.Get(
208+
resourceGroupName,
209+
automationAccountName).AgentRegistration;
210+
211+
return new DscOnboardingMetaconfig(resourceGroupName, automationAccountName, dscMetaConfig);
212+
}
213+
214+
#endregion
215+
201216
#region AgentRegistration Operations
202217
public Model.AgentRegistration GetAgentRegistration(string resourceGroupName, string automationAccountName)
203218
{

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,9 @@ public interface IAutomationClient
5454

5555
Microsoft.Azure.Commands.Automation.Model.AgentRegistration NewAgentRegistrationKey(string resourceGroupName, string automationAccountName, string keyType);
5656
#endregion
57+
58+
#region DscMetaConfiguration
59+
Microsoft.Azure.Commands.Automation.Model.DscOnboardingMetaconfig GetDscMetaConfig(string resourceGroupName, string automationAccountName);
60+
#endregion
5761
}
5862
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
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 Microsoft.Azure.Commands.Automation.Common;
18+
19+
namespace Microsoft.Azure.Commands.Automation.Model
20+
{
21+
using Microsoft.Azure.Management.Automation.Models;
22+
23+
using AutomationManagement = Microsoft.Azure.Management.Automation;
24+
25+
/// <summary>
26+
/// DSC Onboarding Meta Configuration
27+
/// </summary>
28+
public class DscOnboardingMetaconfig
29+
{
30+
/// <summary>
31+
/// Initializes a new instance of the <see cref="DscOnboardingMetaconfig"/> class.
32+
/// </summary>
33+
/// <param name="resourceGroupName">
34+
/// The resource group name.
35+
/// </param>
36+
/// <param name="automationAccountName">
37+
/// The automation account.
38+
/// </param>
39+
/// <param name="dscOnboardingMetaConfig">
40+
/// The dsc onboarding meta configuration.
41+
/// </param>///
42+
public DscOnboardingMetaconfig(string resourceGroupName, string automationAccountName, AutomationManagement.Models.AgentRegistration dscOnboardingMetaConfig)
43+
{
44+
Requires.Argument("ResourceGroupName", resourceGroupName).NotNull();
45+
Requires.Argument("AutomationAccountName", automationAccountName).NotNull();
46+
47+
this.ResourceGroupName = resourceGroupName;
48+
this.AutomationAccountName = automationAccountName;
49+
this.DscMetaConfiguration = dscOnboardingMetaConfig.DscMetaConfiguration;
50+
}
51+
52+
/// <summary>
53+
/// Initializes a new instance of the <see cref="DscOnboardingMetaconfig"/> class.
54+
/// </summary>
55+
public DscOnboardingMetaconfig()
56+
{
57+
}
58+
59+
/// <summary>
60+
/// Gets or sets the resource group name.
61+
/// </summary>
62+
public string ResourceGroupName { get; set; }
63+
64+
/// <summary>
65+
/// Gets or sets the automation account name.
66+
/// </summary>
67+
public string AutomationAccountName { get; set; }
68+
69+
/// <summary>
70+
/// Gets or sets the dsc meta configuration information
71+
/// </summary>
72+
public string DscMetaConfiguration { get; set; }
73+
74+
}
75+
}

0 commit comments

Comments
 (0)